From 088d62c2b7900dc594c090c3e5659df77dfe7fbb Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 9 Sep 2010 09:43:56 +0000 Subject: [PATCH] add a tab "permalinks" to profiles console --- .../app/controllers/profiles_controller.rb | 16 +- .../rules_configuration_controller.rb | 5 +- .../app/views/layouts/_layout.html.erb | 2 +- .../WEB-INF/app/views/profiles/_tabs.html.erb | 3 + .../WEB-INF/app/views/profiles/index.html.erb | 148 ++++++++---------- .../app/views/profiles/permalinks.html.erb | 23 +++ .../views/rules_configuration/index.html.erb | 2 +- sonar-server/src/main/webapp/images/add.png | Bin 0 -> 434 bytes .../src/main/webapp/images/restore.gif | Bin 0 -> 349 bytes .../src/main/webapp/stylesheets/style.css | 19 ++- 10 files changed, 127 insertions(+), 91 deletions(-) create mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb create mode 100644 sonar-server/src/main/webapp/images/add.png create mode 100644 sonar-server/src/main/webapp/images/restore.gif diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index a097835caae..64cf71cec06 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -189,6 +189,16 @@ class ProfilesController < ApplicationController end + # + # + # GET /profiles/permalinks?id= + # + # + def permalinks + @profile = Profile.find(params[:id]) + end + + # # # GET /profiles/projects/ @@ -260,13 +270,13 @@ class ProfilesController < ApplicationController def flash_validation_messages(messages) # only 4 messages are kept each time to avoid cookie overflow. if messages.hasErrors() - flash[:error]=messages.getErrors()[0...4].map{|m| m.getLabel()}.join('
') + flash[:error]=messages.getErrors().to_a[0...4].map{|m| m.getLabel()}.join('
') end if messages.hasWarnings() - flash[:warning]=messages.getWarnings()[0...4].map{|m| m.getLabel()}.join('
') + flash[:warning]=messages.getWarnings().to_a[0...4].map{|m| m.getLabel()}.join('
') end if messages.hasInfos() - flash[:notice]=messages.getInfos()[0...4].map{|m| m.getLabel()}.join('
') + flash[:notice]=messages.getInfos().to_a[0...4].map{|m| m.getLabel()}.join('
') end end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb index 2d546a25d2a..62c9c43fbea 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb @@ -228,7 +228,7 @@ class RulesConfigurationController < ApplicationController # # def bulk_edit - profile = RulesProfile.find(params[:id].to_i) + profile = Profile.find(params[:id].to_i) rule_ids = params[:bulk_rule_ids].split(',').map{|id| id.to_i} status=params[:rule_status] @@ -283,9 +283,8 @@ class RulesConfigurationController < ApplicationController rules_to_activate=Rule.find(:all, :conditions => {:enabled=>true, :id => rule_ids_to_activate}) count = rules_to_activate.size rules_to_activate.each do |rule| - profile.active_rules.build(:rule => rule, :failure_level => rule.priority) + profile.active_rules.create(:rule => rule, :failure_level => rule.priority) end - profile.save! end count end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index 26fd607c24d..e223aab7811 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -88,8 +88,8 @@
<% if @project %>

<%= @project.name(true) %>

