diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-02 12:58:53 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-02 12:58:53 +0000 |
commit | 881fab03f390598ed76fff0e660562d619b687d4 (patch) | |
tree | 51e7737955a084b67a83f3b0e0eb69f8c7af5d5b /sonar-server | |
parent | 6f58bd9590ea5645eb38a1b2c45c7a0e3ac76e96 (diff) | |
download | sonarqube-881fab03f390598ed76fff0e660562d619b687d4.tar.gz sonarqube-881fab03f390598ed76fff0e660562d619b687d4.zip |
SONAR-1893 display system updates in a new tab
Diffstat (limited to 'sonar-server')
6 files changed, 135 insertions, 92 deletions
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 @@ +<ul class="tabs"> + <li> + <a href="<%= url_for :action => 'index' -%>" class="<%= 'selected' if tab=='index' -%>">Installed Plugins</a> + </li> + <li> + <a href="<%= url_for :action => 'available' -%>" class="<%= 'selected' if tab=='available' -%>">Available Plugins</a> + </li> + <li> + <a href="<%= url_for :action => 'updates' -%>" class="<%= 'selected' if tab=='updates' -%>">Plugin Updates</a> + </li> + <li> + <a href="<%= url_for :action => 'system_updates' -%>" class="<%= 'selected' if tab=='system_updates' -%>">System Updates</a> + </li> +</ul> 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; } </script> - -<ul class="tabs"> - <li> - <a href="<%= url_for :action => 'index' -%>">Installed</a> - </li> - <li> - <a href="<%= url_for :action => 'updates' -%>">Updates</a> - </li> - <li> - <a href="<%= url_for :action => 'available' -%>" class="selected">Available</a> - </li> -</ul> + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'available'} -%> <div class="tabs-panel"> <%= 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 @@ - <ul class="tabs"> - <li> - <a href="<%= url_for :action => 'index' -%>" class="selected">Installed</a> - </li> - <li> - <a href="<%= url_for :action => 'updates' -%>">Updates</a> - </li> - <li> - <a href="<%= url_for :action => 'available' -%>">Available</a> - </li> - </ul> + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'index'} -%> + <div class="tabs-panel"> <%= render :partial => 'updatecenter/operations' -%> @@ -69,6 +60,9 @@ <div class="break30"> </div> <table class="data width100" id="system-plugins"> + <thead> + <tr><th colspan="3"><h2>System plugins</h2></th></tr> + </thead> <tbody> <% @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 @@ + <style> + ol.bulletpoints li { + list-style-type: decimal; + list-style-position: inside; + } + </style> + + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'system_updates'} -%> + + <div class="tabs-panel"> + + <%= render :partial => 'updatecenter/operations' -%> + + <% if @center %> + <% if @sonar_updates.empty? %> + <table class="data width100"> + <thead> + <tr> + <td> </td> + </tr> + </thead> + <tbody> + <tr> + <td>System is up to date</td> + </tr> + </tbody> + </table> + <% else %> + + <% @sonar_updates.to_a.reverse.each do |update| + release=update.getRelease() + %> + <table class="data width100" id="sonar-<%= release.getVersion() -%>"> + <thead> + <tr> + <th><h2>Sonar <%= release.getVersion() -%></h2></th> + </tr> + </thead> + <tbody> + <tr class="even"> + <td> + <table class="width100 spaced"> + <tr> + <td class="thin nowrap"><b>Date: </b></td> + <td class="sep"> </td> + <td><%= release_date(release.getDate()) if release.getDate() -%></td> + </tr> + <tr> + <td class="thin nowrap"><b><%= link_to_if release.getChangelogUrl(), 'Release Notes', release.getChangelogUrl(), :class => 'external' %>: </b></td> + <td class="sep"> </td> + <td><%= release.getDescription() -%></td> + </tr> + <tr> + <td class="thin nowrap" valign="top"><b>How to upgrade: </b></td> + <td class="sep"> </td> + <td> + <% if update.hasWarnings() %> + Please execute the following and restart Sonar only during the last step : + <ol class="bulletpoints"> + <% update.getIncompatiblePlugins().each do |incompatible_plugin| %> + <li><%= image_tag 'warning.png' -%> The plugin <%= incompatible_plugin.getName() -%> is not compatible and must be uninstalled. + <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/uninstall?key=<%= incompatible_plugin.getKey() -%>&from=system_updates" style="display: inline-block"> + <input type="submit" value="Uninstall" onClick="disable();return true;"></input> + </form> + </li> + <% end %> + <% update.getPluginsToUpgrade().each do |plugin_to_upgrade| %> + <li>Upgrade the plugin <%= plugin_to_upgrade.getArtifact().getName() -%>. + <form method="post" id="upgrade-form-<%= plugin_to_upgrade.getArtifact().getKey() -%>" action="<%= ApplicationController.root_context -%>/updatecenter/install?key=<%= plugin_to_upgrade.getArtifact().getKey() -%>&version=<%= plugin_to_upgrade.getVersion() -%>&from=system_updates" style="display: inline-block"> + <input type="submit" id="upgrade-submit-<%= plugin_to_upgrade.getArtifact().getKey() -%>" value="Upgrade to <%= plugin_to_upgrade.getVersion() -%>" onClick="this.disable();return true;"></input> + </form> + </li> + <% end %> + <li><%= link_to 'Download', release.getDownloadUrl(), :class => 'external' -%> and carefully read the upgrade guide.</li> + </ol> + + <% else %> + <%= link_to 'Download', release.getDownloadUrl(), :class => 'external' -%> and carefully read the upgrade guide. + <% end %> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> + <div class="break30"> </div> + <% end + end + end %> + + <%= render :partial => 'updatecenter/status', :locals => {:action => 'updates' } %> + </div> 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) { } </script> -<ul class="tabs"> - <li> - <a href="<%= url_for :action => 'index' -%>">Installed</a> - </li> - <li> - <a href="<%= url_for :action => 'updates' -%>" class="selected">Updates</a> - </li> - <li> - <a href="<%= url_for :action => 'available' -%>">Available</a> - </li> - </ul> + <%= render :partial => 'updatecenter/tabs', :locals => {:tab => 'updates'} -%> + <div class="tabs-panel"> <%= render :partial => 'updatecenter/operations' -%> <% if @center %> - <table class="data width100" id="plugin-updates"> + <table class="data width100 marginbottom10" id="plugin-updates"> <thead> <tr><th colspan="2"><h2>Plugins</h2></th></tr> </thead> @@ -72,56 +63,6 @@ function upgradePlugin(key) { </tbody> </table> - <div class="break30"> </div> - - <table class="data width100 marginbottom10" id="system-updates"> - <thead> - <tr><th colspan="4"><h2>System</h2></th></tr> - </thead> - <tbody> - <% if @sonar_updates.empty? %> - <tr class="even"> - <td colspan="4" >No updates</td> - </tr> - <% end %> - - - - <% @sonar_updates.each do |update| - css=cycle('even','odd', :name => 'system') - release=update.getRelease() - %> - <tr class="<%= css -%>"> - <td width="1%" nowrap><b>Sonar <%= release.getVersion() -%></b></td> - <td width="1%" nowrap><%= release_date(release.getDate()) if release.getDate() -%></td> - <td><%= release.getDescription() -%></td> - <td> - <%= link_to 'Release Notes', release.getChangelogUrl(), :class => 'external' if release.getChangelogUrl() %> - <%= link_to 'Download', release.getDownloadUrl(), :class => 'external' if release.getDownloadUrl() %> - </td> - </tr> - <% if update.hasWarnings() %> - <tr class="<%= css -%>"> - <td> </td> - <td colspan="3"> - <% 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: - <ul> - <% update.getPluginsToUpgrade().each do |plugin| %> - <li><%= plugin.getArtifact().getName() -%> to <%= plugin.getVersion() -%></li> - <% end %> - </ul> - <% end %> - </td> - </tr> - <% end %> - <% end %> - </tbody> - </table> <% end %> <%= render :partial => 'updatecenter/status', :locals => {:action => 'updates' } %> </div> |