]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1893 display system updates in a new tab
authorsimonbrandhof <simon.brandhof@gmail.com>
Tue, 2 Nov 2010 12:58:53 +0000 (12:58 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Tue, 2 Nov 2010 12:58:53 +0000 (12:58 +0000)
sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_tabs.html.erb [new file with mode: 0644]
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/system_updates.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/updates.html.erb

index efec31b834d2e0133bca9a77c31099dd867b99c9..674263c87b7834cc5377759010f4bea2f3c54d7f 100644 (file)
@@ -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 (file)
index 0000000..11c148d
--- /dev/null
@@ -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>
index 5e2e82e9e2ce266502bef81dd5be91564191b054..4578dc6a0db6b5b8c14ebf0b6039e599ca7291ec 100644 (file)
@@ -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' -%>
index 7d864bd00129ea5f61332c490d98ebd224fc5916..b617f0e2f5fd8b5bfc27b6d2178435f6f32ecacb 100644 (file)
@@ -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 (file)
index 0000000..aaf3e5a
--- /dev/null
@@ -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() -%>&amp;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() -%>&amp;version=<%= plugin_to_upgrade.getVersion() -%>&amp;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>
index 432ad359a5aa33049dd34de0c32b5af9041038a5..64d5e0eb0cf7eb410cd8eb643c79f816bc226174 100644 (file)
@@ -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() %> &nbsp;
-            <%= 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>