<% end %> - + <%= yield %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb index 6eda63ef204..abb5e584826 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb @@ -12,6 +12,9 @@
  • >Projects
  • +
  • + >Permalinks +
  • <% if new_tab %>
  • <%= new_tab -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 4ff3533e482..c259dac4a46 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -1,53 +1,95 @@ <% languages.sort{|x,y| x.getName() <=> y.getName()}.each do |language| - exporters=controller.java_facade.getProfileExportersForLanguage(language.getKey()) importers=controller.java_facade.getProfileImportersForLanguage(language.getKey()) %> +
    + +

    <%= language.getName() %> profiles

    +
    + +<% if administrator? %> + + +<% end %> - - - - - + + + + - <% if administrator? %> - - - - - - <% end %> <% @profiles.select{|p| p.language==language.getKey()}.each do |profile| %> - + - - +

    <%= language.getName() %>

    ExportDefaultNameRulesAlerts ProjectsDefault Operations
    - Create <%= language.getName() -%> profile - | - Restore <%= language.getName() -%> profile -
    <%= h profile.name %> - - <%= profile.active_rules.count -%> rules - + <%= profile.active_rules.count -%> <%= link_to pluralize(profile.alerts.size, 'alert'), url_for(:controller => 'alerts', :action => 'index', :id => profile.id), :id => "alerts_#{u profile.key}" %><%= profile.alerts.size -%> - <% exporters.each do |exporter| %> - <%= link_to exporter.getName(), - {:action => 'export', :language => profile.language, :name => url_encode(profile.name), :format => exporter.getKey()}, :id => "export_" + exporter.getKey().to_s + "_" + u(profile.key) %> + <% unless profile.default_profile? %> + <%= profile.projects.size -%> <% end %> <% if (!profile.default_profile? && administrator?) %> <%= button_to 'Set as default', { :action => 'set_as_default', :id => profile.id }, :class => 'action', @@ -61,13 +103,7 @@ - <% unless profile.default_profile? %> - <%= link_to pluralize(profile.projects.size, 'project'), - {:action => 'projects', :id => profile.id}, - {:id => "projects_#{u profile.key}", :class => 'tipable', :rel => projects_tooltip(profile) } %> - <% end %> - <% if (!profile.provided? && administrator?) %> @@ -107,52 +143,4 @@ <% end %>
    - - <% if administrator? %> - - - <% end %> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb new file mode 100644 index 00000000000..5f4fc6d131c --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb @@ -0,0 +1,23 @@ +

    <%= link_to 'Quality profiles', :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %>

    +<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Permalinks'} %> + + +
    +<% exporters=controller.java_facade.getProfileExportersForLanguage(@profile.language) %> + + + <% exporters.each do |exporter| %> + + + + + <% end %> + +
    + <%= h exporter.getName() -%> + + <% permalink=url_for :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %> + <%= link_to permalink, :url => permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %> +
    \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb index fea009d1b28..dcf9a5fce77 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb @@ -102,7 +102,7 @@ Active/Priority - Name [<%= link_to_function("expand/collapse", "toggle_rules()") %>] + Name [<%= link_to_function("expand/collapse", "toggle_rules()") %>] Plugin Category diff --git a/sonar-server/src/main/webapp/images/add.png b/sonar-server/src/main/webapp/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..7428c48992cb41fb698cfb921f512cb443e627f7 GIT binary patch literal 434 zcmV;j0ZsmiP)ySl)ABJ(2zuWm;76DaNodLUXjW*YfvZ5%=vMkDoGJtyPx@Na`_vD~mT5=s6 zN%!{p#0fGpP#>e z|M>aq{-Y<~fByRRCMpvs^F zG8N<}2DYjLlL|a^dfkpbDR6Pr>kr6iyAYHm)v?J-`e|-kwrubU4D{OX<;Y+S06a03O8@`> literal 0 HcmV?d00001 diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index a0b0f8d3bb9..c2cd5f4d611 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -1423,6 +1423,9 @@ ul.horizontal li { table.data2 { border-collapse: collapse; } +table.without-header { + border-top: 1px solid #ddd; +} table.data2 tbody tr { border-left: 1px solid #ddd; border-right: 1px solid #ddd; @@ -1441,7 +1444,7 @@ table.data2 td { vertical-align: middle; } table.data2 th { - font-weight: normal; + font-weight: bold; } table.data2 tfoot td { border-bottom: 0; @@ -1458,10 +1461,20 @@ table.data2 td, table.data2 td a, table.data2 th, table.data2 th a { .bulk-edit { display: block; background: url("../images/bulk-edit.png") no-repeat scroll left 50% transparent; - padding: 2px 0 2px 18px; + padding: 2px 0 2px 20px; } .csv { display: block; background: url("../images/csv.png") no-repeat scroll left 50% transparent; - padding: 2px 0 2px 18px; + padding: 2px 0 2px 20px; } +.add { + display: block; + background: url("../images/add.png") no-repeat scroll left 50% transparent; + padding: 2px 0 2px 20px; +} +.restore { + display: block; + background: url("../images/restore.gif") no-repeat scroll left 50% transparent; + padding: 2px 0 2px 20px; +} \ No newline at end of file -- 2.39.5