From a99a85f7a75b283ec2873c0f786786386a63861e Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Wed, 10 Nov 2010 15:31:14 +0000 Subject: [PATCH] SONAR-1950 Clicking on a shared inactive dashboard throw an error --- .../app/views/dashboards/_dashboard.html.erb | 186 ------------------ .../app/views/dashboards/_editform.html.erb | 47 ----- .../app/views/dashboards/_layouts.html.erb | 25 --- .../views/dashboards/_snapshot_title.html.erb | 12 -- .../app/views/dashboards/_tabs.html.erb | 21 -- .../app/views/dashboards/_widget.html.erb | 100 ---------- .../app/views/dashboards/_widget_update.rjs | 6 - .../app/views/dashboards/index.html.erb | 2 +- .../app/views/dashboards/manage.html.erb | 86 -------- .../WEB-INF/app/views/dashboards/new.html.erb | 6 - 10 files changed, 1 insertion(+), 490 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_editform.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_layouts.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_snapshot_title.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_tabs.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget_update.rjs delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/manage.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/new.html.erb diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard.html.erb deleted file mode 100644 index 8835f7c85ff..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard.html.erb +++ /dev/null @@ -1,186 +0,0 @@ -<% if @dashboard && ((@dashboard.widgets.size > 0 && @dashboard.column_layout.split("-").size() > 0)||dashboard_edit) %> - - -
- <% if dashboard_edit %> - - - - <%= render :partial => 'dashboards/editform' %> - - <%= render :partial => 'dashboards/layouts' %> - - - - <% end %> - - <% columns=Array.new - if @dashboard && @dashboard.column_layout - columns=@dashboard.column_layout.split("-") - end - for index in 1..columns.size() %> -
-
0px <%= index>1 ? "5px" : "0px" %>;"> - <% if dashboard_edit %> -
-
{:column_index => index}).size()>0 %>>Drop widgets here
- <% end %> - - <% @dashboard.widgets.find(:all, :conditions => {:column_index => index}, :order => :order_index).each do |widget| - widget_view=@widgets.find { |w| w.getId()== widget.widget_key } - if widget_view %> -
- - <%= render :partial => 'dashboards/widget', - :locals => {:dashboard_edit => dashboard_edit, - :widget => widget, - :widget_view => widget_view, - :edit_mode => false} %> - -
- <% end %> - <% end %> - -
-
- <% end %> -
-
-<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_editform.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_editform.html.erb deleted file mode 100644 index f330d0f5bc7..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_editform.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -
> -
- - - - - - - - <% if is_admin? %> - - - - - - - <% end %> - - - - - - - - - - - -
Name: - -
Shared: - /> -
Description: - -
- - - <% if @dashboard.id %> - <%= link_to "Delete", {:action => 'delete', :id => @project.id, :dashboard => @dashboard.id}, :method => :post, :confirm => 'Do you want to delete this dashboard ?' %> - - Cancel - <% else %> - Cancel - <% end %> -
-
-
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_layouts.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_layouts.html.erb deleted file mode 100644 index 9fdacdb52cd..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_layouts.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_snapshot_title.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_snapshot_title.html.erb deleted file mode 100644 index c5a57fb1533..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_snapshot_title.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<% if @snapshot %> -
-

-<% - version_event=@snapshot.event(EventCategory::KEY_VERSION) - profile_measure=@snapshot.measure(Metric::PROFILE) - %> -<%= link_to_favourite(@project) -%> <%= "#{version_event.fullname} - " if version_event %> <%= l @snapshot.created_at %> -<% if profile_measure %> - profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %><% end %> -

-
-<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_tabs.html.erb deleted file mode 100644 index 1e594e2730d..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_tabs.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<% if logged_in? %> -
- -
-<% end %> - -<% if @actives && !@actives.empty? %> - -<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget.html.erb deleted file mode 100644 index 17d5e6f135e..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget.html.erb +++ /dev/null @@ -1,100 +0,0 @@ -<% - properties_available=widget_view.getWidgetProperties() && widget_view.getWidgetProperties().size() != 0 - - if !properties_available || (widget && widget.state==Widget::STATE_ACTIVE) - begin - widget_properties=Hash.new - if widget - widget.widget_properties.each do |property| - widget_properties[property.key]=property.value - end - end - widget_body=render :inline => widget_view.getTarget().getTemplate(), :locals => {:widget_properties => widget_properties} - rescue => error - logger.error("Can not render widget #{widget_view.getId()}: " + error) - logger.error(error.backtrace.join("\n")) - widget_body="" - end - end -%> - -<% if dashboard_edit || (widget.state==Widget::STATE_ACTIVE && widget_body.include?('<')) %> - -
"> - <%= (widget) ? widget.name : widget_view.getTitle() -%> - <% if dashboard_edit %> - [x] - <% if properties_available && widget && widget.state==Widget::STATE_ACTIVE %> - [<%= edit_mode ? "view" : "edit" %>]   - <% end %> - <% end %> -
- <% if defined?(validation_result) %> -
clear:both;margin: 0;border-bottom:0;"> - <%= validation_result["errormsg"] if validation_result["errormsg"] %>   [hide] -
-
clear:both;margin: 0;border-bottom:0;"> - <%= validation_result["infomsg"] if validation_result["infomsg"] %>   [hide] -
- <% end %> - -
-
<%= widget_view.getDescription() -%>
- -
<%= button_to_function "Add", "portal.addNewWidget($(this).up('.block'),$$('.column-handle')[0]);", :style => "width:40px;"%>
-
- - <% if properties_available && dashboard_edit %> -
"> - <% form_remote_tag :url => {:action => 'savewidget', :id => @project.id, :dashboard => @dashboard.id}, - :method => "post", - :before => "$(this).down('.widgetid').value=$(this).up('.block').identify().split('_').pop();hide_block_info($(this).up('.block'))" do -%> - - - <% widget_view.getWidgetProperties().each do |property| - db_property_value=widget.widget_property_value(property.key()) if widget - entered_value=params[property.key()] - entered_value=property.defaultValue() if !entered_value || entered_value.empty? - entered_value=nil unless edit_mode - editrow_class="" - if defined?(validation_result) - editrow_class= validation_result[property.key()]=="valid" ? "valid-editrow" : "invalid-editrow" - end - %> - - - - - <% end %> - -
<%= property.name() -%>:
- [<%= property.type()+" "+property.key() -%>]
<%= property_value_field(property.type(), property.key(), db_property_value, entered_value) %><%= " *" unless property.optional() %> -
- [<%= property.description() -%>]
- <%= hidden_field_tag "widgetid", "", :class => "widgetid" %> -
<%= submit_tag 'Save' %>
- <% end -%> -
- <% end %> - - <% if (dashboard_edit && (!properties_available || (widget && widget.state==Widget::STATE_ACTIVE))) || (widget_body && widget_body.include?('<')) %> -
"> - <% if dashboard_edit %> - -
- <% end %> - <% if widget_body.include? '<' %> - <%= widget_body %> - <% else %> -

