aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-05-09 18:50:57 +0200
committerDavid Gageot <david@gageot.net>2012-05-09 18:50:57 +0200
commita1e65c46f1c224b8962c1bc3371609f1b2774733 (patch)
treea4b892ae40aeb4903ba56798448cafb0758d5f7a /sonar-server
parent1ab1873054b606a2d2d972bde49e91e77a1c220b (diff)
downloadsonarqube-a1e65c46f1c224b8962c1bc3371609f1b2774733.tar.gz
sonarqube-a1e65c46f1c224b8962c1bc3371609f1b2774733.zip
SONAR-1927 Split Global and project dashboards
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb40
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb55
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_list.html.erb63
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb71
4 files changed, 117 insertions, 112 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb
new file mode 100644
index 00000000000..cd5ab83550c
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb
@@ -0,0 +1,40 @@
+<table class="data">
+ <thead>
+ <tr>
+ <th><%= message('name') -%></th>
+ <th><%= message('shared_by') -%></th>
+ <th colspan="2" class="right"><%= message('operations') -%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% if active_dashboards.empty? %>
+ <tr class="even">
+ <td colspan="5">No results.</td>
+ </tr>
+ <% else %>
+ <% active_dashboards.each_with_index do |active, index| %>
+ <tr id="active-<%= u active.name -%>" class="<%= cycle('even', 'odd', :name => group) -%>">
+ <td>
+ <%= h(active.name(true)) %>
+ <br>
+ <span style="font-size: 85%;font-weight: normal;"><%= active.dashboard.description %></span>
+ </td>
+ <td><%= h(active.dashboard.user.name) if active.dashboard.user %></td>
+ <td>
+ <% if index>0 %>
+ <%= link_to image_tag('blue-up.png'), {:action => :up, :id => active.id}, :method => :post, :id => "up-#{u active.name}" %>
+ <% else %>
+ <%= image_tag('transparent_16.gif') %>
+ <% end %>
+ <% if index<active_dashboards.size-1 %>
+ <%= link_to image_tag('blue-down.png'), {:action => :down, :id => active.id}, :method => :post, :id => "down-#{u active.name}" %>
+ <% end %>
+ </td>
+ <td class="thin nowrap right">
+ <%= link_to 'Remove from defaults', {:action => 'remove', :id => active.id}, {:confirm => 'Are you sure to remove it from default dashboards ?', :method => :post, :id => "remove-#{u active.name}", :class => 'link-action'} %>
+ </td>
+ </tr>
+ <% end %>
+ <% end %>
+ </tbody>
+</table>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb
index ef900b49c1e..6a2b0bddeeb 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb
@@ -1,52 +1,17 @@
-<h1>Default dashboards</h1>
+<h1>Default global dashboards</h1>
<p class="marginbottom10">These dashboards are displayed to anonymous users or users who have not customized their dashboards.</p>
-<table class="data" id="admin_console">
- <thead>
- <tr>
- <th><%= message('name') -%></th>
- <th><%= message('global') -%></th>
- <th><%= message('shared_by') -%></th>
- <th colspan="2" class="right"><%= message('operations') -%></th>
- </tr>
- </thead>
- <tbody>
- <% if @actives.empty? %>
- <tr class="even">
- <td colspan="5">No results.</td>
- </tr>
- <% else %>
- <% @actives.each_with_index do |active, index| %>
- <tr id="active-<%= u active.name -%>" class="<%= cycle('even', 'odd', :name => 'actives') -%>">
- <td>
- <%= h(active.name(true)) %>
- <br>
- <span style="font-size: 85%;font-weight: normal;"><%= active.dashboard.description %></span>
- </td>
- <td>
- <%= boolean_icon(active.dashboard.global) -%>
- </td>
- <td><%= h(active.dashboard.user.name) if active.dashboard.user %></td>
- <td>
- <% if index>0 %>
- <%= link_to image_tag('blue-up.png'), {:action => :up, :id => active.id}, :method => :post, :id => "up-#{u active.name}" %>
- <% else %>
- <%= image_tag('transparent_16.gif') %>
- <% end %>
- <% if index<@actives.size-1 %>
- <%= link_to image_tag('blue-down.png'), {:action => :down, :id => active.id}, :method => :post, :id => "down-#{u active.name}" %>
- <% end %>
- </td>
- <td class="thin nowrap right">
- <%= link_to 'Remove from defaults', {:action => 'remove', :id => active.id}, {:confirm => 'Are you sure to remove it from default dashboards ?', :method => :post, :id => "remove-#{u active.name}", :class => 'link-action'} %>
- </td>
- </tr>
- <% end %>
- <% end %>
- </tbody>
-</table>
+<%= render :partial => 'list', :locals => { :active_dashboards => @actives.select { |a| a.dashboard.global }, :group => 'activeGlobal' } %>
<br/><br/>
+
+<h1>Default project dashboards</h1>
+<p class="marginbottom10">These dashboards are displayed to anonymous users or users who have not customized their dashboards.</p>
+
+<%= render :partial => 'list', :locals => { :active_dashboards => @actives.reject { |a| a.dashboard.global }, :group => 'activeProject' } %>
+
+<br/><br/>
+
<h1>Shared dashboards</h1>
<p class="marginbottom10">These dashboards can be added to default dashboards.</p>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_list.html.erb
new file mode 100644
index 00000000000..fb872eb4d50
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_list.html.erb
@@ -0,0 +1,63 @@
+<h1 class="marginbottom10"><%= message(labelKey) -%></h1>
+<table class="data marginbottom10" id="dashboards">
+ <thead>
+ <tr>
+ <th><%= message('name') -%></th>
+ <% if is_admin %>
+ <th><%= message('shared') -%></th>
+ <% end %>
+ <th><%= message('order') -%></th>
+ <th class="right"><%= message('operations') -%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% if active_dashboards.nil? || active_dashboards.empty? %>
+ <tr class="even">
+ <td colspan="5"><%= message('dashboard.no_dashboard') -%></td>
+ </tr>
+ <%
+ else
+ active_dashboards.each_with_index do |active, index| %>
+ <tr id="dashboard-<%= u active.name -%>" class="<%= cycle('even', 'odd', :name => group) -%>">
+ <td>
+ <%= link_to active.name(true), {:controller => :dashboard, :action => :index, :did => active.dashboard_id, :id => (params[:resource] unless active.dashboard.global) } -%>
+ <% if active.dashboard.description.present? %>
+ <p class="small"><%= h active.dashboard.description -%></p>
+ <% end %>
+ </td>
+ <% if is_admin %>
+ <td>
+ <%= boolean_icon(active.dashboard.shared) -%>
+ </td>
+ <% end %>
+ <td>
+ <% if index>0 %>
+ <%= link_to image_tag('blue-up.png'), {:action => 'up', :id => active.dashboard_id, :resource => params[:resource]}, :method => :post, :id => "up-#{u active.name}" %>
+ <% else %>
+ <%= image_tag('transparent_16.gif') %>
+ <% end %>
+ <% if index<active_dashboards.size-1 %>
+ <%= link_to image_tag('blue-down.png'), {:action => 'down', :id => active.dashboard.id, :resource => params[:resource]}, :method => :post, :id => "down-#{u active.name}" %>
+ <% end %>
+ </td>
+ <td class="thin nowrap right">
+ <% if active.owner?(current_user) %>
+ <%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => 'configure', :did => active.dashboard_id, :id => (params[:resource] unless active.dashboard.global)},
+ :id => "configure-#{u active.name}", :class => 'link-action' %>
+ |
+ <%= link_to_remote message('edit'), {:update => "admin_form", :url => {:action => "edit", :id => active.dashboard_id, :resource => params[:resource]}},
+ {:id => "edit-#{u active.name}", :method => :get, :class => 'link-action'} %>
+ |
+ <%= link_to message('delete'), {:action => 'delete', :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
+ :confirm => message('dashboard.do_you_want_to_delete_dashboard'), :id => "delete-#{u active.name}", :class => 'link-action' %>
+ <% else %>
+ <%= link_to message('unfollow'), {:action => 'unfollow', :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
+ :id => "unfollow-#{u active.name}", :class => 'link-action' %>
+ <% end %>
+ </td>
+ </tr>
+ <% end
+ end
+ %>
+ </tbody>
+</table>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb
index 1398baf8de2..aee17d43285 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb
@@ -3,73 +3,10 @@
<tr>
<td valign="top">
- <h1 class="marginbottom10"><%= message('dashboard.my_dashboards') -%></h1>
- <table class="data marginbottom10" id="dashboards">
- <thead>
- <tr>
- <th><%= message('name') -%></th>
- <th><%= message('global') -%></th>
- <% if is_admin %>
- <th><%= message('shared') -%></th>
- <% end %>
- <th><%= message('order') -%></th>
- <th class="right"><%= message('operations') -%></th>
- </tr>
- </thead>
- <tbody>
- <% if @actives.nil? || @actives.empty? %>
- <tr class="even">
- <td colspan="5"><%= message('dashboard.no_dashboard') -%></td>
- </tr>
- <%
- else
- @actives.each_with_index do |active, index| %>
- <tr id="dashboard-<%= u active.name -%>" class="<%= cycle('even', 'odd', :name => 'dashboards') -%>">
- <td>
- <%= link_to active.name(true), {:controller => :dashboard, :action => :index, :did => active.dashboard_id, :id => (params[:resource] unless active.dashboard.global) } -%>
- <% if active.dashboard.description.present? %>
- <p class="small"><%= h active.dashboard.description -%></p>
- <% end %>
- </td>
- <td>
- <%= boolean_icon(active.dashboard.global) -%>
- </td>
- <% if is_admin %>
- <td>
- <%= boolean_icon(active.dashboard.shared) -%>
- </td>
- <% end %>
- <td>
- <% if index>0 %>
- <%= link_to image_tag('blue-up.png'), {:action => 'up', :id => active.dashboard_id, :resource => params[:resource]}, :method => :post, :id => "up-#{u active.name}" %>
- <% else %>
- <%= image_tag('transparent_16.gif') %>
- <% end %>
- <% if index<@actives.size-1 %>
- <%= link_to image_tag('blue-down.png'), {:action => 'down', :id => active.dashboard.id, :resource => params[:resource]}, :method => :post, :id => "down-#{u active.name}" %>
- <% end %>
- </td>
- <td class="thin nowrap right">
- <% if active.owner?(current_user) %>
- <%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => 'configure', :did => active.dashboard_id, :id => (params[:resource] unless active.dashboard.global)},
- :id => "configure-#{u active.name}", :class => 'link-action' %>
- |
- <%= link_to_remote message('edit'), {:update => "admin_form", :url => {:action => "edit", :id => active.dashboard_id, :resource => params[:resource]}},
- {:id => "edit-#{u active.name}", :method => :get, :class => 'link-action'} %>
- |
- <%= link_to message('delete'), {:action => 'delete', :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
- :confirm => message('dashboard.do_you_want_to_delete_dashboard'), :id => "delete-#{u active.name}", :class => 'link-action' %>
- <% else %>
- <%= link_to message('unfollow'), {:action => 'unfollow', :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
- :id => "unfollow-#{u active.name}", :class => 'link-action' %>
- <% end %>
- </td>
- </tr>
- <% end
- end
- %>
- </tbody>
- </table>
+ <%= render :partial => 'list', :locals => { :active_dashboards => @actives.select { |a| a.dashboard.global }, :group => 'dashboardsGlobal', :labelKey => 'dashboard.my_project_dashboards', :is_admin => is_admin } %>
+ <br/><br/>
+
+ <%= render :partial => 'list', :locals => { :active_dashboards => @actives.reject { |a| a.dashboard.global }, :group => 'dashboardsProject', :labelKey => 'dashboard.my_global_dashboards', :is_admin => is_admin } %>
<br/><br/>
<h1 class="marginbottom10"><%= message('dashboard.shared_dashboards') -%></h1>