aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-02-19 16:24:32 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2013-02-19 16:24:32 +0100
commit22e755ca4056d5dc653252048f9b2511120e8025 (patch)
treef0880dc5853596204229a7ae0046d3eab2b5fabc /sonar-server
parent8bb86bff7dff7baa35f51a1a5447c1d0ccb220a8 (diff)
downloadsonarqube-22e755ca4056d5dc653252048f9b2511120e8025.tar.gz
sonarqube-22e755ca4056d5dc653252048f9b2511120e8025.zip
SONAR-2227 Display message for update plugins which dependencies needed sonar updgrade
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_dependencies.html.erb22
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb21
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb46
5 files changed, 39 insertions, 71 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java b/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java
index e84535eb189..44e76877a13 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java
@@ -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
index 111fa5bb4ed..00000000000
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_dependencies.html.erb
+++ /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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb
index 2fc48c1365a..cd2a1abeb7c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb
@@ -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 %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb
index 5b8d5221454..d553ae5e15d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb
@@ -30,25 +30,18 @@
<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 %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb
index fc6f195a617..2095f0e0141 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb
@@ -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
%>