From: Stas Vilchik Date: Mon, 13 Apr 2015 07:56:02 +0000 (+0200) Subject: SONAR-5851 replace old profiles page with new one X-Git-Tag: 5.2-RC1~2302 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=df728b2edfc519075112cc157e4d7fe23fe514cb;p=sonarqube.git SONAR-5851 replace old profiles page with new one --- diff --git a/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs b/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs index d3821e0922d..5ca0d9d843f 100644 --- a/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs +++ b/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs @@ -41,8 +41,8 @@
  • {{t 'quality_profiles.page'}}
  • -
  • - NEW {{t 'quality_profiles.page'}} +
  • + OLD {{t 'quality_profiles.page'}}
  • {{t 'quality_gates.page'}} diff --git a/server/sonar-web/src/main/js/quality-profiles/app.js b/server/sonar-web/src/main/js/quality-profiles/app.js index 8cf66d6bf15..b3e2a269ea6 100644 --- a/server/sonar-web/src/main/js/quality-profiles/app.js +++ b/server/sonar-web/src/main/js/quality-profiles/app.js @@ -67,7 +67,7 @@ require([ }); function getRoot () { - var QUALITY_PROFILES = '/quality_profiles', + var QUALITY_PROFILES = '/profiles', path = window.location.pathname, pos = path.indexOf(QUALITY_PROFILES); return path.substr(0, pos + QUALITY_PROFILES.length); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/old_profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/old_profiles_controller.rb new file mode 100644 index 00000000000..39c71eaf1f2 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/old_profiles_controller.rb @@ -0,0 +1,574 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +class OldProfilesController < ApplicationController + + helper :profiles + + SECTION=Navigation::SECTION_QUALITY_PROFILES + + def self.root_breadcrumb + {:name => Api::Utils.message('quality_profiles.page'), :url => {:controller => 'old_profiles', :action => 'index'}} + end + + # GET /profiles/index + def index + add_breadcrumbs OldProfilesController::root_breadcrumb + call_backend do + @profiles = Internal.quality_profiles.allProfiles().to_a + @active_rule_counts = Internal.qprofile_loader.countAllActiveRules() + end + Api::Utils.insensitive_sort!(@profiles) { |profile| profile.name() } + end + + # GET /profiles/show?key= + def show + require_parameters 'key' + call_backend do + @profile = Internal.qprofile_loader.getByKey(params[:key]) + if @profile + @deprecated_active_rules = Internal.qprofile_loader.countDeprecatedActiveRulesByProfile(@profile.getKey()) + @stats = Internal.qprofile_loader.getStatsByProfile(@profile.getKey()) + set_profile_breadcrumbs + else + # SONAR-5630 + flash[:error] = message('quality_profiles.deleted_profile', :params => params[:key]) + redirect_to :controller => 'old_profiles', :action => 'index' + end + end + end + + # GET /profiles/create_form?language= + def create_form + require_parameters 'language' + render :partial => 'old_profiles/create_form', :locals => {:language_key => params[:language]} + end + + # POST /profiles/create?name=&language=&[backup=] + def create + verify_post_request + call_backend do + files_by_key = {} + if params[:backup] + params[:backup].each_pair do |importer_key, file| + unless file.blank? + files_by_key[importer_key] = Api::Utils.read_post_request_param(file) + end + end + end + profile_name = Java::OrgSonarServerQualityprofile::QProfileName.new(params[:language], params[:name]) + result = Internal.qprofile_service.create(profile_name, files_by_key) + flash[:notice] = message('quality_profiles.profile_x_created', :params => result.profile().getName()) + flash_result(result) + end + redirect_to :action => 'index' + end + + # Modal window to restore built-in profiles + # GET /profiles/restore_built_in_form/ + def restore_built_in_form + verify_ajax_request + require_parameters 'language' + @language = java_facade.getLanguages().find { |l| l.getKey()==params[:language].to_s } + call_backend do + @builtin_profile_names = Internal.qprofile_service.builtInProfileNamesForLanguage(params[:language].to_s) + end + render :partial => 'old_profiles/restore_built_in_form' + end + + # POST /profiles/restore_built_in?language= + def restore_built_in + verify_post_request + require_parameters 'language' + call_backend do + Internal.qprofile_service.restoreBuiltInProfilesForLanguage(params[:language].to_s) + end + redirect_to :action => 'index' + end + + # POST /profiles/delete/ + def delete + verify_post_request + require_parameters 'id' + + profile_key = profile_id_to_key(params[:id].to_i) + call_backend do + Internal.qprofile_service.delete(profile_key) + end + + redirect_to(:controller => 'old_profiles', :action => 'index') + end + + + # POST /profiles/set_as_default/ + def set_as_default + verify_post_request + require_parameters 'id' + + profile_key = profile_id_to_key(params[:id].to_i) + call_backend do + Internal.qprofile_service.setDefault(profile_key) + end + redirect_to :action => 'index' + end + + + # GET /profiles/copy_form/ + def copy_form + require_parameters 'id' + + profile_id = params[:id].to_i + call_backend do + @profile = Internal.quality_profiles.profile(profile_id) + end + not_found('Profile not found') unless @profile + + render :partial => 'old_profiles/copy_form' + end + + # POST /profiles/copy/?name=[&overwrite=] + def copy + verify_post_request + verify_ajax_request + require_parameters 'id' + + source_id = params[:id].to_i + source_profile = Internal.quality_profiles.profile(source_id) + + source_key=profile_id_to_key(source_id) + target_name = params['name'] + + overwrite = (params['overwrite'] == target_name) + target_profile = nil + + unless overwrite + target_profile = Internal.quality_profiles.profile(target_name, source_profile.language()) + end + + if target_profile.nil? || overwrite + call_backend do + Internal.qprofile_service.copyToName(source_key, target_name) + if overwrite + flash[:notice] = message('quality_profiles.copy_x_overwritten', :params => target_name) + else + flash[:notice] = message('quality_profiles.profile_x_not_activated', :params => target_name) + end + render :text => 'ok', :status => 200 + end + else + render :text => message('quality_profiles.copy_overwrite_x', :params => target_name), :status => 409 + end + end + + # the backup action is allow to non-admin users : see http://jira.codehaus.org/browse/SONAR-2039 + def backup + verify_post_request + require_parameters 'key' + + profile_key=params[:key] + call_backend do + xml = Internal.qprofile_service.backup(profile_key) + send_data(xml, :type => 'text/xml', :disposition => "attachment; filename=#{profile_key}.xml") + end + end + + + # Modal window to restore profile backup + # GET /profiles/restore_form/ + def restore_form + verify_ajax_request + render :partial => 'old_profiles/restore_form' + end + + # POST /profiles/restore?backup= + def restore + if params[:backup].blank? + flash[:warning] = message('quality_profiles.please_upload_backup_file') + else + call_backend do + xml=Api::Utils.read_post_request_param(params[:backup]) + Internal.qprofile_service.restore(xml) + end + end + redirect_to :action => 'index' + end + + + # GET /profiles/export?name=&language=&format + def export + language = params[:language] + if params[:name].blank? + profile = Internal.qprofile_service.getDefault(language) + else + profile = Internal.qprofile_loader.getByLangAndName(language, CGI::unescape(params[:name])) + end + not_found('Profile not found') unless profile + + if params[:format].blank? + # standard sonar format + result = Internal.qprofile_service.backup(profile.getKee()) + send_data(result, :type => 'text/xml', :disposition => 'inline') + else + exporter_key = params[:format] + result = Internal.qprofile_exporters.export(profile.getKee(), exporter_key) + send_data(result, :type => Internal.qprofile_exporters.mimeType(exporter_key), :disposition => 'inline') + end + end + + # GET /profiles/inheritance?id= + def inheritance + require_parameters 'id' + + call_backend do + @profile = Internal.quality_profiles.profile(params[:id].to_i) + not_found('Profile not found') unless @profile + @parent = Internal.quality_profiles.parent(@profile) if @profile.parent + @ancestors = Internal.quality_profiles.ancestors(@profile).to_a + @children = Internal.quality_profiles.children(@profile).to_a + profiles = Internal.quality_profiles.profilesByLanguage(@profile.language()).to_a.reject { |p| p.id == @profile.id() || p.parent() == @profile.name() } + profiles = Api::Utils.insensitive_sort(profiles) { |p| p.name() } + @select_parent = [[message('none'), nil]] + profiles.collect { |profile| [profile.name(), profile.id()] } + + @all_profile_stats = Internal.qprofile_loader.getAllProfileStats() + end + + set_profile_breadcrumbs + end + + # POST /profiles/change_parent?id=&parent_id= + def change_parent + verify_post_request + access_denied unless has_role?(:profileadmin) + require_parameters 'id' + + profile_key = profile_id_to_key(params[:id].to_i) + parent_key = profile_id_to_key(params[:parent_id].to_i) unless params[:parent_id].empty? + call_backend do + Internal.qprofile_service.setParent(profile_key, parent_key) + end + redirect_to :action => 'inheritance', :id => params[:id] + end + + # GET /profiles/changelog?key= + def changelog + require_parameters 'key' + + @profile = Internal.qprofile_loader.getByKey(params[:key]) + not_found('Quality profile does not exist') unless @profile + search = {'profileKey' => @profile.key().to_s, 'since' => params[:since], 'to' => params[:to], 'p' => params[:p]} + result = Internal.component(Java::OrgSonarServerActivity::RubyQProfileActivityService.java_class).search(search) + @changes = result.activities + @paging = result.paging + + set_profile_breadcrumbs + end + + # + # + # GET /profiles/permalinks?id= + # + # + def permalinks + require_parameters 'id' + @profile = Internal.quality_profiles.profile(params[:id].to_i) + not_found('Profile not found') unless @profile + set_profile_breadcrumbs + end + + + # + # + # GET /profiles/projects/ + # + # + def projects + require_parameters 'id' + + call_backend do + @profile = Internal.quality_profiles.profile(params[:id].to_i) + not_found('Profile not found') unless @profile + projects = Internal.quality_profiles.projects(params[:id].to_i) + @projects = Api::Utils.insensitive_sort(projects.to_a) { |p| p.name } + set_profile_breadcrumbs + end + end + + + # POST /profiles/add_project?id=&project= + def add_project + verify_post_request + require_parameters 'id', 'project' + + project_id = Api::Utils.project_id(params[:project]) + profile_id = params[:id].to_i + + call_backend do + Internal.quality_profiles.addProject(profile_id, project_id.to_i) + end + redirect_to :action => 'projects', :id => profile_id + end + + # POST /profiles/remove_project?id=&project= + def remove_project + verify_post_request + require_parameters 'id', 'project' + + profile_id = params[:id].to_i + call_backend do + Internal.quality_profiles.removeProject(profile_id, params[:project].to_i) + end + redirect_to :action => 'projects', :id => profile_id + end + + # POST /profiles/remove_projects?id= + def remove_projects + verify_post_request + require_parameters 'id' + + profile_id = params[:id].to_i + call_backend do + Internal.quality_profiles.removeAllProjects(profile_id) + end + redirect_to :action => 'projects', :id => profile_id + end + + # GET /profiles/rename_form?id= + def rename_form + require_parameters 'id' + call_backend do + @profile = Internal.quality_profiles.profile(params[:id].to_i) + not_found('Profile not found') unless @profile + end + render :partial => 'old_profiles/rename_form' + end + + # POST /profiles/rename?id=&name= + def rename + verify_post_request + verify_ajax_request + require_parameters 'id' + + call_backend do + profile_key = profile_id_to_key(params[:id].to_i) + Internal.qprofile_service.rename(profile_key, params[:new_name]) + end + render :text => 'ok', :status => 200 + end + + # GET /profiles/compare?id1=&id2= + def compare + @profiles = Profile.all(:order => 'language asc, name') + id1 = params[:id1] + id2 = params[:id2] + if id1.present? && id2.present? && id1.respond_to?(:to_i) && id2.respond_to?(:to_i) + @id1 = params[:id1].to_i + @id2 = params[:id2].to_i + @profile1 = Profile.find(id1) + @profile2 = Profile.find(id2) + + arules1 = ActiveRule.all(:include => [{:active_rule_parameters => :rules_parameter}, :rule], + :conditions => ['active_rules.profile_id=?', @profile1.id]) + arules2 = ActiveRule.all(:order => 'rules.plugin_name, rules.plugin_rule_key', :include => [{:active_rule_parameters => :rules_parameter}, :rule], + :conditions => ['active_rules.profile_id=?', @profile2.id]) + + arules1.reject! { |arule| arule.rule.removed? } + arules2.reject! { |arule| arule.rule.removed? } + + diffs_by_rule={} + arules1.each do |arule1| + diffs_by_rule[arule1.rule]||=RuleDiff.new(arule1.rule) + diffs_by_rule[arule1.rule].arule1=arule1 + end + arules2.each do |arule2| + diffs_by_rule[arule2.rule]||=RuleDiff.new(arule2.rule) + diffs_by_rule[arule2.rule].arule2=arule2 + end + @in1=[] + @in2=[] + @modified=[] + @sames=[] + diffs_by_rule.values.sort.each do |diff| + case diff.status + when DIFF_IN1 then + @in1<(other) + rule.name()<=>other.rule.name + end + end + + # + # Remove active rules that are identical in both collections (same severity and same parameters) + # and return a map with results {:added => X, :removed => Y, :modified => Z, + # :rules => {rule1 => [activeruleleft1, activeruleright1], rule2 => [activeruleleft2, nil], ...]} + # Assume both collections are ordered by rule key + # + def compute_diff(arules1, arules2) + rules = {} + removed = 0 + added = 0 + modified = 0 + same = 0 + begin + diff = false + #take first item of each collection + active_rule1 = arules1.first + active_rule2 = arules2.first + if active_rule1 != nil and active_rule2 != nil + order = active_rule1.rule.key <=> active_rule2.rule.key + if order < 0 + active_rule2 = nil + rule = active_rule1.rule + diff = true + removed = removed +1 + elsif order > 0 + active_rule1 = nil + rule = active_rule2.rule + diff = true + added = added +1 + else + rule = active_rule1.rule # = active_rule2.rule + #compare severity + diff = true if active_rule1.priority != active_rule2.priority + #compare parameters + rule.parameters.each do |param| + diff = true if active_rule1.value(param.id) != active_rule2.value(param.id) + end + if diff + modified = modified + 1 + else + same = same +1 + end + end + elsif active_rule1 != nil + #no more rule in right collection + diff = true + removed = removed +1 + rule = active_rule1.rule + elsif active_rule2 != nil + #no more rule in left collection + diff = true + added = added +1 + rule = active_rule2.rule + end + # remove processed rule(s) + arules1 = arules1.drop(1) if active_rule1 != nil + arules2 = arules2.drop(1) if active_rule2 != nil + if diff + rules[rule] = [active_rule1, active_rule2] + end + end while !arules1.empty? || !arules2.empty? + return {:same => same, :added => added, :removed => removed, :modified => modified, :rules => rules} + end + + def flash_messages(messages) + # only 4 messages are kept each time to avoid cookie overflow. + if messages.hasErrors() + flash[:error]=messages.getErrors().to_a[0...4].join('
    ') + end + if messages.hasWarnings() + flash[:warning]=messages.getWarnings().to_a[0...4].join('
    ') + end + if messages.hasInfos() + flash[:notice]=messages.getInfos().to_a[0...4].join('
    ') + end + end + + def flash_result(result) + # only 4 messages are kept each time to avoid cookie overflow. + unless result.infos.empty? + flash[:notice] += '
    ' + result.infos.to_a[0...4].join('
    ') + end + unless result.warnings.empty? + flash[:warning] = result.warnings.to_a[0...4].join('
    ') + end + + end + + def set_profile_breadcrumbs + add_breadcrumbs OldProfilesController::root_breadcrumb, {:name => "#{@profile.name} (#{Api::Utils.language_name(@profile.language)})"} + end + + def profile_id_to_key(profile_id) + profile = Profile.find(profile_id) + not_found('Profile not found') unless profile + profile.kee + end +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index 79b88b22bb0..28a940f72ec 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -17,556 +17,15 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -class ProfilesController < ApplicationController - - SECTION=Navigation::SECTION_QUALITY_PROFILES - def self.root_breadcrumb - {:name => Api::Utils.message('quality_profiles.page'), :url => {:controller => 'profiles', :action => 'index'}} - end +class ProfilesController < ApplicationController - # GET /profiles/index def index - add_breadcrumbs ProfilesController::root_breadcrumb - call_backend do - @profiles = Internal.quality_profiles.allProfiles().to_a - @active_rule_counts = Internal.qprofile_loader.countAllActiveRules() - end - Api::Utils.insensitive_sort!(@profiles) { |profile| profile.name() } - end - - # GET /profiles/show?key= - def show - require_parameters 'key' - call_backend do - @profile = Internal.qprofile_loader.getByKey(params[:key]) - if @profile - @deprecated_active_rules = Internal.qprofile_loader.countDeprecatedActiveRulesByProfile(@profile.getKey()) - @stats = Internal.qprofile_loader.getStatsByProfile(@profile.getKey()) - set_profile_breadcrumbs - else - # SONAR-5630 - flash[:error] = message('quality_profiles.deleted_profile', :params => params[:key]) - redirect_to :controller => 'profiles', :action => 'index' - end - end - end - - # GET /profiles/create_form?language= - def create_form - require_parameters 'language' - render :partial => 'profiles/create_form', :locals => {:language_key => params[:language]} - end - - # POST /profiles/create?name=&language=&[backup=] - def create - verify_post_request - call_backend do - files_by_key = {} - if params[:backup] - params[:backup].each_pair do |importer_key, file| - unless file.blank? - files_by_key[importer_key] = Api::Utils.read_post_request_param(file) - end - end - end - profile_name = Java::OrgSonarServerQualityprofile::QProfileName.new(params[:language], params[:name]) - result = Internal.qprofile_service.create(profile_name, files_by_key) - flash[:notice] = message('quality_profiles.profile_x_created', :params => result.profile().getName()) - flash_result(result) - end - redirect_to :action => 'index' - end - - # Modal window to restore built-in profiles - # GET /profiles/restore_built_in_form/ - def restore_built_in_form - verify_ajax_request - require_parameters 'language' - @language = java_facade.getLanguages().find { |l| l.getKey()==params[:language].to_s } - call_backend do - @builtin_profile_names = Internal.qprofile_service.builtInProfileNamesForLanguage(params[:language].to_s) - end - render :partial => 'profiles/restore_built_in_form' - end - - # POST /profiles/restore_built_in?language= - def restore_built_in - verify_post_request - require_parameters 'language' - call_backend do - Internal.qprofile_service.restoreBuiltInProfilesForLanguage(params[:language].to_s) - end - redirect_to :action => 'index' - end - - # POST /profiles/delete/ - def delete - verify_post_request - require_parameters 'id' - - profile_key = profile_id_to_key(params[:id].to_i) - call_backend do - Internal.qprofile_service.delete(profile_key) - end - - redirect_to(:controller => 'profiles', :action => 'index') - end - - - # POST /profiles/set_as_default/ - def set_as_default - verify_post_request - require_parameters 'id' - - profile_key = profile_id_to_key(params[:id].to_i) - call_backend do - Internal.qprofile_service.setDefault(profile_key) - end - redirect_to :action => 'index' - end - - - # GET /profiles/copy_form/ - def copy_form - require_parameters 'id' - - profile_id = params[:id].to_i - call_backend do - @profile = Internal.quality_profiles.profile(profile_id) - end - not_found('Profile not found') unless @profile - - render :partial => 'profiles/copy_form' - end - - # POST /profiles/copy/?name=[&overwrite=] - def copy - verify_post_request - verify_ajax_request - require_parameters 'id' - - source_id = params[:id].to_i - source_profile = Internal.quality_profiles.profile(source_id) - - source_key=profile_id_to_key(source_id) - target_name = params['name'] - - overwrite = (params['overwrite'] == target_name) - target_profile = nil - - unless overwrite - target_profile = Internal.quality_profiles.profile(target_name, source_profile.language()) - end - - if target_profile.nil? || overwrite - call_backend do - Internal.qprofile_service.copyToName(source_key, target_name) - if overwrite - flash[:notice] = message('quality_profiles.copy_x_overwritten', :params => target_name) - else - flash[:notice] = message('quality_profiles.profile_x_not_activated', :params => target_name) - end - render :text => 'ok', :status => 200 - end - else - render :text => message('quality_profiles.copy_overwrite_x', :params => target_name), :status => 409 - end - end - - # the backup action is allow to non-admin users : see http://jira.codehaus.org/browse/SONAR-2039 - def backup - verify_post_request - require_parameters 'key' - - profile_key=params[:key] - call_backend do - xml = Internal.qprofile_service.backup(profile_key) - send_data(xml, :type => 'text/xml', :disposition => "attachment; filename=#{profile_key}.xml") - end - end - - - # Modal window to restore profile backup - # GET /profiles/restore_form/ - def restore_form - verify_ajax_request - render :partial => 'profiles/restore_form' - end - - # POST /profiles/restore?backup= - def restore - if params[:backup].blank? - flash[:warning] = message('quality_profiles.please_upload_backup_file') - else - call_backend do - xml=Api::Utils.read_post_request_param(params[:backup]) - Internal.qprofile_service.restore(xml) - end - end - redirect_to :action => 'index' - end - - - # GET /profiles/export?name=&language=&format - def export - language = params[:language] - if params[:name].blank? - profile = Internal.qprofile_service.getDefault(language) - else - profile = Internal.qprofile_loader.getByLangAndName(language, CGI::unescape(params[:name])) - end - not_found('Profile not found') unless profile - - if params[:format].blank? - # standard sonar format - result = Internal.qprofile_service.backup(profile.getKee()) - send_data(result, :type => 'text/xml', :disposition => 'inline') - else - exporter_key = params[:format] - result = Internal.qprofile_exporters.export(profile.getKee(), exporter_key) - send_data(result, :type => Internal.qprofile_exporters.mimeType(exporter_key), :disposition => 'inline') - end - end - - # GET /profiles/inheritance?id= - def inheritance - require_parameters 'id' - - call_backend do - @profile = Internal.quality_profiles.profile(params[:id].to_i) - not_found('Profile not found') unless @profile - @parent = Internal.quality_profiles.parent(@profile) if @profile.parent - @ancestors = Internal.quality_profiles.ancestors(@profile).to_a - @children = Internal.quality_profiles.children(@profile).to_a - profiles = Internal.quality_profiles.profilesByLanguage(@profile.language()).to_a.reject { |p| p.id == @profile.id() || p.parent() == @profile.name() } - profiles = Api::Utils.insensitive_sort(profiles) { |p| p.name() } - @select_parent = [[message('none'), nil]] + profiles.collect { |profile| [profile.name(), profile.id()] } - - @all_profile_stats = Internal.qprofile_loader.getAllProfileStats() - end - set_profile_breadcrumbs end - # POST /profiles/change_parent?id=&parent_id= - def change_parent - verify_post_request - access_denied unless has_role?(:profileadmin) - require_parameters 'id' - - profile_key = profile_id_to_key(params[:id].to_i) - parent_key = profile_id_to_key(params[:parent_id].to_i) unless params[:parent_id].empty? - call_backend do - Internal.qprofile_service.setParent(profile_key, parent_key) - end - redirect_to :action => 'inheritance', :id => params[:id] - end - - # GET /profiles/changelog?key= - def changelog - require_parameters 'key' - - @profile = Internal.qprofile_loader.getByKey(params[:key]) - not_found('Quality profile does not exist') unless @profile - search = {'profileKey' => @profile.key().to_s, 'since' => params[:since], 'to' => params[:to], 'p' => params[:p]} - result = Internal.component(Java::OrgSonarServerActivity::RubyQProfileActivityService.java_class).search(search) - @changes = result.activities - @paging = result.paging - - set_profile_breadcrumbs - end - - # - # - # GET /profiles/permalinks?id= - # - # - def permalinks - require_parameters 'id' - @profile = Internal.quality_profiles.profile(params[:id].to_i) - not_found('Profile not found') unless @profile - set_profile_breadcrumbs - end - - - # - # - # GET /profiles/projects/ - # - # - def projects - require_parameters 'id' - - call_backend do - @profile = Internal.quality_profiles.profile(params[:id].to_i) - not_found('Profile not found') unless @profile - projects = Internal.quality_profiles.projects(params[:id].to_i) - @projects = Api::Utils.insensitive_sort(projects.to_a) { |p| p.name } - set_profile_breadcrumbs - end - end - - - # POST /profiles/add_project?id=&project= - def add_project - verify_post_request - require_parameters 'id', 'project' - - project_id = Api::Utils.project_id(params[:project]) - profile_id = params[:id].to_i - - call_backend do - Internal.quality_profiles.addProject(profile_id, project_id.to_i) - end - redirect_to :action => 'projects', :id => profile_id - end - - # POST /profiles/remove_project?id=&project= - def remove_project - verify_post_request - require_parameters 'id', 'project' - - profile_id = params[:id].to_i - call_backend do - Internal.quality_profiles.removeProject(profile_id, params[:project].to_i) - end - redirect_to :action => 'projects', :id => profile_id - end - - # POST /profiles/remove_projects?id= - def remove_projects - verify_post_request - require_parameters 'id' - - profile_id = params[:id].to_i - call_backend do - Internal.quality_profiles.removeAllProjects(profile_id) - end - redirect_to :action => 'projects', :id => profile_id - end - - # GET /profiles/rename_form?id= - def rename_form - require_parameters 'id' - call_backend do - @profile = Internal.quality_profiles.profile(params[:id].to_i) - not_found('Profile not found') unless @profile - end - render :partial => 'profiles/rename_form' - end - - # POST /profiles/rename?id=&name= - def rename - verify_post_request - verify_ajax_request - require_parameters 'id' - - call_backend do - profile_key = profile_id_to_key(params[:id].to_i) - Internal.qprofile_service.rename(profile_key, params[:new_name]) - end - render :text => 'ok', :status => 200 - end - - # GET /profiles/compare?id1=&id2= - def compare - @profiles = Profile.all(:order => 'language asc, name') - id1 = params[:id1] - id2 = params[:id2] - if id1.present? && id2.present? && id1.respond_to?(:to_i) && id2.respond_to?(:to_i) - @id1 = params[:id1].to_i - @id2 = params[:id2].to_i - @profile1 = Profile.find(id1) - @profile2 = Profile.find(id2) - - arules1 = ActiveRule.all(:include => [{:active_rule_parameters => :rules_parameter}, :rule], - :conditions => ['active_rules.profile_id=?', @profile1.id]) - arules2 = ActiveRule.all(:order => 'rules.plugin_name, rules.plugin_rule_key', :include => [{:active_rule_parameters => :rules_parameter}, :rule], - :conditions => ['active_rules.profile_id=?', @profile2.id]) - - arules1.reject! { |arule| arule.rule.removed? } - arules2.reject! { |arule| arule.rule.removed? } - - diffs_by_rule={} - arules1.each do |arule1| - diffs_by_rule[arule1.rule]||=RuleDiff.new(arule1.rule) - diffs_by_rule[arule1.rule].arule1=arule1 - end - arules2.each do |arule2| - diffs_by_rule[arule2.rule]||=RuleDiff.new(arule2.rule) - diffs_by_rule[arule2.rule].arule2=arule2 - end - @in1=[] - @in2=[] - @modified=[] - @sames=[] - diffs_by_rule.values.sort.each do |diff| - case diff.status - when DIFF_IN1 then - @in1<(other) - rule.name()<=>other.rule.name - end - end - - # - # Remove active rules that are identical in both collections (same severity and same parameters) - # and return a map with results {:added => X, :removed => Y, :modified => Z, - # :rules => {rule1 => [activeruleleft1, activeruleright1], rule2 => [activeruleleft2, nil], ...]} - # Assume both collections are ordered by rule key - # - def compute_diff(arules1, arules2) - rules = {} - removed = 0 - added = 0 - modified = 0 - same = 0 - begin - diff = false - #take first item of each collection - active_rule1 = arules1.first - active_rule2 = arules2.first - if active_rule1 != nil and active_rule2 != nil - order = active_rule1.rule.key <=> active_rule2.rule.key - if order < 0 - active_rule2 = nil - rule = active_rule1.rule - diff = true - removed = removed +1 - elsif order > 0 - active_rule1 = nil - rule = active_rule2.rule - diff = true - added = added +1 - else - rule = active_rule1.rule # = active_rule2.rule - #compare severity - diff = true if active_rule1.priority != active_rule2.priority - #compare parameters - rule.parameters.each do |param| - diff = true if active_rule1.value(param.id) != active_rule2.value(param.id) - end - if diff - modified = modified + 1 - else - same = same +1 - end - end - elsif active_rule1 != nil - #no more rule in right collection - diff = true - removed = removed +1 - rule = active_rule1.rule - elsif active_rule2 != nil - #no more rule in left collection - diff = true - added = added +1 - rule = active_rule2.rule - end - # remove processed rule(s) - arules1 = arules1.drop(1) if active_rule1 != nil - arules2 = arules2.drop(1) if active_rule2 != nil - if diff - rules[rule] = [active_rule1, active_rule2] - end - end while !arules1.empty? || !arules2.empty? - return {:same => same, :added => added, :removed => removed, :modified => modified, :rules => rules} - end - - def flash_messages(messages) - # only 4 messages are kept each time to avoid cookie overflow. - if messages.hasErrors() - flash[:error]=messages.getErrors().to_a[0...4].join('
    ') - end - if messages.hasWarnings() - flash[:warning]=messages.getWarnings().to_a[0...4].join('
    ') - end - if messages.hasInfos() - flash[:notice]=messages.getInfos().to_a[0...4].join('
    ') - end - end - - def flash_result(result) - # only 4 messages are kept each time to avoid cookie overflow. - unless result.infos.empty? - flash[:notice] += '
    ' + result.infos.to_a[0...4].join('
    ') - end - unless result.warnings.empty? - flash[:warning] = result.warnings.to_a[0...4].join('
    ') - end - - end - - def set_profile_breadcrumbs - add_breadcrumbs ProfilesController::root_breadcrumb, {:name => "#{@profile.name} (#{Api::Utils.language_name(@profile.language)})"} + def show + render :action => 'index' end - def profile_id_to_key(profile_id) - profile = Profile.find(profile_id) - not_found('Profile not found') unless profile - profile.kee - end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/quality_profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/quality_profiles_controller.rb deleted file mode 100644 index 3c84dc757c5..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/quality_profiles_controller.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -class QualityProfilesController < ApplicationController - - SECTION=Navigation::SECTION_QUALITY_PROFILES - - def index - - end - - def show - render :action => 'index' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_copy_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_copy_form.html.erb new file mode 100644 index 00000000000..0205415bb39 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_copy_form.html.erb @@ -0,0 +1,42 @@ +
    + +
    + +
    +
    + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_create_form.html.erb new file mode 100644 index 00000000000..2e006597e9c --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_create_form.html.erb @@ -0,0 +1,35 @@ +<% + language = controller.java_facade.getLanguages().find { |l| l.getKey()==language_key } + importers = Internal.component(Java::OrgSonarServerQualityprofile::QProfileExporters.java_class).findProfileImportersForLanguage(language_key) +%> +
    +
    + + + + + + + +
    +
    + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_diff_rule.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_diff_rule.html.erb new file mode 100644 index 00000000000..36ae86f612a --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_diff_rule.html.erb @@ -0,0 +1,6 @@ + + + + <%= h(arule.rule.name) -%> + +<%= h(arule.rule.plugin_name) -%> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_new.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_new.html.erb new file mode 100644 index 00000000000..bb170e96ff5 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_new.html.erb @@ -0,0 +1,56 @@ +
    +<% form_tag({:action => 'create'}, {:multipart => true, :id => 'form_create_profile'}) do -%> + + + + + + + + + +
    + <%= message('name') -%> + + +
    + <%= message('language') -%> + + <% languages_select=languages.collect do |language| + [language.getName(), language.getKey()] + end + %> + <%= select_tag :language, options_for_select(languages_select), :onClick => 'changeLanguage();' %> +
    + + <% languages.each do |language| %> + <% if @plugins_by_language[language.getKey()] %> + + <% @plugins_by_language[language.getKey()].each do |plugin| %> + + + + + <% end %> + + <% end %> + <% end %> + + + + + +
    + <%= submit_tag message('create') %> + <%= message('cancel') -%> +
    +<% end %> +
    + + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_rename_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_rename_form.html.erb new file mode 100644 index 00000000000..823859f3d7e --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_rename_form.html.erb @@ -0,0 +1,25 @@ +
    + +
    + + + +
    +
    + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_restore_built_in_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_restore_built_in_form.html.erb new file mode 100644 index 00000000000..96a4477a407 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_restore_built_in_form.html.erb @@ -0,0 +1,21 @@ +
    +
    + + + + + + + +
    +
    + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_restore_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_restore_form.html.erb new file mode 100644 index 00000000000..4ea22e736bc --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_restore_form.html.erb @@ -0,0 +1,21 @@ +
    +
    + + + + + + +
    +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_tabs.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_tabs.html.erb new file mode 100644 index 00000000000..3d6e5d8d68c --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/_tabs.html.erb @@ -0,0 +1,26 @@ +<% + new_tab = nil unless defined?(:new_tab) + selected_tab = nil unless defined?(:selected_tab) +%> + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/changelog.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/changelog.html.erb new file mode 100644 index 00000000000..1f81c67c241 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/changelog.html.erb @@ -0,0 +1,81 @@ +
    + +<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'changelog'} %> + +
    +
    + + <%= message('quality_profiles.changelog_from') -%> + + <%= message('to').downcase -%> + + +
    + + <% if @changes.empty? %> + <%= message('quality_profiles.changelog.empty') -%> + <% else %> + + + + + + + + + + + + + <% + @changes.each do |change| + %> + + <% + action = change.getAction() + action_message = message('quality_profiles.changelog.' + action.downcase) if action + + if change.authorName() && !change.authorName().empty?() + author = change.authorName() + elsif change.login() && !change.getLogin().empty?() + author = change.getLogin() + else + author = 'System' + end + rule = change.ruleName() ? change.ruleName() : change.ruleKey() + %> + + + + + + + <% end %> + + <%= paginate_java(@paging, :colspan => 5, :include_loading_icon => true) { |label, page_id| + link_to(label, params.merge({:p => page_id}), :style => 'text-decoration:underline') + } + %> +
    <%= message('date') -%><%= message('user') -%><%= message('action') -%><%= message('rule') -%><%= message('parameters') -%>
    <%= Internal.i18n.formatDateTime(change.getCreatedAt()) -%><%= author %><%= action_message %><%= rule %> + <% if change.severity() %> + <%= message('quality_profiles.severity_set_to_x', :params => ["", change.severity()]) -%> +
    + <% end %> + <% change.parameters().each do |param_key, param_value| %> + <% unless param_value.empty? %> + <%= message('quality_profiles.parameter_set_to_x', :params => [param_key, param_value]) -%> + <% else %> + <%= message('quality_profiles.changelog.parameter_reset_to_default_value_x', :params => [param_key]) -%> + <% end %> +
    + <% end %> +
    + + <% end %> +
    +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/compare.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/compare.html.erb new file mode 100644 index 00000000000..00d2bf2a137 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/compare.html.erb @@ -0,0 +1,150 @@ +
    + + +
    + + + + +
    + +<% if @profile1 && @profile2 %> + + + + + + + + +
    +

    <%= message('quality_profiles.only_in_profile_x', :params => h(@profile1.name)) -%>

    + <%= @in1.size -%> <%= message('rules').downcase -%> +
    +

    <%= message('quality_profiles.only_in_profile_x', :params => h(@profile2.name)) -%>

    + <%= @in2.size -%> <%= message('rules').downcase -%> +
    +

    <%= message('quality_profiles.with_different_configuration') -%>

    + <%= @modified.size -%> <%= message('rules').downcase -%> +
    +

    <%= message('quality_profiles.with_same_configuration') -%>

    + <%= @sames.size -%> <%= message('rules').downcase -%> +
    + + + + + <% unless @in1.empty? %> + + + + + + <% end %> + + <% unless @in2.empty? %> + + + + + + <% end %> + + + <% unless @modified.empty? %> + + + + <% end %> + +
    + + + + + + + <% @in1.each do |diff| %> + + + + <% end %> +
    <%= message('quality_profiles.x_rules_only_in', :params => @in1.size) %> + <%= h @profile1.name %> +
    + <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule1, :aprofile => @profile1} %> +
    +
    + + + + + + + <% @in2.each do |diff| %> + + + + <% end %> +
    <%= message('quality_profiles.x_rules_only_in', :params => @in2.size) %> + <%= h @profile2.name %> +
    + <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule2, :aprofile => @profile2} %> +
    +
    + + + + + + + + + <% @modified.each do |diff| + td_css=cycle('even', 'odd', :name => 'modified') + %> + + + + + + <% end %> +
    <%= message('quality_profiles.x_rules_have_different_configuration', :params =>@modified.size) -%>
    +
    <%= h @profile1.name %> +
    +
    <%= h @profile2.name %> +
    + <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule1, :aprofile => @profile1} %> + <% if diff.removed_params && !diff.removed_params.empty? %> +
      + <% diff.removed_params.each do |parameter| %> +
    • <%= h(parameter.name) -%>: + <%= parameter.value.gsub(',', ', ') -%>
    • + <% end %> +
    + <% end %> +
    + <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule2, :aprofile => @profile2} %> + <% if diff.added_params && !diff.added_params.empty? %> +
      + <% diff.added_params.each do |parameter| %> +
    • <%= h(parameter.name) -%>: + <%= parameter.value.gsub(',', ', ') -%>
    • + <% end %> +
    + <% end %> +
    +
    +<% end %> +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/edit.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/edit.html.erb new file mode 100644 index 00000000000..b96cabb758f --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/edit.html.erb @@ -0,0 +1,20 @@ +

    message('quality_profiles.editing_profile')

    + +<% form_for(@profile) do |f| %> + <%= f.error_messages %> + +

    + <%= f.label :name %>
    + <%= f.text_field :name %> +

    +

    + <%= f.label :active %>
    + <%= f.check_box :active %> +

    +

    + <%= f.submit message('update_verb') %> +

    +<% end %> + +<%= link_to message('show_verb'), @profile %> | +<%= link_to message('back'), profiles_path %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/index.html.erb new file mode 100644 index 00000000000..c499adf0d9f --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/index.html.erb @@ -0,0 +1,133 @@ +
    + + + +<% + Api::Utils.insensitive_sort(languages){|l| l.getName()}.each do |language| + default_profile = Internal.component(Java::OrgSonarServerQualityprofile::QProfileService.java_class).getDefault(language.getKey()) +%> +
    + <% if profiles_administrator? %> + + + <% end %> +

    <%= message('quality_profiles.x_language_profiles', :params => language.getName()) -%>

    +
    + + + + + + + + + <% if profiles_administrator? %> + + <% end %> + + + + <% @profiles.select { |p| p.language == language.getKey() }.each do |profile| + projects_count = projects_count(profile) + is_default_profile = default_profile && default_profile.key()==profile.key() + %> + + + + + + + + + + + <% if profiles_administrator? %> + + + + + + <% end %> + + <% end %> + +
    <%= message('name') -%><%= message('rules') -%><%= message('projects') -%><%= message('default') -%><%= message('operations') -%>
    + <%= h profile.name() -%> + + <% + rules_tooltip = message('quality_profiles.see_rules_tooltip_x_profile', :params => [profile.name()]) + rules_tooltip = message('quality_profiles.manage_rules_tooltip_x_profile', :params => [profile.name()]) if profiles_administrator? + %> + " + title="<%= rules_tooltip %>"> + + <%= @active_rule_counts[profile.key()] || 0 -%> + + + + <% unless is_default_profile %> + <%= projects_count -%> + <% end %> + + <% if !is_default_profile && profiles_administrator? %> + <%= link_to_action message('set_as_default'), "#{ApplicationController.root_context}/old_profiles/set_as_default?id=#{profile.id()}", + :id => "activate_#{profile.key().parameterize}", + :class => 'link-action', + :confirm_title => message('set_as_default'), + :confirm_msg => message('quality_profiles.are_you_sure_want_x_profile_as_default', :params => [profile.name()]), + :confirm_button => message('set_as_default') + -%> + <% end %> + <% if is_default_profile %> + + <% end %> + +
    + + <%= message('backup_verb') -%> +
    +
    + <%= message('rename') -%> + + <%= message('copy') -%> + + <% if !is_default_profile %> + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/old_profiles/delete/#{profile.id()}", + :class => 'link-action link-red', + :id => "delete_#{profile.key().parameterize}", + :confirm_button => message('delete'), + :confirm_title => 'quality_profiles.delete_confirm_title', + :confirm_msg => 'quality_profiles.are_you_sure_want_delete_profile_x_and_descendants', + :confirm_msg_params => [profile.name()] + -%> + <% end %> +
    +

    +<% end %> +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/inheritance.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/inheritance.html.erb new file mode 100644 index 00000000000..167b0514725 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/inheritance.html.erb @@ -0,0 +1,54 @@ +
    + + +<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'inheritance'} %> + +
    + + + + + <% if profiles_administrator? %> + + <% end %> + +
    +
    + <% @ancestors.reverse.each do |parent| %> + <%= parent.name() -%> + (<%= label_for_rules_count(parent, @all_profile_stats) -%>)
    + <%= image_tag 'blue-up.png' -%>
    + <% end %> + + <%= @profile.name -%> (<%= label_for_rules_count(@profile, @all_profile_stats) -%>)
    + + <% if @children.size>0 %> + <%= image_tag 'blue-up.png' -%>
    + <% @children.each_with_index do |child,index| %> + <%= ', ' if index>0 -%> + <%= child.name() -%> + (<%= label_for_rules_count(child, @all_profile_stats) -%>) + <% end %> +
    <%= image_tag 'blue-up.png' -%>
    + ... + <% end %> +
    +
    +
    +

    <%= message('quality_profiles.set_parent') -%>:

    +

    <%= message('quality_profiles.inherit_rules_from_profile') -%>:

    + <% form_tag({:action => 'change_parent'}, {:method => 'post'}) do %> + <%= hidden_field_tag "id", @profile.id() %> + <%= select_tag "parent_id", options_for_select(@select_parent, (@parent.id() if @parent)) %> + <%= submit_tag message('change_verb'), :id => 'submit_parent'%> + <% end %> +
    +
    + +
    +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/new.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/new.html.erb new file mode 100644 index 00000000000..7706b78162b --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/new.html.erb @@ -0,0 +1,19 @@ +

    <%= message('quality_profiles.new_profile') -%>

    + +<% form_for(@profile) do |f| %> + <%= f.error_messages %> + +

    + <%= f.label :name %>
    + <%= f.text_field :name %> +

    +

    + <%= f.label :active %>
    + <%= f.check_box :active %> +

    +

    + <%= f.submit message('create') %> +

    +<% end %> + +<%= link_to message('back'), profiles_path %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/permalinks.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/permalinks.html.erb new file mode 100644 index 00000000000..8eb479138dd --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/permalinks.html.erb @@ -0,0 +1,39 @@ +
    + + +<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'Permalinks'} %> + +
    + <% exporters = Internal.qprofile_exporters.exportersForLanguage(@profile.language()) %> +
    + + + + + + + <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %> + + + + + <% end %> + + +
    +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/projects.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/projects.html.erb new file mode 100644 index 00000000000..66467b695cf --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/projects.html.erb @@ -0,0 +1,93 @@ +
    + + +<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab => 'Projects'} %> + +
    + <% if profiles_administrator? %> +
    + + + Add project: <%= resource_select_tag 'project', { + :qualifiers => ['TRK'], + :width => '400px', + :html_id => "select-project", + } -%> + +
    + + <% unless @projects.empty? %> + + + + + + + + + <% @projects.each do |project| %> + + + + + <% end %> + + + + + + +
    + <%= link_to_action message('quality_profiles.remove_project_action'), + "#{ApplicationController.root_context}/old_profiles/remove_project?id=#{@profile.id}&project=#{project.id}", + :class => 'link-action', + :id => "link-remove-#{project.key.parameterize}", + :confirm_title => 'quality_profiles.remove_project_confirm_title', + :confirm_button => 'quality_profiles.remove_project_confirm_button', + :confirm_msg => 'quality_profiles.remove_project_confirm_message', + :confirm_msg_params => [project.name] + -%> + <%= h project.name -%> <%= h project.key -%>
    + <%= link_to_action message('quality_profiles.remove_projects_action'), + "#{ApplicationController.root_context}/old_profiles/remove_projects?id=#{@profile.id}", + :class => 'link-action', + :id => "link-remove-projects", + :confirm_title => 'quality_profiles.remove_projects_confirm_title', + :confirm_button => 'quality_profiles.remove_projects_confirm_button', + :confirm_msg => 'quality_profiles.remove_projects_confirm_message' + -%> +
    + <% end %> + <% else %> + + <% if @projects.empty? %> +

    <%= message('quality_profiles.no_projects_associated_to_profile_x', :params => @profile.name) -%>

    + <% else %> +

    <%= message('quality_profiles.projects_warning') -%>

    + + + + + + + + + <% @projects.each do |project| %> + + + + <% end %> + +
    <%= h project.name -%> <%= h project.key -%>
    + <% end %> + <% end %> +
    +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/show.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/show.html.erb new file mode 100644 index 00000000000..677e6bb1475 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/old_profiles/show.html.erb @@ -0,0 +1,80 @@ +
    + + + <%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'Rules'} %> + +
    + <% active_rules = @stats.get('countActiveRules').get(0).getValue() if @stats && @stats.get('countActiveRules') %> + <% active_rules ||= 0 %> + +
    +
    +
    + <%= message('rules') -%> + + <% tooltip = message('quality_profiles.see_rules_tooltip') + tooltip = message('quality_profiles.manage_rules_tooltip') if profiles_administrator? + %> + " + title="<%= tooltip %>"> + <%= active_rules -%> + + + +
    + <% if @deprecated_active_rules > 0 %> +
    + <%= message('quality_profiles.including') %> " + ><%= @deprecated_active_rules -%> <%= message('quality_profiles.deprecated') %> +
    + <% end %> +
    +
    + + <% if @stats + severity_stats = @stats.get('severity') + severity_map = Hash[ *severity_stats.collect { |v| [ v.getKey(), v ] }.flatten ] + + max = severity_stats.map { |val| val.getValue() }.max + %> +
    +
    + + + <% Severity::KEYS.each do |key| + stat = severity_map[key] + severity = key.downcase + value = 0 + value = stat.getValue() if stat + -%> + + + + + + <% end -%> + +
    + <%= message(severity) -%> + + " + class="widget-link"> + <%= value -%> + + + <% if max > 0 %> + <%= barchart(:width => 70, :percent => (100 * value / max).to_i) %> + <% end %> +
    +
    +
    + <% end -%> +
    +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_copy_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_copy_form.html.erb deleted file mode 100644 index 71520b05840..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_copy_form.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -
    - -
    - -
    -
    - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_create_form.html.erb deleted file mode 100644 index a003c054478..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_create_form.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -<% - language = controller.java_facade.getLanguages().find { |l| l.getKey()==language_key } - importers = Internal.component(Java::OrgSonarServerQualityprofile::QProfileExporters.java_class).findProfileImportersForLanguage(language_key) -%> -
    -
    - - - - - - - -
    -
    - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_diff_rule.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_diff_rule.html.erb deleted file mode 100644 index 36ae86f612a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_diff_rule.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - - - - <%= h(arule.rule.name) -%> - -<%= h(arule.rule.plugin_name) -%> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_new.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_new.html.erb deleted file mode 100644 index 529fae5ef3e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_new.html.erb +++ /dev/null @@ -1,56 +0,0 @@ -
    -<% form_tag({:action => 'create'}, {:multipart => true, :id => 'form_create_profile'}) do -%> - - - - - - - - - -
    - <%= message('name') -%> - - -
    - <%= message('language') -%> - - <% languages_select=languages.collect do |language| - [language.getName(), language.getKey()] - end - %> - <%= select_tag :language, options_for_select(languages_select), :onClick => 'changeLanguage();' %> -
    - - <% languages.each do |language| %> - <% if @plugins_by_language[language.getKey()] %> - - <% @plugins_by_language[language.getKey()].each do |plugin| %> - - - - - <% end %> - - <% end %> - <% end %> - - - - - -
    - <%= submit_tag message('create') %> - <%= message('cancel') -%> -
    -<% end %> -
    - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_rename_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_rename_form.html.erb deleted file mode 100644 index cf0f9053583..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_rename_form.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
    - -
    - - - -
    -
    - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_restore_built_in_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_restore_built_in_form.html.erb deleted file mode 100644 index b483ce1ad51..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_restore_built_in_form.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -
    -
    - - - - - - - -
    -
    - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_restore_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_restore_form.html.erb deleted file mode 100644 index 8fcae1336f2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_restore_form.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -
    -
    - - - - - - -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb deleted file mode 100644 index d11fd395eb8..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<% - new_tab = nil unless defined?(:new_tab) - selected_tab = nil unless defined?(:selected_tab) -%> - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb deleted file mode 100644 index f807ae791c2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb +++ /dev/null @@ -1,81 +0,0 @@ -
    - -<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'changelog'} %> - -
    -
    - - <%= message('quality_profiles.changelog_from') -%> - - <%= message('to').downcase -%> - - -
    - - <% if @changes.empty? %> - <%= message('quality_profiles.changelog.empty') -%> - <% else %> - - - - - - - - - - - - - <% - @changes.each do |change| - %> - - <% - action = change.getAction() - action_message = message('quality_profiles.changelog.' + action.downcase) if action - - if change.authorName() && !change.authorName().empty?() - author = change.authorName() - elsif change.login() && !change.getLogin().empty?() - author = change.getLogin() - else - author = 'System' - end - rule = change.ruleName() ? change.ruleName() : change.ruleKey() - %> - - - - - - - <% end %> - - <%= paginate_java(@paging, :colspan => 5, :include_loading_icon => true) { |label, page_id| - link_to(label, params.merge({:p => page_id}), :style => 'text-decoration:underline') - } - %> -
    <%= message('date') -%><%= message('user') -%><%= message('action') -%><%= message('rule') -%><%= message('parameters') -%>
    <%= Internal.i18n.formatDateTime(change.getCreatedAt()) -%><%= author %><%= action_message %><%= rule %> - <% if change.severity() %> - <%= message('quality_profiles.severity_set_to_x', :params => ["", change.severity()]) -%> -
    - <% end %> - <% change.parameters().each do |param_key, param_value| %> - <% unless param_value.empty? %> - <%= message('quality_profiles.parameter_set_to_x', :params => [param_key, param_value]) -%> - <% else %> - <%= message('quality_profiles.changelog.parameter_reset_to_default_value_x', :params => [param_key]) -%> - <% end %> -
    - <% end %> -
    - - <% end %> -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb deleted file mode 100644 index 54051821fc1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb +++ /dev/null @@ -1,150 +0,0 @@ -
    - - -
    - - - - -
    - -<% if @profile1 && @profile2 %> - - - - - - - - -
    -

    <%= message('quality_profiles.only_in_profile_x', :params => h(@profile1.name)) -%>

    - <%= @in1.size -%> <%= message('rules').downcase -%> -
    -

    <%= message('quality_profiles.only_in_profile_x', :params => h(@profile2.name)) -%>

    - <%= @in2.size -%> <%= message('rules').downcase -%> -
    -

    <%= message('quality_profiles.with_different_configuration') -%>

    - <%= @modified.size -%> <%= message('rules').downcase -%> -
    -

    <%= message('quality_profiles.with_same_configuration') -%>

    - <%= @sames.size -%> <%= message('rules').downcase -%> -
    - - - - - <% unless @in1.empty? %> - - - - - - <% end %> - - <% unless @in2.empty? %> - - - - - - <% end %> - - - <% unless @modified.empty? %> - - - - <% end %> - -
    - - - - - - - <% @in1.each do |diff| %> - - - - <% end %> -
    <%= message('quality_profiles.x_rules_only_in', :params => @in1.size) %> - <%= h @profile1.name %> -
    - <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule1, :aprofile => @profile1} %> -
    -
    - - - - - - - <% @in2.each do |diff| %> - - - - <% end %> -
    <%= message('quality_profiles.x_rules_only_in', :params => @in2.size) %> - <%= h @profile2.name %> -
    - <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule2, :aprofile => @profile2} %> -
    -
    - - - - - - - - - <% @modified.each do |diff| - td_css=cycle('even', 'odd', :name => 'modified') - %> - - - - - - <% end %> -
    <%= message('quality_profiles.x_rules_have_different_configuration', :params =>@modified.size) -%>
    -
    <%= h @profile1.name %> -
    -
    <%= h @profile2.name %> -
    - <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule1, :aprofile => @profile1} %> - <% if diff.removed_params && !diff.removed_params.empty? %> -
      - <% diff.removed_params.each do |parameter| %> -
    • <%= h(parameter.name) -%>: - <%= parameter.value.gsub(',', ', ') -%>
    • - <% end %> -
    - <% end %> -
    - <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule2, :aprofile => @profile2} %> - <% if diff.added_params && !diff.added_params.empty? %> -
      - <% diff.added_params.each do |parameter| %> -
    • <%= h(parameter.name) -%>: - <%= parameter.value.gsub(',', ', ') -%>
    • - <% end %> -
    - <% end %> -
    -
    -<% end %> -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/edit.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/edit.html.erb deleted file mode 100644 index b96cabb758f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/edit.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -

    message('quality_profiles.editing_profile')

    - -<% form_for(@profile) do |f| %> - <%= f.error_messages %> - -

    - <%= f.label :name %>
    - <%= f.text_field :name %> -

    -

    - <%= f.label :active %>
    - <%= f.check_box :active %> -

    -

    - <%= f.submit message('update_verb') %> -

    -<% end %> - -<%= link_to message('show_verb'), @profile %> | -<%= link_to message('back'), profiles_path %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 9c8488a8835..3084e764ef1 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -1,133 +1,5 @@ -
    - - - -<% - Api::Utils.insensitive_sort(languages){|l| l.getName()}.each do |language| - default_profile = Internal.component(Java::OrgSonarServerQualityprofile::QProfileService.java_class).getDefault(language.getKey()) -%> -
    - <% if profiles_administrator? %> - - - <% end %> -

    <%= message('quality_profiles.x_language_profiles', :params => language.getName()) -%>

    -
    - - - - - - - - - <% if profiles_administrator? %> - - <% end %> - - - - <% @profiles.select { |p| p.language == language.getKey() }.each do |profile| - projects_count = projects_count(profile) - is_default_profile = default_profile && default_profile.key()==profile.key() - %> - - - - - - - - - - - <% if profiles_administrator? %> - - - - - - <% end %> - - <% end %> - -
    <%= message('name') -%><%= message('rules') -%><%= message('projects') -%><%= message('default') -%><%= message('operations') -%>
    - <%= h profile.name() -%> - - <% - rules_tooltip = message('quality_profiles.see_rules_tooltip_x_profile', :params => [profile.name()]) - rules_tooltip = message('quality_profiles.manage_rules_tooltip_x_profile', :params => [profile.name()]) if profiles_administrator? - %> - " - title="<%= rules_tooltip %>"> - - <%= @active_rule_counts[profile.key()] || 0 -%> - - - - <% unless is_default_profile %> - <%= projects_count -%> - <% end %> - - <% if !is_default_profile && profiles_administrator? %> - <%= link_to_action message('set_as_default'), "#{ApplicationController.root_context}/profiles/set_as_default?id=#{profile.id()}", - :id => "activate_#{profile.key().parameterize}", - :class => 'link-action', - :confirm_title => message('set_as_default'), - :confirm_msg => message('quality_profiles.are_you_sure_want_x_profile_as_default', :params => [profile.name()]), - :confirm_button => message('set_as_default') - -%> - <% end %> - <% if is_default_profile %> - - <% end %> - -
    - - <%= message('backup_verb') -%> -
    -
    - <%= message('rename') -%> - - <%= message('copy') -%> - - <% if !is_default_profile %> - <%= link_to_action message('delete'), "#{ApplicationController.root_context}/profiles/delete/#{profile.id()}", - :class => 'link-action link-red', - :id => "delete_#{profile.key().parameterize}", - :confirm_button => message('delete'), - :confirm_title => 'quality_profiles.delete_confirm_title', - :confirm_msg => 'quality_profiles.are_you_sure_want_delete_profile_x_and_descendants', - :confirm_msg_params => [profile.name()] - -%> - <% end %> -
    -

    +<% content_for :script do %> + <% end %> -
    + +
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb deleted file mode 100644 index bb97f911286..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -
    - - -<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'inheritance'} %> - -
    - - - - - <% if profiles_administrator? %> - - <% end %> - -
    -
    - <% @ancestors.reverse.each do |parent| %> - <%= parent.name() -%> - (<%= label_for_rules_count(parent, @all_profile_stats) -%>)
    - <%= image_tag 'blue-up.png' -%>
    - <% end %> - - <%= @profile.name -%> (<%= label_for_rules_count(@profile, @all_profile_stats) -%>)
    - - <% if @children.size>0 %> - <%= image_tag 'blue-up.png' -%>
    - <% @children.each_with_index do |child,index| %> - <%= ', ' if index>0 -%> - <%= child.name() -%> - (<%= label_for_rules_count(child, @all_profile_stats) -%>) - <% end %> -
    <%= image_tag 'blue-up.png' -%>
    - ... - <% end %> -
    -
    -
    -

    <%= message('quality_profiles.set_parent') -%>:

    -

    <%= message('quality_profiles.inherit_rules_from_profile') -%>:

    - <% form_tag({:action => 'change_parent'}, {:method => 'post'}) do %> - <%= hidden_field_tag "id", @profile.id() %> - <%= select_tag "parent_id", options_for_select(@select_parent, (@parent.id() if @parent)) %> - <%= submit_tag message('change_verb'), :id => 'submit_parent'%> - <% end %> -
    -
    - -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/new.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/new.html.erb deleted file mode 100644 index 7706b78162b..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/new.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

    <%= message('quality_profiles.new_profile') -%>

    - -<% form_for(@profile) do |f| %> - <%= f.error_messages %> - -

    - <%= f.label :name %>
    - <%= f.text_field :name %> -

    -

    - <%= f.label :active %>
    - <%= f.check_box :active %> -

    -

    - <%= f.submit message('create') %> -

    -<% end %> - -<%= link_to message('back'), profiles_path %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb deleted file mode 100644 index 1115c25e20a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -
    - - -<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Permalinks'} %> - -
    - <% exporters = Internal.qprofile_exporters.exportersForLanguage(@profile.language()) %> -
    - - - - - - - <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %> - - - - - <% end %> - - -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb deleted file mode 100644 index 063c90027f1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb +++ /dev/null @@ -1,93 +0,0 @@ -
    - - -<%= render :partial => 'profiles/tabs', :locals => {:selected_tab => 'Projects'} %> - -
    - <% if profiles_administrator? %> -
    - - - Add project: <%= resource_select_tag 'project', { - :qualifiers => ['TRK'], - :width => '400px', - :html_id => "select-project", - } -%> - -
    - - <% unless @projects.empty? %> - - - - - - - - - <% @projects.each do |project| %> - - - - - <% end %> - - - - - - -
    - <%= link_to_action message('quality_profiles.remove_project_action'), - "#{ApplicationController.root_context}/profiles/remove_project?id=#{@profile.id}&project=#{project.id}", - :class => 'link-action', - :id => "link-remove-#{project.key.parameterize}", - :confirm_title => 'quality_profiles.remove_project_confirm_title', - :confirm_button => 'quality_profiles.remove_project_confirm_button', - :confirm_msg => 'quality_profiles.remove_project_confirm_message', - :confirm_msg_params => [project.name] - -%> - <%= h project.name -%> <%= h project.key -%>
    - <%= link_to_action message('quality_profiles.remove_projects_action'), - "#{ApplicationController.root_context}/profiles/remove_projects?id=#{@profile.id}", - :class => 'link-action', - :id => "link-remove-projects", - :confirm_title => 'quality_profiles.remove_projects_confirm_title', - :confirm_button => 'quality_profiles.remove_projects_confirm_button', - :confirm_msg => 'quality_profiles.remove_projects_confirm_message' - -%> -
    - <% end %> - <% else %> - - <% if @projects.empty? %> -

    <%= message('quality_profiles.no_projects_associated_to_profile_x', :params => @profile.name) -%>

    - <% else %> -

    <%= message('quality_profiles.projects_warning') -%>

    - - - - - - - - - <% @projects.each do |project| %> - - - - <% end %> - -
    <%= h project.name -%> <%= h project.key -%>
    - <% end %> - <% end %> -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/show.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/show.html.erb deleted file mode 100644 index f7fe266b8e3..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/show.html.erb +++ /dev/null @@ -1,80 +0,0 @@ -
    - - - <%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Rules'} %> - -
    - <% active_rules = @stats.get('countActiveRules').get(0).getValue() if @stats && @stats.get('countActiveRules') %> - <% active_rules ||= 0 %> - -
    -
    -
    - <%= message('rules') -%> - - <% tooltip = message('quality_profiles.see_rules_tooltip') - tooltip = message('quality_profiles.manage_rules_tooltip') if profiles_administrator? - %> - " - title="<%= tooltip %>"> - <%= active_rules -%> - - - -
    - <% if @deprecated_active_rules > 0 %> -
    - <%= message('quality_profiles.including') %> " - ><%= @deprecated_active_rules -%> <%= message('quality_profiles.deprecated') %> -
    - <% end %> -
    -
    - - <% if @stats - severity_stats = @stats.get('severity') - severity_map = Hash[ *severity_stats.collect { |v| [ v.getKey(), v ] }.flatten ] - - max = severity_stats.map { |val| val.getValue() }.max - %> -
    -
    - - - <% Severity::KEYS.each do |key| - stat = severity_map[key] - severity = key.downcase - value = 0 - value = stat.getValue() if stat - -%> - - - - - - <% end -%> - -
    - <%= message(severity) -%> - - " - class="widget-link"> - <%= value -%> - - - <% if max > 0 %> - <%= barchart(:width => 70, :percent => (100 * value / max).to_i) %> - <% end %> -
    -
    -
    - <% end -%> -
    -
    diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_profiles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_profiles/index.html.erb deleted file mode 100644 index 3084e764ef1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_profiles/index.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% content_for :script do %> - -<% end %> - -
    diff --git a/server/sonar-web/src/test/js/quality-profiles.js b/server/sonar-web/src/test/js/quality-profiles.js index 3a1d118178e..d5088ab82a5 100644 --- a/server/sonar-web/src/test/js/quality-profiles.js +++ b/server/sonar-web/src/test/js/quality-profiles.js @@ -29,7 +29,7 @@ lib.configureCasper(); casper.test.begin(testName('Should Show List'), 9, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -71,7 +71,7 @@ casper.test.begin(testName('Should Show List'), 9, function (test) { casper.test.begin(testName('Should Show Details'), 9, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -119,7 +119,7 @@ casper.test.begin(testName('Should Show Details'), 9, function (test) { casper.test.begin(testName('Should Show Inheritance Details'), 10, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/qualityprofiles/search', 'search-inheritance.json'); @@ -169,7 +169,7 @@ casper.test.begin(testName('Should Show Inheritance Details'), 10, function (tes casper.test.begin(testName('Should Show Selected Projects'), 2, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -214,7 +214,7 @@ casper.test.begin(testName('Should Show Selected Projects'), 2, function (test) casper.test.begin(testName('Copy Profile'), 5, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -272,7 +272,7 @@ casper.test.begin(testName('Copy Profile'), 5, function (test) { casper.test.begin(testName('Rename Profile'), 2, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); this.searchMock = lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -330,7 +330,7 @@ casper.test.begin(testName('Rename Profile'), 2, function (test) { casper.test.begin(testName('Make Profile Default'), 4, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); this.searchMock = lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -382,7 +382,7 @@ casper.test.begin(testName('Make Profile Default'), 4, function (test) { casper.test.begin(testName('Delete Profile'), 2, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); this.searchMock = lib.mockRequestFromFile('/api/qualityprofiles/search', 'search-with-copy.json'); @@ -437,7 +437,7 @@ casper.test.begin(testName('Delete Profile'), 2, function (test) { casper.test.begin(testName('Create Profile'), 2, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); this.searchMock = lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json'); @@ -492,7 +492,7 @@ casper.test.begin(testName('Create Profile'), 2, function (test) { casper.test.begin(testName('Restore Built-in Profiles'), 2, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); this.searchMock = lib.mockRequestFromFile('/api/qualityprofiles/search', 'search-modified.json'); @@ -546,7 +546,7 @@ casper.test.begin(testName('Restore Built-in Profiles'), 2, function (test) { casper.test.begin(testName('Change Parent'), 1, function (test) { casper - .start(lib.buildUrl('quality_profiles'), function () { + .start(lib.buildUrl('profiles'), function () { lib.setDefaultViewport(); this.searchMock = lib.mockRequestFromFile('/api/qualityprofiles/search', 'search-change-parent.json'); diff --git a/server/sonar-web/src/test/views/profiles.jade b/server/sonar-web/src/test/views/profiles.jade new file mode 100644 index 00000000000..e17181b0953 --- /dev/null +++ b/server/sonar-web/src/test/views/profiles.jade @@ -0,0 +1,5 @@ +extends layouts/main + +block body + #content + .search-navigator#quality-profiles diff --git a/server/sonar-web/src/test/views/quality_profiles.jade b/server/sonar-web/src/test/views/quality_profiles.jade deleted file mode 100644 index e17181b0953..00000000000 --- a/server/sonar-web/src/test/views/quality_profiles.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layouts/main - -block body - #content - .search-navigator#quality-profiles