]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2702 New "Exclusions" service in the "CONFIGURATION" section
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 24 Aug 2011 13:00:07 +0000 (15:00 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 24 Aug 2011 13:00:07 +0000 (15:00 +0200)
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/project/exclusions.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/project/settings.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_exclusions.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_links.html.erb [deleted file]

index a61de34dc633a7971fbb86463ac8fb898215ded6..c0754fd8e2ff3a9504cc84945aba6aa1d60efa61 100644 (file)
@@ -278,6 +278,8 @@ manual_measures.page=Manual Measures
 my_profile.page=My Profile
 project_roles.page=Project Roles
 project_settings.page=Settings
+project_links.page=Links
+project_exclusions.page=Exclusions
 quality_profiles.page=Quality Profiles
 reviews.page=Reviews
 settings.page=General Settings
index 1ad83db45184ba417d7e272e3c57924c27c486f2..fe22aa979cdd84444e35765c13048b343ffe038a 100644 (file)
@@ -37,6 +37,16 @@ class ProjectController < ApplicationController
     redirect_to_default
   end
 
+  def links
+    @project=Project.by_key(params[:id])
+    return access_denied unless is_admin?(@project)
+
+    @snapshot=@project.last_snapshot
+    if !@project.project?
+      redirect_to :action => 'index', :id => params[:id]
+    end
+  end
+
   def set_links
     project = Project.by_key(params[:project_id])
     return access_denied unless is_admin?(project)
@@ -60,9 +70,10 @@ class ProjectController < ApplicationController
     project.save!
 
     flash[:notice] = 'Links updated.'
-    redirect_to :action => 'settings', :id => project.id
+    redirect_to :action => 'links', :id => project.id
   end
 
+  
   def settings
     @project=Project.by_key(params[:id])
     return access_denied unless is_admin?(@project)
@@ -102,6 +113,16 @@ class ProjectController < ApplicationController
   end
 
 
+  def exclusions
+    @project=Project.by_key(params[:id])
+    return access_denied unless is_admin?(@project)
+  
+    @snapshot=@project.last_snapshot
+    if !@project.project? && !@project.module?
+      redirect_to :action => 'index', :id => params[:id]
+    end
+  end
+
   def set_exclusions
     @project = Project.find(params[:id])
     return access_denied unless is_admin?(@project)
@@ -114,7 +135,7 @@ class ProjectController < ApplicationController
       Property.set('sonar.exclusions', patterns.collect{|x| x.strip}.join(','), @project.id)
     end
     flash[:notice]='Filters added'
-    redirect_to :action => 'settings', :id => @project.id
+    redirect_to :action => 'exclusions', :id => @project.id
   end
 
   def delete_exclusions
@@ -123,7 +144,7 @@ class ProjectController < ApplicationController
     
     Property.clear('sonar.exclusions', @project.id)
     flash[:notice]='Filters deleted'
-    redirect_to :action => 'settings', :id => @project.id
+    redirect_to :action => 'exclusions', :id => @project.id
   end
 
   protected
index 871641fa03a728a583438a6359d98793dd9de727..587c367f4caddc79cf630217bf8ea3f62e6a8f87 100644 (file)
             <% if (@project.project? || @project.module?) %>
               <li class="<%= 'selected' if request.request_uri.include?('/project/settings') -%>"><a href="<%= ApplicationController.root_context -%>/project/settings/<%= @project.id -%>"><%= message('project_settings.page') -%></a></li>
             <% end %>
+            <% if (@project.project? || @project.module?) %>
+              <li class="<%= 'selected' if request.request_uri.include?('/project/exclusions') -%>"><a href="<%= ApplicationController.root_context -%>/project/exclusions/<%= @project.id -%>"><%= message('project_exclusions.page') -%></a></li>
+            <% end %>
+            <% if (@project.project?) %>
+              <li class="<%= 'selected' if request.request_uri.include?('/project/links') -%>"><a href="<%= ApplicationController.root_context -%>/project/links/<%= @project.id -%>"><%= message('project_links.page') -%></a></li>
+            <% end %>
             <% if (@project.project? || @project.view? || @project.subview?) %>
               <li class="<%= 'selected' if request.request_uri.include?('/project_roles') -%>"><a href="<%= ApplicationController.root_context -%>/project_roles/index?resource=<%= @project.id -%>"><%= message('project_roles.page') -%></a></li>
             <% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/exclusions.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/exclusions.html.erb
new file mode 100644 (file)
index 0000000..19161bb
--- /dev/null
@@ -0,0 +1,58 @@
+<h1>Exclude sources from code analysis</h1>
+<br/>
+<div class="yui-g widget" id="widget_exclusions">
+
+
+  <div class="yui-u first">
+    <p>Changes will be applied during next code analysis.</p>
+    <% form_for( 'set_exclusions', :url => { :action => 'set_exclusions', :id => @project.id } ) do |form| 
+          pattern_index=0
+       %>
+    <table class="spaced">
+      <% patterns = Property.value('sonar.exclusions', @project.id, '').split(',')
+         patterns.each do |pattern|
+      %>
+      <tr>
+        <td class=left>
+          <input id="exclusion_pattern_<%= pattern_index -%>" name="patterns[]" size="50" value="<%= pattern -%>" type="text">
+        </td>
+      </tr>
+      <%  pattern_index += 1
+         end
+      %>
+      <tr><td class=left>
+        <input name="patterns[]" size="50" value="" type="text" id="exclusion_pattern_<%= pattern_index-%>">
+      </td></tr>
+      <tr><td class=left>
+        <input name="patterns[]" size="50" value="" type="text" id="exclusion_pattern_<%= pattern_index + 1-%>"><br/>
+        <span class="note"><ul><li>com/mycompany/**/*.java</li><li>**/*Dummy.java</li></ul></span>
+      </td></tr>
+      <tr><td class=left>
+        <%= submit_tag( "Save filters", :id => 'submit_exclusions') %>
+        <%= link_to 'Delete all filters', {:action => 'delete_exclusions', :id => @project.id}, :method => 'POST', :confirm => "Are you sure you want to delete all exclusion filters ?", :id => 'delete_exclusions' %>
+        </td></tr>
+    </table>
+    <% end %>
+  </div>
+
+  <div class="yui-u">
+    <div class="help">
+      <h2>Wildcards</h2>
+      <table class="data">
+        <thead><tr><th colspan="2"></th></tr></thead>
+        <tr class="odd">
+          <td>*</td>
+          <td>Match zero or more characters</td>
+        </tr>
+        <tr class="even">
+          <td>**</td>
+          <td>Match zero or more directories</td>
+        </tr>
+        <tr class="odd">
+          <td>?</td>
+          <td>Match a single character</td>
+        </tr>
+      </table>
+    </div>
+  </div>
+</div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb
new file mode 100644 (file)
index 0000000..727687e
--- /dev/null
@@ -0,0 +1,88 @@
+<h1>Project links</h1>
+<br/>
+<div class="yui-g widget" id="widget_links">
+
+<% form_for( 'set_links', :url => { :action => 'set_links', :project_id => @project.id } ) do |form|
+     links_by_key={}
+     @project.links.each do |link|
+       links_by_key[link.link_type]=link  
+     end
+%>
+   <div class="yui-u first">
+  <table class="data">
+    <thead><tr><th>Title</th><th>URL</th></tr></thead>
+
+    <tr class="even">
+      <td align="left" nowrap width="1%">
+        <%= image_tag("links/homepage.png") -%> Home</td>
+        <td>
+            <input type="hidden" name="key_homepage" value="homepage" />
+            <input type="hidden" name="name_homepage" value="Home" />
+            <%= text_field_tag( "url_homepage", links_by_key['homepage'] ? links_by_key['homepage'].href : '', :readonly => true, :size => 30  ) -%>
+        </td>
+     </tr>
+     <tr class="odd">
+      <td align="left" nowrap width="1%">
+        <%= image_tag("links/ci.png") -%> Continuous integration</td>
+        <td>
+           <input type="hidden" name="key_ci" value="ci" />
+           <input type="hidden" name="name_ci" value="Continuous integration" />
+            <%= text_field_tag( "url_ci", links_by_key['ci'] ? links_by_key['ci'].href : '', :readonly => true, :size => 30 ) -%>
+        </td>
+     </tr>
+     <tr class="even">
+      <td align="left" nowrap width="1%">
+        <%= image_tag("links/issue.png") -%> Issue tracker</td>
+        <td>
+           <input type="hidden" name="key_issue" value="issue" />
+           <input type="hidden" name="name_issue" value="Issues" />
+            <%= text_field_tag( "url_issue", links_by_key['issue'] ? links_by_key['issue'].href : '', :readonly => true, :size => 30  ) -%>
+        </td>
+     </tr>
+     <tr class="odd">
+      <td align="left" nowrap width="1%">
+        <%= image_tag("links/scm.png") -%> Sources</td>
+        <td>
+           <input type="hidden" name="key_scm" value="scm" />
+           <input type="hidden" name="name_scm" value="Sources" />
+            <%= text_field_tag( "url_scm", links_by_key['scm'] ? links_by_key['scm'].href : '', :readonly => true, :size => 30  ) -%>
+        </td>
+     </tr>
+     <tr class="even">
+      <td align="left" nowrap width="1%">
+        <%= image_tag("links/scm_dev.png") -%> Developer connection</td>
+        <td>
+           <input type="hidden" name="key_scm_dev" value="scm_dev" />
+           <input type="hidden" name="name_scm_dev" value="Developer connection" />
+            <%= text_field_tag( "url_scm_dev", links_by_key['scm_dev'] ? links_by_key['scm_dev'].href : '', :readonly => true, :size => 30  ) -%>
+        </td>
+     </tr>
+<tr><td colspan="2" class="even"><%= submit_tag( "Save links" ) %></td></tr>
+   </table>
+ </div>
+    <div class="yui-u">
+      <table class="data">
+        <thead><tr><th>Title</th><th>URL</th></tr></thead>
+       <% index = 0
+         @project.custom_links.each do |custom_link|
+           index += 1 %>
+        <tr class="<%= cycle('even','odd') -%>">
+          <td align="left">
+            <%= image_tag("links/external.png") -%> <%= text_field_tag( "name_#{index}", h(custom_link.name), :size => 15 ) -%>
+          </td>
+          <td>
+            <%= text_field_tag( "url_#{index}", custom_link.href, :size => 30 ) -%>
+          </td>
+        </tr>
+      <% end %>
+      <% index += 1
+         for var in index..5 %>
+        <tr class="<%= cycle('even','odd') -%>">
+            <td align="left"><%= image_tag("links/external.png") -%>  <%= text_field_tag( "name_#{var}", '', :size => 15) %></td>
+            <td><%= text_field_tag( "url_#{var}", '', :size => 30 ) %></td>
+        </tr>
+      <% end %>
+      </table>
+    </div>
+<% end %>
+</div>
\ No newline at end of file
index 16f30eb70222c7c03ff223e6aaefae32dedc6128..c361a478aeb8f72a91b45716264d14a0f4866689 100644 (file)
@@ -1,12 +1,8 @@
 <div name="settings">
 
 <%= render :partial => 'project/settings/plugins' %>
-<br/>
-<%= render :partial => 'project/settings/exclusions' %>
 <% if @project.project? %>
 <br/>
-<%= render :partial => 'project/settings/links' %>
-<br/>
 <%= render :partial => 'project/settings/delete_project' %>
 <% end %>
 
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_exclusions.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_exclusions.html.erb
deleted file mode 100644 (file)
index b2208db..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<h1>Exclude sources from code analysis</h1>
-<div class="yui-g widget" id="widget_exclusions">
-
-
-  <div class="yui-u first">
-    <p>Changes will be applied during next code analysis.</p>
-    <% form_for( 'set_exclusions', :url => { :action => 'set_exclusions', :id => @project.id } ) do |form| 
-          pattern_index=0
-       %>
-    <table class="spaced">
-      <% patterns = Property.value('sonar.exclusions', @project.id, '').split(',')
-         patterns.each do |pattern|
-      %>
-      <tr>
-        <td class=left>
-          <input id="exclusion_pattern_<%= pattern_index -%>" name="patterns[]" size="50" value="<%= pattern -%>" type="text">
-        </td>
-      </tr>
-      <%  pattern_index += 1
-         end
-      %>
-      <tr><td class=left>
-        <input name="patterns[]" size="50" value="" type="text" id="exclusion_pattern_<%= pattern_index-%>">
-      </td></tr>
-      <tr><td class=left>
-        <input name="patterns[]" size="50" value="" type="text" id="exclusion_pattern_<%= pattern_index + 1-%>"><br/>
-        <span class="note"><ul><li>com/mycompany/**/*.java</li><li>**/*Dummy.java</li></ul></span>
-      </td></tr>
-      <tr><td class=left>
-        <%= submit_tag( "Save filters", :id => 'submit_exclusions') %>
-        <%= link_to 'Delete all filters', {:action => 'delete_exclusions', :id => @project.id}, :method => 'POST', :confirm => "Are you sure you want to delete all exclusion filters ?", :id => 'delete_exclusions' %>
-        </td></tr>
-    </table>
-    <% end %>
-  </div>
-
-  <div class="yui-u">
-    <div class="help">
-      <h2>Wildcards</h2>
-      <table class="data">
-        <thead><tr><th colspan="2"></th></tr></thead>
-        <tr class="odd">
-          <td>*</td>
-          <td>Match zero or more characters</td>
-        </tr>
-        <tr class="even">
-          <td>**</td>
-          <td>Match zero or more directories</td>
-        </tr>
-        <tr class="odd">
-          <td>?</td>
-          <td>Match a single character</td>
-        </tr>
-      </table>
-    </div>
-  </div>
-</div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_links.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_links.html.erb
deleted file mode 100644 (file)
index 8f79d83..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<h1>Project links</h1>
-<div class="yui-g widget" id="widget_links">
-
-<% form_for( 'set_links', :url => { :action => 'set_links', :project_id => @project.id } ) do |form|
-     links_by_key={}
-     @project.links.each do |link|
-       links_by_key[link.link_type]=link  
-     end
-%>
-   <div class="yui-u first">
-  <table class="data">
-    <thead><tr><th>Title</th><th>URL</th></tr></thead>
-
-    <tr class="even">
-      <td align="left" nowrap width="1%">
-        <%= image_tag("links/homepage.png") -%> Home</td>
-        <td>
-            <input type="hidden" name="key_homepage" value="homepage" />
-            <input type="hidden" name="name_homepage" value="Home" />
-            <%= text_field_tag( "url_homepage", links_by_key['homepage'] ? links_by_key['homepage'].href : '', :readonly => true, :size => 30  ) -%>
-        </td>
-     </tr>
-     <tr class="odd">
-      <td align="left" nowrap width="1%">
-        <%= image_tag("links/ci.png") -%> Continuous integration</td>
-        <td>
-           <input type="hidden" name="key_ci" value="ci" />
-           <input type="hidden" name="name_ci" value="Continuous integration" />
-            <%= text_field_tag( "url_ci", links_by_key['ci'] ? links_by_key['ci'].href : '', :readonly => true, :size => 30 ) -%>
-        </td>
-     </tr>
-     <tr class="even">
-      <td align="left" nowrap width="1%">
-        <%= image_tag("links/issue.png") -%> Issue tracker</td>
-        <td>
-           <input type="hidden" name="key_issue" value="issue" />
-           <input type="hidden" name="name_issue" value="Issues" />
-            <%= text_field_tag( "url_issue", links_by_key['issue'] ? links_by_key['issue'].href : '', :readonly => true, :size => 30  ) -%>
-        </td>
-     </tr>
-     <tr class="odd">
-      <td align="left" nowrap width="1%">
-        <%= image_tag("links/scm.png") -%> Sources</td>
-        <td>
-           <input type="hidden" name="key_scm" value="scm" />
-           <input type="hidden" name="name_scm" value="Sources" />
-            <%= text_field_tag( "url_scm", links_by_key['scm'] ? links_by_key['scm'].href : '', :readonly => true, :size => 30  ) -%>
-        </td>
-     </tr>
-     <tr class="even">
-      <td align="left" nowrap width="1%">
-        <%= image_tag("links/scm_dev.png") -%> Developer connection</td>
-        <td>
-           <input type="hidden" name="key_scm_dev" value="scm_dev" />
-           <input type="hidden" name="name_scm_dev" value="Developer connection" />
-            <%= text_field_tag( "url_scm_dev", links_by_key['scm_dev'] ? links_by_key['scm_dev'].href : '', :readonly => true, :size => 30  ) -%>
-        </td>
-     </tr>
-<tr><td colspan="2" class="even"><%= submit_tag( "Save links" ) %></td></tr>
-   </table>
- </div>
-    <div class="yui-u">
-      <table class="data">
-        <thead><tr><th>Title</th><th>URL</th></tr></thead>
-       <% index = 0
-         @project.custom_links.each do |custom_link|
-           index += 1 %>
-        <tr class="<%= cycle('even','odd') -%>">
-          <td align="left">
-            <%= image_tag("links/external.png") -%> <%= text_field_tag( "name_#{index}", h(custom_link.name), :size => 15 ) -%>
-          </td>
-          <td>
-            <%= text_field_tag( "url_#{index}", custom_link.href, :size => 30 ) -%>
-          </td>
-        </tr>
-      <% end %>
-      <% index += 1
-         for var in index..5 %>
-        <tr class="<%= cycle('even','odd') -%>">
-            <td align="left"><%= image_tag("links/external.png") -%>  <%= text_field_tag( "name_#{var}", '', :size => 15) %></td>
-            <td><%= text_field_tag( "url_#{var}", '', :size => 30 ) %></td>
-        </tr>
-      <% end %>
-      </table>
-    </div>
-<% end %>
-</div>
\ No newline at end of file