From: simonbrandhof Date: Tue, 2 Nov 2010 12:58:53 +0000 (+0000) Subject: SONAR-1893 display system updates in a new tab X-Git-Tag: 2.6~695 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=881fab03f390598ed76fff0e660562d619b687d4;p=sonarqube.git SONAR-1893 display system updates in a new tab --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb index efec31b834d..674263c87b7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb @@ -39,7 +39,6 @@ class UpdatecenterController < ApplicationController @center=nil @matrix=nil - @sonar_updates=[] @updates_by_plugin={} @user_plugins={} @last_compatible={} @@ -51,7 +50,6 @@ class UpdatecenterController < ApplicationController load_matrix() if @matrix @center=@matrix.getCenter() - @sonar_updates=@matrix.findSonarUpdates() @matrix.findPluginUpdates().each do |update| plugin=update.getPlugin() @@ -100,7 +98,7 @@ class UpdatecenterController < ApplicationController end redirect_to :action => (params[:from] || 'index') end - + def uninstall key=params[:key] if key @@ -110,20 +108,34 @@ class UpdatecenterController < ApplicationController flash[:error]=e.message end end - redirect_to :action => 'index' + redirect_to :action => (params[:from] || 'index') end - + def cancel_uninstalls java_facade.cancelPluginUninstalls() flash[:notice]="Pending plugin uninstalls are canceled." redirect_to :action => 'index' end - + + def system_updates + @uninstalls=java_facade.getPluginUninstalls() + @downloads=java_facade.getPluginDownloads() + + @center=nil + @matrix=nil + @sonar_updates=[] + load_matrix() + if @matrix + @center=@matrix.getCenter() + @sonar_updates=@matrix.findSonarUpdates() + end + end + private def load_matrix @matrix=java_facade.getUpdateCenterMatrix(params[:reload]=='true') end - + def updatecenter_activated update_center_activated = java_facade.getConfigurationValue('sonar.updatecenter.activate') || 'true'; if update_center_activated!='true' diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_tabs.html.erb new file mode 100644 index 00000000000..11c148d741f --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_tabs.html.erb @@ -0,0 +1,14 @@ + 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 5e2e82e9e2c..4578dc6a0db 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 @@ -12,18 +12,7 @@ function installPlugin(key) { return true; } - - + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'available'} -%>
<%= render :partial => 'updatecenter/operations' -%> 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 7d864bd0012..b617f0e2f5f 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 @@ -1,14 +1,5 @@ - + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'index'} -%> +
<%= render :partial => 'updatecenter/operations' -%> @@ -69,6 +60,9 @@
+ + + <% @core_plugins.each do |plugin| diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb new file mode 100644 index 00000000000..aaf3e5a0f69 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb @@ -0,0 +1,93 @@ + + + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'system_updates'} -%> + +
+ + <%= render :partial => 'updatecenter/operations' -%> + + <% if @center %> + <% if @sonar_updates.empty? %> +

System plugins

+ + + + + + + + + + +
System is up to date
+ <% else %> + + <% @sonar_updates.to_a.reverse.each do |update| + release=update.getRelease() + %> + + + + + + + + + + + +

Sonar <%= release.getVersion() -%>

+ + + + + + + + + + + + + + + + +
Date: <%= release_date(release.getDate()) if release.getDate() -%>
<%= link_to_if release.getChangelogUrl(), 'Release Notes', release.getChangelogUrl(), :class => 'external' %>: <%= release.getDescription() -%>
How to upgrade: + <% if update.hasWarnings() %> + Please execute the following and restart Sonar only during the last step : +
    + <% update.getIncompatiblePlugins().each do |incompatible_plugin| %> +
  1. <%= image_tag 'warning.png' -%> The plugin <%= incompatible_plugin.getName() -%> is not compatible and must be uninstalled. +
    + +
    +
  2. + <% end %> + <% update.getPluginsToUpgrade().each do |plugin_to_upgrade| %> +
  3. Upgrade the plugin <%= plugin_to_upgrade.getArtifact().getName() -%>. +
    + +
    +
  4. + <% end %> +
  5. <%= link_to 'Download', release.getDownloadUrl(), :class => 'external' -%> and carefully read the upgrade guide.
  6. +
+ + <% else %> + <%= link_to 'Download', release.getDownloadUrl(), :class => 'external' -%> and carefully read the upgrade guide. + <% end %> +
+
+
+ <% end + end + end %> + + <%= render :partial => 'updatecenter/status', :locals => {:action => 'updates' } %> +
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 432ad359a5a..64d5e0eb0cf 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 @@ -7,23 +7,14 @@ function upgradePlugin(key) { } - + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'updates'} -%> +
<%= render :partial => 'updatecenter/operations' -%> <% if @center %> - +
@@ -72,56 +63,6 @@ function upgradePlugin(key) {

Plugins

-
- - - - - - - <% if @sonar_updates.empty? %> - - - - <% end %> - - - - <% @sonar_updates.each do |update| - css=cycle('even','odd', :name => 'system') - release=update.getRelease() - %> - - - - - - - <% if update.hasWarnings() %> - - - - - <% end %> - <% end %> - -

System

No updates
Sonar <%= release.getVersion() -%><%= release_date(release.getDate()) if release.getDate() -%><%= release.getDescription() -%> - <%= link_to 'Release Notes', release.getChangelogUrl(), :class => 'external' if release.getChangelogUrl() %>   - <%= link_to 'Download', release.getDownloadUrl(), :class => 'external' if release.getDownloadUrl() %> -
- <% if update.isIncompatible() %> - <%= image_tag 'warning.png' -%> Incompatible plugins must be uninstalled before upgrading system: - <%= update.getIncompatiblePlugins().map{|plugin| plugin.getName()}.sort.join(',') -%> - <% end %> - <% if update.requiresPluginUpgrades() %> - <%= image_tag 'warning.png' -%> Following plugins must be upgraded before upgrading system: -
    - <% update.getPluginsToUpgrade().each do |plugin| %> -
  • <%= plugin.getArtifact().getName() -%> to <%= plugin.getVersion() -%>
  • - <% end %> -
- <% end %> -
<% end %> <%= render :partial => 'updatecenter/status', :locals => {:action => 'updates' } %>