Can not render widget <%= widget_view.getTitle() %>. - <% end %> -

-
- <% end %> -<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget_update.rjs b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget_update.rjs deleted file mode 100644 index 39b20ce7278..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_widget_update.rjs +++ /dev/null @@ -1,6 +0,0 @@ -page.replace_html 'block_'+widget.id.to_s(), :partial => 'dashboards/widget', - :locals => {:dashboard_edit => true, - :widget => widget, - :widget_view => widget_view, - :edit_mode => result["saved"]!="true", - :validation_result => result} 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 489fef62fde..d6a1a26b7af 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 @@ -76,7 +76,7 @@ @shared_dashboards.each do |dashboard| %> - <%= link_to dashboard.name, {:controller => :dashboard, :action => :index, :id => dashboard.id, :resource => params[:resource]} -%> + <%= link_to dashboard.name, {:controller => :dashboard, :action => :index, :id => params[:resource], :did => dashboard.id} -%> <% if dashboard.description.present? %>

<%= h dashboard.description -%>

<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/manage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/manage.html.erb deleted file mode 100644 index 2dfc964f2b3..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/manage.html.erb +++ /dev/null @@ -1,86 +0,0 @@ -<%= render :partial => 'dashboards/tabs', :locals => {:selected_tab => nil} %> - -

My dashboards

-

These dashboards are active and visible.

-
- - - - - - - - - - - <% if @actives.nil? || @actives.empty? %> - - - <% - else - @actives.each_with_index do |active,index| %> - - - - - - - <% end - end - %> - -
NameDefaultOrderOperations
No dashboards
<%= active.name %> - <%= boolean_icon(active.dashboard.shared, {:display_false => false}) -%> - - <% if index>0 %> - <%= link_to image_tag('blue-up.png'), {:action => 'up', :id => @project.id, :dashboard => active.dashboard.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 => @project.id, :dashboard => active.dashboard.id}, :method => :post, :id => "down-#{u active.name}" %> - <% end %> - - <% if !active.shared? || is_admin? %> - <%= link_to 'Edit', {:action => 'edit', :id => @project.id, :dashboard => active.dashboard_id}, :method => :post, :id => "edit-#{u active.name}" %> | - <%= link_to 'Delete', {:action => 'delete', :id => @project.id, :dashboard => active.dashboard_id, :manage => true}, :method => :post, :confirm => 'Do you want to delete this dashboard ?', :id => "delete-#{u active.name}" %> - <% else %> - <%= link_to 'Edit', {:action => 'edit', :id => @project.id, :dashboard => active.dashboard_id}, :method => :post, :id => "edit-#{u active.name}" %> | - <%= link_to 'Hide', {:action => 'hide', :id => @project.id, :dashboard => active.dashboard_id}, :method => :post, :id => "hide-#{u active.name}" %> - <% end %> -
- -


-

Disabled dashboards

-

These dashboards are hided.

-
- - - - - - - - - - <% if @disabled_dashboards.nil? || @disabled_dashboards.empty? %> - - - <% - else - @disabled_dashboards.each_with_index do |disabled,index| - %> - - - - - - <% end - end - %> - -
NameDefaultOperations
No dashboards
<%= disabled.name %> - <%= boolean_icon(disabled.dashboard.shared, {:display_false => false}) -%> - - <%= link_to 'Show', {:action => 'show', :id => @project.id, :dashboard => disabled.dashboard_id}, :method => :post, :id => "show-#{u disabled.name}" %> -
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/new.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/new.html.erb deleted file mode 100644 index 4158e623378..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/new.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<%= render :partial => 'dashboards/tabs', :locals => {:selected_tab => (@dashboard ? @dashboard.id : 'new') } %> -<% if @dashboard.id %> - <%= render :partial => 'dashboards/dashboard', :locals => {:dashboard_edit => true } %> -<% else %> - <%= render :partial => 'dashboards/editform' %> -<% end %> \ No newline at end of file -- 2.39.5