]> source.dussan.org Git - sonarqube.git/commitdiff
Improve UI of Update Center + fix bug when plugin version is not listed in compatibil...
authorsimonbrandhof <simon.brandhof@gmail.com>
Mon, 1 Nov 2010 23:31:32 +0000 (23:31 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Mon, 1 Nov 2010 23:31:32 +0000 (23:31 +0000)
sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrix.java
sonar-server/src/main/webapp/WEB-INF/app/helpers/updatecenter_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_list.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb

index a5c698539c31b2efc3e48fd5fd2aaf3d7faa4fa8..82c1cc773c1651d786db332aa14a87dcc8fc001a 100644 (file)
@@ -125,10 +125,7 @@ public final class UpdateCenterMatrix {
       Version pluginVersion = entry.getValue();
       Release pluginRelease = plugin.getRelease(pluginVersion);
 
-      if (pluginRelease == null) {
-        update.addIncompatiblePlugin(plugin);
-
-      } else if (pluginRelease.supportSonarVersion(sonarRelease.getVersion())) {
+      if (pluginRelease != null && pluginRelease.supportSonarVersion(sonarRelease.getVersion())) {
         update.addCompatiblePlugin(plugin);
 
       } else {
index 04139237bee36c71cf0710326d44615ecb7bbc5f..856025ab7a7f8fe713e8640208b1863339507883 100644 (file)
 module UpdatecenterHelper
 
   def release_date(date)
-    Time.at(date.getTime() / 1000).strftime('%b %e, %Y')
+    if date
+      Time.at(date.getTime() / 1000).strftime('%b %e, %Y')
+    else
+      nil
+    end
   end
 
 end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_list.html.erb
deleted file mode 100644 (file)
index e69de29..0000000
index e4ccf1b0b5ae425a30588485cf6e0b2699ca006e..297999c8940b461509acb7e369d60ede36d7d729 100644 (file)
@@ -49,48 +49,54 @@ function installPlugin(key) {
         <td>
           <%= plugin.getDescription() %>
           <div id="detail-<%= plugin.getKey() -%>" style="display:none">
+          <table class="spaced width100">
             <% if plugin.getLicense() %>
-              <p>
-                License: <%= h(plugin.getLicense()) %>
-              </p>
+              <tr>
+                <td class="thin nowrap">License: </td><td><%= h(plugin.getLicense()) %></td>
+              </tr>
             <% end %>
             <% if plugin.getOrganization() %>
-              <p>
-                By: <%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external'  %>
-              </p>
+              <tr>
+                <td class="thin nowrap">Author: </td><td><%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external'  %></td>
+              </tr>
             <% end %>
             <% if plugin.getHomepageUrl() || plugin.getIssueTrackerUrl() %>
-            <p>
-              <% if plugin.getHomepageUrl() %>
-                <%= link_to 'Plugin details', plugin.getHomepageUrl(), :class=>'external' %>  |
-              <% end %>
-              <% if plugin.getIssueTrackerUrl() %>
-                <%= link_to "Issue Tracker", plugin.getIssueTrackerUrl(), :class=>'external' %>
-              <% end %>
-            </p>
+            <tr>
+              <td class="thin nowrap">Links: </td>
+              <td>
+                <%= link_to 'Homepage', plugin.getHomepageUrl(), :class=>'external' if plugin.getHomepageUrl() -%>
+                <%= link_to "Issue Tracker", plugin.getIssueTrackerUrl(), :class=>'external' if plugin.getIssueTrackerUrl() -%>
+              </td>
+            </tr>
+            <% end %>
             <%
-              end
               if update.isCompatible()
             %>
-            <p>
-              Version: <%= update.getRelease().getVersion() -%>
-            </p>
-            <div>
+            <tr>
+              <% date=release_date(update.getRelease().getDate()) %>
+              <td class="thin nowrap">Version: </td>
+              <td><%= update.getRelease().getVersion() -%> <%= "(#{date})" if date -%></td>
+            </tr>
+            <tr>
+              <td colspan="2">
               <% if plugin.getTermsConditionsUrl() %>
               <input type="checkbox" id="tc-<%= plugin.getKey() -%>"></input> I accept the <%= link_to 'Terms and Conditions', plugin.getTermsConditionsUrl(), :class => 'external' %>
               <% end %>
               <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/install?from=available&key=<%= plugin.getKey() -%>&version=<%= update.getRelease().getVersion() -%>" style="display: inline-block" id="install-<%= plugin.getKey() -%>">
                 <input type="submit" value="Install" onClick="return installPlugin('<%= plugin.getKey() -%>')" id="submit-<%= plugin.getKey() -%>"></input>
               </form>
-            </div>
+            </td>
+            </tr>
             <% elsif update.requiresSonarUpgrade
             %>
-              <p>
-                Version: <%= update.getRelease().getVersion() -%> (not compatible, needs Sonar upgrade)
-              </p>
+              <tr>
+                <td class="thin nowrap">Last version: </td>
+                <td><%= update.getRelease().getVersion() -%> (<%= image_tag 'warning.png' -%> Not compatible, requires Sonar upgrade)</td>
+              </tr>
             <%
               end
             %>
+          </table>
           </div>
         </td>
       </tr>
index 58f7fca5504c4294da19b3d74fea072acdec2591..432ad359a5aa33049dd34de0c32b5af9041038a5 100644 (file)
@@ -1,4 +1,13 @@
- <ul class="tabs">
+ <script>
+function upgradePlugin(key) {
+  var button=$('upgrade-submit-' + key);
+  button.disable();
+  button.writeAttribute('value', 'Upgrading');
+  return true;
+}
+</script>
+
+<ul class="tabs">
    <li>
      <a href="<%= url_for :action => 'index' -%>">Installed</a>
    </li>
@@ -21,7 +30,7 @@
        <tbody>
        <% if @updates_by_plugin.empty? %>
          <tr class="even">
-           <td colspan="2">No updates</td>
+           <td colspan="2">All of your plugins are up to date.</td>
          </tr>
        <% end %>
        <% @updates_by_plugin.keys.each do |plugin|
            <td><%= link_to 'Release Notes', release.getChangelogUrl(), :class => 'external' if release.getChangelogUrl() %></td>
            <td>
              <% if update.isIncompatible() %>
-               <%= image_tag 'warning.png' -%> Not compatible
+               <%= image_tag 'warning.png' -%> Incompatible
              <% elsif update.requiresSonarUpgrade %>
-               <%= image_tag 'warning.png' -%> Not compatible, requires to upgrade system
+               <%= image_tag 'warning.png' -%> Incompatible, requires to upgrade system
              <% end %>
            </td>
          </tr>
        <%
           end
        %>
+       <% if @last_compatible[plugin.getKey()] %>
        <tr class="<%= css -%>">
-      <td> </td>
-      <td colspan="5">
-      <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/install?from=updates&key=<%= plugin.getKey() -%>&version=<%= @last_compatible[plugin.getKey()] -%>" style="display: inline-block">
-               <input type="submit" value="Upgrade to <%= @last_compatible[plugin.getKey()] -%>"></input>
-             </form>
-      </td>
-    </tr>
+         <td> </td>
+         <td colspan="5">
+          <form method="post" id="upgrade-form-<%= plugin.getKey() -%>" action="<%= ApplicationController.root_context -%>/updatecenter/install?from=updates&key=<%= plugin.getKey() -%>&version=<%= @last_compatible[plugin.getKey()] -%>" style="display: inline-block">
+             <input type="submit" id="upgrade-submit-<%= plugin.getKey() -%>" value="Upgrade to <%= @last_compatible[plugin.getKey()] -%>" onClick="return upgradePlugin('<%= plugin.getKey() -%>')"></input>
+           </form>
+          </td>
+        </tr>
+        <% end %>
        <%
         end
        %>
           <td> </td>
           <td colspan="3">
             <% if update.isIncompatible() %>
-              <%= image_tag 'warning.png' -%> Not compatible plugins must be uninstalled before upgrading system:
+              <%= image_tag 'warning.png' -%> Incompatible plugins must be uninstalled before upgrading system:
               <%= update.getIncompatiblePlugins().map{|plugin| plugin.getName()}.sort.join(',') -%>
             <% end %>
             <% if update.requiresPluginUpgrades() %>