]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2227 Display message for update plugins which dependencies needed sonar updgrade
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 19 Feb 2013 15:24:32 +0000 (16:24 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 19 Feb 2013 15:24:32 +0000 (16:24 +0100)
sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_dependencies.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/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb

index e84535eb1892b8ddff0272174e9a2ec96e96a461..44e76877a136ac111a6ce1c87b36c5a7fc1f8858 100644 (file)
@@ -21,6 +21,7 @@ package org.sonar.server.plugins;
 
 import org.sonar.api.ServerComponent;
 import org.sonar.api.platform.PluginRepository;
+import org.sonar.server.platform.ServerStartException;
 import org.sonar.updatecenter.common.PluginReferential;
 
 public class InstalledPluginReferentialFactory implements ServerComponent {
@@ -34,15 +35,19 @@ public class InstalledPluginReferentialFactory implements ServerComponent {
     this.pluginReferentialMetadataConverter = pluginReferentialMetadataConverter;
   }
 
-  public void start(){
-    init();
+  public void start() {
+    try {
+      init();
+    } catch (Exception e) {
+      throw new ServerStartException("Unable to load installed plugins", e);
+    }
   }
 
   public PluginReferential getInstalledPluginReferential() {
     return installedPluginReferential;
   }
 
-  private void init(){
+  private void init() {
     installedPluginReferential = pluginReferentialMetadataConverter.getInstalledPluginReferential(pluginRepository.getMetadata());
   }
 
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_dependencies.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_dependencies.html.erb
deleted file mode 100644 (file)
index 111fa5b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<% if release %>
-  <% release.outgoingDependencies.each_with_index do |outgoing_release, index| %>
-    <tr>
-      <% if index == 0 %>
-        <td class="thin nowrap"><b>Require plugins:</b></td>
-      <% else %>
-        <td>&nbsp;</td>
-      <% end %>
-      <td><span><%= outgoing_release.artifact.name -%> version <%= outgoing_release.version.name -%></span></td>
-    </tr>
-  <% end %>
-  <% release.incomingDependencies.each_with_index do |incoming_release, index| %>
-  <tr>
-    <% if index == 0 %>
-      <td class="thin nowrap"><b>Incoming plugins:</b></td>
-    <% else %>
-      <td>&nbsp;</td>
-    <% end %>
-    <td><span><%= incoming_release.artifact.name -%> version <%= incoming_release.version.name -%></span></td>
-  </tr>
-  <% end %>
-<% end %>
\ No newline at end of file
index 2fc48c1365a8d84e0c430f3d1056ae6908958853..cd2a1abeb7c85eadea5f9977ef26b087e7496649 100644 (file)
@@ -45,14 +45,10 @@ function installPlugin(key) {
           <table class="spaced width100">
             <%= render :partial => 'updatecenter/children', :locals => {:children => children}  %>
             <% release = @update_plugin_center.findLatestCompatibleRelease(plugin.key) %>
-              <% release.outgoingDependencies.each_with_index do |outgoing_release, index| %>
+            <% release_dep_names = release.outgoingDependencies.collect { |dep| dep.artifact.name } %>
+              <% unless release_dep_names.empty? %>
               <tr>
-                <% if index == 0 %>
-                  <td class="thin nowrap"><b>Installing this plugin will also install:</b></td>
-                <% else %>
-                  <td>&nbsp;</td>
-                <% end %>
-                <td><span><%= outgoing_release.artifact.name -%></span></td>
+                 <td class="thin nowrap" colspan="2"><b>Installing this plugin will also install: </b><%= release_dep_names.join(', ') -%></td>
               </tr>
             <% end %>
 
index 5b8d522145437b9728abccdf17146e1a0af2a2be..d553ae5e15dabb934a83a608bc0cc19a7dc055f9 100644 (file)
 
          <table class="spaced width100">
            <%= render :partial => 'updatecenter/children', :locals => {:children => plugin.children}  %>
+
            <% release = @installed_plugin_referential.findLatestRelease(plugin.key) %>
-           <% release.outgoingDependencies.each_with_index do |outgoing_release, index| %>
+           <% release_dep_names = release.outgoingDependencies.collect { |dep| dep.artifact.name } %>
+           <% unless release_dep_names.empty? %>
              <tr>
-               <% if index == 0 %>
-                 <td class="thin nowrap"><b>Depends upon:</b></td>
-               <% else %>
-                 <td>&nbsp;</td>
-               <% end %>
-               <td><span><%= outgoing_release.artifact.name -%></span></td>
+               <td class="thin nowrap" colspan="2"><b>Depends upon: </b><%= release_dep_names.join(', ') -%></td>
              </tr>
            <% end %>
-           <% release.incomingDependencies.each_with_index do |incoming_release, index| %>
+           <% release_dep_names = release.incomingDependencies.collect { |dep| dep.artifact.name } %>
+           <% unless release_dep_names.empty? %>
              <tr>
-               <% if index == 0 %>
-                 <td class="thin nowrap"><b>Uninstalling this plugin will also uninstall:</b></td>
-               <% else %>
-                 <td>&nbsp;</td>
-               <% end %>
-               <td><span><%= incoming_release.artifact.name -%></span></td>
+               <td class="thin nowrap" colspan="2"><b>Uninstalling this plugin will also uninstall: </b><%= release_dep_names.join(', ') -%></td>
              </tr>
            <% end %>
 
index fc6f195a617654bbf2833056f0974d24666dedd7..2095f0e0141202af3ea57f6d3ddf454e102e24f2 100644 (file)
@@ -38,45 +38,41 @@ function upgradePlugin(key) {
           <td><%= release.getDescription() -%></td>
           <td><%= link_to 'Release Notes', release.getChangelogUrl(), :class => 'external' if release.getChangelogUrl() %></td>
           <td>
-           <% if update.isIncompatible() %>
-             <%= image_tag 'warning.png' -%> Incompatible
-           <% elsif update.requiresSonarUpgrade %>
-             <%= image_tag 'warning.png' -%> Incompatible, requires to upgrade system
-           <% end %>
+            <% if update.isIncompatible() %>
+              <%= image_tag 'warning.png' -%> Incompatible
+            <% elsif update.requiresSonarUpgrade %>
+              <%= image_tag 'warning.png' -%> Incompatible, requires to upgrade system
+            <% elsif update.requiresSonarUpgradeForDependencies %>
+              <%= image_tag 'warning.png' -%> Incompatible, some dependencies requires Sonar upgrade
+            <% end %>
           </td>
          </tr>
        <%
           end
        %>
-       <% if @last_compatible[plugin.getKey()] %>
 
        <% release = @update_plugin_center.findLatestCompatibleRelease(plugin.key)
           releases = release.outgoingDependencies + release.incomingDependencies
-       %>
-       <% releases.each_with_index do |outgoing_release, index| %>
-         <tr class="<%= css -%>">
+          release_dep_names = releases.collect { |dep| dep.artifact.name } %>
+       <% unless release_dep_names.empty? %>
+         <tr>
            <td> </td>
            <td> </td>
-           <% if index == 0 %>
-             <td class="thin nowrap"><b>Updating this plugin will also update:</b></td>
-           <% else %>
-             <td >&nbsp;</td>
-           <% end %>
-           <td colspan="4">
-             <span><%= outgoing_release.artifact.name -%></span>
-           </td>
+           <td class="thin nowrap" colspan="5"><b>Updating this plugin will also update: </b><%= release_dep_names.join(', ') -%></td>
          </tr>
        <% end %>
 
-       <tr class="<%= css -%>">
-         <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="upgradePlugin('<%= plugin.getKey() -%>');return false;"/>
-           </form>
-          </td>
-        </tr>
+       <% if @last_compatible[plugin.getKey()] %>
+         <tr class="<%= css -%>">
+           <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="upgradePlugin('<%= plugin.getKey() -%>');return false;"/>
+             </form>
+            </td>
+          </tr>
         <% end %>
+
        <%
         end
        %>