aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-09 09:43:56 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-09 09:43:56 +0000
commit088d62c2b7900dc594c090c3e5659df77dfe7fbb (patch)
tree9166d1f1120fa41cd49ab5afbb8474e471ec1382 /sonar-server
parent4722581dd302fc125d674d6ed0e987e0f49058de (diff)
downloadsonarqube-088d62c2b7900dc594c090c3e5659df77dfe7fbb.tar.gz
sonarqube-088d62c2b7900dc594c090c3e5659df77dfe7fbb.zip
add a tab "permalinks" to profiles console
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb16
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb5
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb148
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb23
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb2
-rw-r--r--sonar-server/src/main/webapp/images/add.pngbin0 -> 434 bytes
-rw-r--r--sonar-server/src/main/webapp/images/restore.gifbin0 -> 349 bytes
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css19
10 files changed, 127 insertions, 91 deletions
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
@@ -191,6 +191,16 @@ class ProfilesController < ApplicationController
#
#
+ # GET /profiles/permalinks?id=<profile id>
+ #
+ #
+ def permalinks
+ @profile = Profile.find(params[:id])
+ end
+
+
+ #
+ #
# GET /profiles/projects/<id>
#
#
@@ -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('<br/>')
+ flash[:error]=messages.getErrors().to_a[0...4].map{|m| m.getLabel()}.join('<br/>')
end
if messages.hasWarnings()
- flash[:warning]=messages.getWarnings()[0...4].map{|m| m.getLabel()}.join('<br/>')
+ flash[:warning]=messages.getWarnings().to_a[0...4].map{|m| m.getLabel()}.join('<br/>')
end
if messages.hasInfos()
- flash[:notice]=messages.getInfos()[0...4].map{|m| m.getLabel()}.join('<br/>')
+ flash[:notice]=messages.getInfos().to_a[0...4].map{|m| m.getLabel()}.join('<br/>')
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 @@
<div id="content">
<% if @project %><div class="print"><h2><%= @project.name(true) %></h2></div><% end %>
<div class="error" id="error" style="display:none"><span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('error').hide();return false;">hide</a>]</div>
- <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;">hide</a>]</div>
<div class="notice" id="info" style="display:none"><span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('info').hide();return false;">hide</a>]</div>
+ <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;">hide</a>]</div>
<%= yield %>
</div>
</div>
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 @@
<li>
<a href="<%= url_for :controller => 'profiles', :action => 'projects', :id => @profile.id -%>" <%= "class='selected'" if selected_tab=='Projects' -%>>Projects</a>
</li>
+ <li>
+ <a href="<%= url_for :controller => 'profiles', :action => 'permalinks', :id => @profile.id -%>" <%= "class='selected'" if selected_tab=='Permalinks' -%>>Permalinks</a>
+ </li>
<% if new_tab %>
<li>
<a href="#" class='selected'><%= new_tab -%></a>
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())
%>
+<div class="line-block marginbottom10">
+ <ul style="float: right" class="horizontal">
+ <li class="marginleft10 add">
+ <a href="#" onClick="$('create-form-<%= language.getKey() -%>').show();return false;">Create</a>
+ </li>
+ <li class="marginleft10 restore">
+ <a href="#" onclick="$('restore-form-<%= language.getKey() -%>').show();return false;">Restore</a>
+ </li>
+ </ul>
+ <h2><%= language.getName() %> profiles</h2>
+</div>
+
+<% if administrator? %>
+ <form class="admin" id="create-form-<%= language.getKey()-%>" action="<%= url_for :action => 'create' -%>" style="display: none" enctype="multipart/form-data" method="post">
+ <input type="hidden" name="language" value="<%= language.getKey() -%>"></input>
+ <table class="spaced width100">
+ <tr>
+ <td width="1%" nowrap>Name: </td>
+ <td><input type="text" name="name"></input></td>
+ </tr>
+ <% importers.each do |importer| %>
+ <tr>
+ <td width="1%" nowrap><%= importer.getName() -%>: </td>
+ <td>
+ <%= file_field_tag "backup[#{importer.getKey()}]" %></input>
+ <span class="note">Optional configuration file</span>
+ </td>
+ </tr>
+ <% end %>
+
+ <tr>
+ <td colspan="2">
+ <input type="submit" value="Create <%= language.getName() %> profile"></input>
+ <a href="#" onclick="$('create-form-<%= language.getKey()-%>').reset();$('create-form-<%= language.getKey()-%>').hide();return false;">Cancel</a>
+ </td>
+ </tr>
+ </table>
+ </form>
+ <form class="admin" id="restore-form-<%= language.getKey()-%>" action="<%= url_for :action => 'restore' -%>" enctype="multipart/form-data" style="display: none" method="post">
+ <input type="hidden" name="language" value="<%= language.getKey() -%>"></input>
+ <table class="spaced width100">
+ <tr>
+ <td width="1%" nowrap>Name: </td>
+ <td><input type="text" name="name"></input></td>
+ </tr>
+ <tr>
+ <td width="1%" nowrap>Backup: </td>
+ <td><%= file_field_tag 'backup' %></td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <input type="submit" value="Restore <%= language.getName() %> profile"></input>
+ <a href="#" onclick="$('restore-form-<%= language.getKey()-%>').reset();$('restore-form-<%= language.getKey()-%>').hide();return false;">Cancel</a>
+ </td>
+ </tr>
+ </table>
+ </form>
+<% end %>
<table class="data2 width100 marginbottom10" id="profiles_<%= language.getKey() -%>">
<thead>
<tr>
- <th><h2><%= language.getName() %></h2></th>
- <th class="right"></th>
- <th class="right"></th>
- <th class="right">Export</th>
- <th class="right">Default</th>
+ <th class="left">Name</th>
+ <th class="right">Rules</th>
+ <th class="right">Alerts</th>
<th class="right">Projects</th>
+ <th class="right">Default</th>
<th width="1%" class="right" colspan="4">Operations</th>
</tr>
</thead>
- <% if administrator? %>
- <tfoot id="footer-<%= language.getKey() -%>">
- <tr>
- <td colspan="10">
- <a href="#" onClick="$('footer-<%= language.getKey() -%>').hide();$('create-form-<%= language.getKey() -%>').show();return false;">Create <%= language.getName() -%> profile</a>
- |
- <a href="#" onclick="$('footer-<%= language.getKey() -%>').hide();$('restore-form-<%= language.getKey() -%>').show();return false;">Restore <%= language.getName() -%> profile</a>
- </td>
- </tr>
- </tfoot>
- <% end %>
<tbody>
<% @profiles.select{|p| p.language==language.getKey()}.each do |profile| %>
<tr class="<%= cycle 'even', 'odd', :name => language.getKey() -%>" id="<%= u profile.key %>">
<td><a href="<%= url_for :controller => 'rules_configuration', :action => 'index', :id => profile.id -%>"><%= h profile.name %></a></td>
<td align="right">
- <a id="rules_<%= u profile.key -%>" href="<%= url_for :controller => 'rules_configuration', :action => 'index', :id => profile.id -%>">
- <span id="activated_rules_<%= u profile.key -%>"><%= profile.active_rules.count -%> rules</span>
- </a>
+ <span id="activated_rules_<%= u profile.key -%>"><%= profile.active_rules.count -%></span>
</td>
- <td align="right"><%= link_to pluralize(profile.alerts.size, 'alert'), url_for(:controller => 'alerts', :action => 'index', :id => profile.id), :id => "alerts_#{u profile.key}" %></td>
+ <td align="right"><span id="alerts_<%= u profile.key -%>"><%= profile.alerts.size -%></span></td>
<td align="right">
- <% 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? %>
+ <span id="projects_<%= u profile.key -%>"><%= profile.projects.size -%></span>
<% end %>
</td>
-
<td align="right">
<% if (!profile.default_profile? && administrator?) %>
<%= button_to 'Set as default', { :action => 'set_as_default', :id => profile.id }, :class => 'action',
@@ -61,13 +103,7 @@
</td>
- <td align="right">
- <% 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 %>
- </td>
+
<td align="right">
<% if (!profile.provided? && administrator?) %>
@@ -107,52 +143,4 @@
<% end %>
</tbody>
</table>
-
- <% if administrator? %>
- <form class="admin" id="create-form-<%= language.getKey()-%>" action="<%= url_for :action => 'create' -%>" style="display: none" enctype="multipart/form-data" method="post">
- <input type="hidden" name="language" value="<%= language.getKey() -%>"></input>
- <table class="spaced width100">
- <tr>
- <td width="1%" nowrap>Name: </td>
- <td><input type="text" name="name"></input></td>
- </tr>
- <% importers.each do |importer| %>
- <tr>
- <td width="1%" nowrap><%= importer.getName() -%>: </td>
- <td>
- <%= file_field_tag "backup[#{importer.getKey()}]" %></input>
- <span class="note">Optional configuration file</span>
- </td>
- </tr>
- <% end %>
-
- <tr>
- <td colspan="2">
- <input type="submit" value="Create <%= language.getName() %> profile"></input>
- <a href="#" onclick="$('create-form-<%= language.getKey()-%>').reset();$('create-form-<%= language.getKey()-%>').hide();$('footer-<%= language.getKey()-%>').show();return false;">Cancel</a>
- </td>
- </tr>
- </table>
- </form>
- <form class="admin" id="restore-form-<%= language.getKey()-%>" action="<%= url_for :action => 'restore' -%>" enctype="multipart/form-data" style="display: none" method="post">
- <input type="hidden" name="language" value="<%= language.getKey() -%>"></input>
- <table class="spaced width100">
- <tr>
- <td width="1%" nowrap>Name: </td>
- <td><input type="text" name="name"></input></td>
- </tr>
- <tr>
- <td width="1%" nowrap>Backup: </td>
- <td><%= file_field_tag 'backup' %></td>
- </tr>
-
- <tr>
- <td colspan="2">
- <input type="submit" value="Restore <%= language.getName() %> profile"></input>
- <a href="#" onclick="$('restore-form-<%= language.getKey()-%>').reset();$('restore-form-<%= language.getKey()-%>').hide();$('footer-<%= language.getKey()-%>').show();return false;">Cancel</a>
- </td>
- </tr>
- </table>
- </form>
- <% 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 @@
+<h1 class="marginbottom10"><%= link_to 'Quality profiles', :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
+<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Permalinks'} %>
+
+<!--<div class="tabs-panel marginbottom10 background-gray">
+
+</div>-->
+<br/>
+<% exporters=controller.java_facade.getProfileExportersForLanguage(@profile.language) %>
+<table class="data2 without-header marginbottom10 ">
+ <tbody>
+ <% exporters.each do |exporter| %>
+ <tr class="<%= cycle('even','odd') -%>">
+ <td width="1%" nowrap>
+ <%= h exporter.getName() -%>
+ </td>
+ <td>
+ <% permalink=url_for :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %>
+ <span class="small"><%= link_to permalink, :url => permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %></span>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table> \ 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 @@
<thead>
<tr>
<th class="left" nowrap>Active/Priority</th>
- <th class="left">Name [<%= link_to_function("expand/collapse", "toggle_rules()") %>]</th>
+ <th class="left">Name <span style="font-weight: normal">[<%= link_to_function("expand/collapse", "toggle_rules()") %>]</span></th>
<th class="right">Plugin</th>
<th class="right">Category</th>
</tr>
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 00000000000..7428c48992c
--- /dev/null
+++ b/sonar-server/src/main/webapp/images/add.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/images/restore.gif b/sonar-server/src/main/webapp/images/restore.gif
new file mode 100644
index 00000000000..ab62179dc90
--- /dev/null
+++ b/sonar-server/src/main/webapp/images/restore.gif
Binary files differ
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