<li {{#isActiveLink '/profiles'}}class="active"{{/isActiveLink}}>
<a href="{{link '/profiles'}}">{{t 'quality_profiles.page'}}</a>
</li>
- <li {{#isActiveLink '/old_profiles'}}class="active"{{/isActiveLink}}>
- <a href="{{link '/old_profiles'}}">OLD {{t 'quality_profiles.page'}}</a>
- </li>
<li {{#isActiveLink '/quality_gates'}}class="active"{{/isActiveLink}}>
<a href="{{link '/quality_gates'}}">{{t 'quality_gates.page'}}</a>
</li>
+++ /dev/null
-#
-# 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=<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=<language>
- def create_form
- require_parameters 'language'
- render :partial => 'old_profiles/create_form', :locals => {:language_key => params[:language]}
- end
-
- # POST /profiles/create?name=<profile name>&language=<language>&[backup=<file>]
- 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/<profile id>
- 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=<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/<id>
- 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/<id>
- 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/<profile id>
- 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/<id>?name=<name of new profile>[&overwrite=<name of overwritten profile>]
- 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/<profile id>
- def restore_form
- verify_ajax_request
- render :partial => 'old_profiles/restore_form'
- end
-
- # POST /profiles/restore?backup=<file>
- 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=<profile name>&language=<language>&format<exporter key>
- 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=<profile 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=<profile id>&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=<profile 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=<profile 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/<id>
- #
- #
- 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=<profile id>&project=<project id>
- 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=<profile id>&project=<project id>
- 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=<profile 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=<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=<id>&name=<new 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=<profile1 id>&id2=<profile2 id>
- 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<<diff
- when DIFF_IN2 then
- @in2<<diff
- when DIFF_MODIFIED then
- @modified<<diff
- when DIFF_SAME then
- @sames<<diff
- end
- end
- end
- add_breadcrumbs OldProfilesController::root_breadcrumb, Api::Utils.message('compare')
- end
-
- DIFF_IN1=1
- DIFF_IN2=2
- DIFF_MODIFIED=3
- DIFF_SAME=4
-
- private
-
- class RuleDiff
- attr_reader :rule, :removed_params, :added_params
- attr_accessor :arule1, :arule2
-
- def initialize(rule)
- @rule=rule
- end
-
- def status
- @status ||=
- begin
- if @arule1.nil?
- @status=(@arule2 ? DIFF_IN2 : nil)
- else
- if @arule2
- # compare severity and parameters
- @removed_params=[]
- @added_params=[]
- @rule.parameters.each do |param|
- v1=@arule1.value(param.id)
- v2=@arule2.value(param.id)
- if v1
- if v2
- if v1!=v2
- @removed_params<<@arule1.parameter(param.name)
- @added_params<<@arule2.parameter(param.name)
- end
- else
- @removed_params<<@arule1.parameter(param.name)
- end
- elsif v2
- @added_params<<@arule2.parameter(param.name)
- end
- end
- diff=(@arule1.priority!=@arule2.priority) || !@removed_params.empty? || !@added_params.empty?
- @status=(diff ? DIFF_MODIFIED : DIFF_SAME)
- else
- @status=DIFF_IN1
- end
- end
- end
- end
-
- def <=>(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('<br/>')
- end
- if messages.hasWarnings()
- flash[:warning]=messages.getWarnings().to_a[0...4].join('<br/>')
- end
- if messages.hasInfos()
- flash[:notice]=messages.getInfos().to_a[0...4].join('<br/>')
- end
- end
-
- def flash_result(result)
- # only 4 messages are kept each time to avoid cookie overflow.
- unless result.infos.empty?
- flash[:notice] += '<br/>' + result.infos.to_a[0...4].join('<br/>')
- end
- unless result.warnings.empty?
- flash[:warning] = result.warnings.to_a[0...4].join('<br/>')
- 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
+++ /dev/null
-<form id="copy-profile-form" method="post" action="old_profiles/copy">
- <input type="hidden" name="id" value="<%= @profile.id -%>"/>
- <fieldset>
- <div class="modal-head">
- <h2> <%= message('quality_profiles.copy_x_title', :params => [h @profile.name]) -%></h2>
- </div>
- <div class="modal-body">
- <div class="modal-error"/>
- <div class="modal-warning"/>
- <div class="modal-field">
- <label for="name"><%= message 'quality_profiles.copy_new_name' -%> <em class="mandatory">*</em></label>
- <input id="copy-name" name="name" type="text" size="50" maxlength="100" autofocus="autofocus"/>
- </div>
- </div>
- <div class="modal-foot">
- <input type="hidden" value="" name="overwrite" id="copy-overwrite"/>
- <input type="submit" value="<%= h message('copy') -%>" id="copy-submit"/>
- <a href="#" onclick="return closeModalWindow()" id="copy-cancel"><%= h message('cancel') -%></a>
- </div>
- </fieldset>
-</form>
-<script>
- $j("#copy-profile-form").modalForm({
- error: function (xhr) {
- if (xhr.status == 409) {
- $j('#copy-profile-form .modal-error').hide();
- var warningElt = $j('#copy-profile-form .modal-warning');
- $j('#copy-overwrite').val($j('#copy-name').val());
- $j('#copy-profile-form input[type=submit]').removeAttr('disabled');
- warningElt.html(xhr.responseText);
- warningElt.show();
- } else {
- $j('#copy-profile-form .modal-warning').hide();
- var errorElt = $j('#copy-profile-form .modal-error');
- $j('.loading-image').addClass("hidden");
- $j('#copy-profile-form input[type=submit]').removeAttr('disabled');
- errorElt.html(xhr.responseText);
- errorElt.show();
- }
- }
- });
-</script>
+++ /dev/null
-<%
- language = controller.java_facade.getLanguages().find { |l| l.getKey()==language_key }
- importers = Internal.component(Java::OrgSonarServerQualityprofile::QProfileExporters.java_class).findProfileImportersForLanguage(language_key)
-%>
-<form id="create-profile-form" action="old_profiles/create" enctype="multipart/form-data" method="POST">
- <fieldset>
- <input type="hidden" name="language" value="<%= language_key -%>"/>
-
- <div class="modal-head">
- <h2><%= h message('quality_profiles.create_x_language_profile', :params => language.getName()) -%></h2>
- </div>
-
- <div class="modal-body">
-
- <div class="modal-field">
- <label for="name"><%= message('name') -%> <em class="mandatory">*</em></label>
- <input id="create-profile-name" name="name" type="text" size="50" maxlength="100" autofocus="autofocus"/>
- </div>
-
- <% importers.to_a.sort { |x, y| x.getName() <=> y.getName() }.each do |importer| %>
- <div class="modal-field">
- <label for="backup[<%= importer.getKey() -%>]"><%= h importer.getName() -%></label>
- <%= file_field_tag "backup[#{importer.getKey()}]" %>
- <div class="modal-field-description"><%= h message('quality_profiles.optional_configuration_file') -%></div>
- </div>
- <% end %>
- </div>
-
- <div class="modal-foot">
- <input type="submit" value="<%= h message('create') -%>" id="create-profile-submit"/>
- <a href="#" onclick="return closeModalWindow()" id="create-profile-cancel"><%= h message('cancel') -%></a>
- </div>
- </fieldset>
-</form>
-
+++ /dev/null
-<i class="icon-severity-<%= arule.priority -%>"></i>
-
-<a href="<%= url_for :controller => 'coding_rules', :action => 'index', :anchor => 'rule_key=' + arule.rule.key + '|qprofile=' + aprofile.kee -%>">
- <%= h(arule.rule.name) -%>
-</a>
-<span class="note"><%= h(arule.rule.plugin_name) -%></span>
+++ /dev/null
-<div class="admin">
-<% form_tag({:action => 'create'}, {:multipart => true, :id => 'form_create_profile'}) do -%>
- <table class="spaced">
- <tr>
- <td align="left" nowrap="nowrap" width="1%">
- <%= message('name') -%>
- </td>
- <td align="left">
- <input type="text" name="name"/>
- </td>
- </tr>
- <tr>
- <td align="left" nowrap="nowrap">
- <%= message('language') -%>
- </td>
- <td align="left">
- <% languages_select=languages.collect do |language|
- [language.getName(), language.getKey()]
- end
- %>
- <%= select_tag :language, options_for_select(languages_select), :onClick => 'changeLanguage();' %>
- </td>
- </tr>
- </table>
-
- <% languages.each do |language| %>
- <% if @plugins_by_language[language.getKey()] %>
- <table class="spaced language_class" id="<%= language.getKey() %>" style="display:none">
- <% @plugins_by_language[language.getKey()].each do |plugin| %>
- <tr>
- <td align="left" style="vertical-align: top;" nowrap="nowrap" width="1%">
- <%= image_tag'bullet.png' %> <%= plugin.getName() %> XML (<%= message('optional').downcase -%>)
- </td>
- <td align="left">
- <%= file_field_tag plugin.getKey() %>
- </td>
- </tr>
- <% end %>
- </table>
- <% end %>
- <% end %>
-
- <table class="spaced">
- <tr>
- <td colspan="2" align="left">
- <%= submit_tag message('create') %>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'index' -%>" class="action"><%= message('cancel') -%></a>
- </td>
- </tr>
- </table>
-<% end %>
-</div>
-
-<script type="text/javascript">
- changeLanguage();
-</script>
+++ /dev/null
-<form id="rename-profile-form" method="post" action="old_profiles/rename">
- <input type="hidden" name="id" value="<%= @profile.id -%>"/>
- <fieldset>
-
- <div class="modal-head">
- <h2>Rename Profile: <%= h @profile.name -%></h2>
- </div>
-
- <div class="modal-body">
- <div class="modal-error"/>
-
- <div class="modal-field">
- <label for="new_name">New name <em class="mandatory">*</em></label>
- <input id="new-name" name="new_name" type="text" size="50" maxlength="100" autofocus="autofocus"/>
- </div>
- </div>
- <div class="modal-foot">
- <input type="submit" value="<%= h message('rename') -%>" id="rename-submit"/>
- <a href="#" onclick="return closeModalWindow()" id="rename-cancel"><%= h message('cancel') -%></a>
- </div>
- </fieldset>
-</form>
-<script>
- $j("#rename-profile-form").modalForm();
-</script>
+++ /dev/null
-<form id="restore-built-in-profiles-form" action="old_profiles/restore_built_in" method="POST">
- <fieldset>
- <input type="hidden" name="language" value="<%= @language.getKey() -%>"/>
-
- <div class="modal-head">
- <h2><%= h message('quality_profiles.restore_built_in_profiles') -%></h2>
- </div>
-
- <div class="modal-body">
- <%= h message('quality_profiles.restore_built_in_profiles_confirmation', :params => [@builtin_profile_names.join('\', \''), @language.getName()]) -%>
- </div>
-
- <div class="modal-foot">
- <input type="submit" value="<%= h message('restore') -%>" id="restore-built-in-profiles-submit"/>
- <a href="#" onclick="return closeModalWindow()" id="restore-built-in-profiles-cancel"><%= h message('cancel') -%></a>
- </div>
- </fieldset>
-</form>
-<script>
- $j("#restore-built-in-profiles-form").modalForm();
-</script>
+++ /dev/null
-<form id="restore-profile-form" action="old_profiles/restore" enctype="multipart/form-data" method="POST">
- <fieldset>
-
- <div class="modal-head">
- <h2><%= h message('quality_profiles.restore_built_in_profiles') -%></h2>
- </div>
-
- <div class="modal-body">
- <div class="modal-field">
- <label for="name"><%= message('backup') -%> <em class="mandatory">*</em></label>
- <%= file_field_tag 'backup' %>
- </div>
-
- </div>
-
- <div class="modal-foot">
- <input type="submit" value="<%= h message('quality_profiles.restore_submit') -%>" id="restore-profile-submit"/>
- <a href="#" onclick="return closeModalWindow()" id="restore-profile-cancel"><%= h message('cancel') -%></a>
- </div>
- </fieldset>
-</form>
+++ /dev/null
-<%
- new_tab = nil unless defined?(:new_tab)
- selected_tab = nil unless defined?(:selected_tab)
-%>
-<ul class="tabs">
- <li>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'show', :key => @profile.key() -%>" <%= "class='selected'" if selected_tab.nil? || selected_tab=='Rules' -%> id="tab-rules"><%= message('coding_rules') -%></a>
- </li>
- <li>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'projects', :id => @profile.id -%>" <%= "class='selected'" if selected_tab=='Projects' -%> id="tab-projects"><%= message('projects') -%></a>
- </li>
- <li>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'permalinks', :id => @profile.id -%>" <%= "class='selected'" if selected_tab=='Permalinks' -%> id="tab-permalinks"><%= message('permalinks') -%></a>
- </li>
- <li>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'inheritance', :id => @profile.id -%>" <%= "class='selected'" if selected_tab=='inheritance' -%> id="tab-inheritance"><%= message('quality_profiles.profile_inheritance') -%></a>
- </li>
- <li>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'changelog', :key => @profile.key() -%>" <%= "class='selected'" if selected_tab=='changelog' -%> id="tab-changelog"><%= message('changelog') -%></a>
- </li>
- <% if new_tab %>
- <li>
- <a href="#" class='selected'><%= new_tab -%></a>
- </li>
- <% end %>
-</ul>
+++ /dev/null
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= h @profile.name -%></h1>
- <div class="page-description">
- <a href="<%= ApplicationController.root_context -%>/old_profiles">← <%= h message('quality_profiles.page') -%></a>
- </div>
- </header>
-<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'changelog'} %>
-
-<div class="tabs-panel marginbottom10">
- <form class="marginbottom10" method="get" action="<%= ApplicationController.root_context %>/old_profiles/changelog">
- <input name="key" type="hidden" value="<%= @profile.key() %>"/>
- <%= message('quality_profiles.changelog_from') -%>
- <input name="since" type="text" value="<%= params['since'] %>" placeholder="1970-01-31"/>
- <%= message('to').downcase -%>
- <input name="to" type="text" value="<%= params['to'] %>" placeholder="1970-01-31"/>
- <input type="submit" value="<%= h message('search_verb') -%>" id="submit"/>
- </form>
-
- <% if @changes.empty? %>
- <%= message('quality_profiles.changelog.empty') -%>
- <% else %>
-
- <table id="profile-changelog" class="data width100">
- <thead>
- <tr>
- <th><%= message('date') -%></th>
- <th><%= message('user') -%></th>
- <th><%= message('action') -%></th>
- <th><%= message('rule') -%></th>
- <th><%= message('parameters') -%></th>
- </tr>
- </thead>
- <tbody>
- <%
- @changes.each do |change|
- %>
- <tr class="<%= cycle('even', 'odd') -%>">
- <%
- 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()
- %>
- <td valign="top" width="1%" nowrap><%= Internal.i18n.formatDateTime(change.getCreatedAt()) -%></td>
- <td valign="top" width="1%" nowrap><%= author %></td>
- <td valign="top" width="1%" nowrap><%= action_message %></td>
- <td valign="top"><%= rule %></td>
- <td valign="top">
- <% if change.severity() %>
- <%= message('quality_profiles.severity_set_to_x', :params => ["<i class=\"icon-severity-#{change.severity().downcase}\"></i>", change.severity()]) -%>
- <br/>
- <% 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 %>
- <br/>
- <% end %>
- </td>
- </tr>
- <% end %>
- </tbody>
- <%= paginate_java(@paging, :colspan => 5, :include_loading_icon => true) { |label, page_id|
- link_to(label, params.merge({:p => page_id}), :style => 'text-decoration:underline')
- }
- %>
- </table>
-
- <% end %>
-</div>
-</div>
+++ /dev/null
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= h message('quality_profiles.compare_profiles') -%></h1>
- <div class="page-description">
- <a href="<%= ApplicationController.root_context -%>/old_profiles">← <%= h message('quality_profiles.page') -%></a>
- </div>
- </header>
-
-<form method="GET" class="marginbottom10">
- <select name="id1" class="small">
- <option value=""></option>
- <%= options_for_profiles(@profiles, @id1) %>
- </select>
-
- <select name="id2" class="small">
- <option value=""></option>
- <%= options_for_profiles(@profiles, @id2) %>
- </select>
- <input type="submit" value="<%= message('compare') -%>" class="small" id="submit-compare"/>
-</form>
-
-<% if @profile1 && @profile2 %>
-
- <table class="header1" id="comparison-header">
- <tr>
- <td width="25%">
- <p><%= message('quality_profiles.only_in_profile_x', :params => h(@profile1.name)) -%></p>
- <span class="big"><a href="#in1" id="in1Value"><%= @in1.size -%></a></span> <%= message('rules').downcase -%>
- </td>
- <td width="25%">
- <p><%= message('quality_profiles.only_in_profile_x', :params => h(@profile2.name)) -%></p>
- <span class="big"><a href="#in2" id="in2Value"><%= @in2.size -%></a></span> <%= message('rules').downcase -%>
- </td>
- <td width="25%">
- <p><%= message('quality_profiles.with_different_configuration') -%></p>
- <span class="big"><a href="#modified" id="modifiedValue"><%= @modified.size -%></a></span> <%= message('rules').downcase -%>
- </td>
- <td width="25%">
- <p><%= message('quality_profiles.with_same_configuration') -%></p>
- <span class="big" id="sameValue"><%= @sames.size -%></span> <%= message('rules').downcase -%>
- </td>
- </tr>
- </table>
-
- <table class="width100 marginbottom10" id="profile_diff_table">
- <tbody>
-
- <% unless @in1.empty? %>
- <tr>
- <td width="49%">
- <table class="data width100 marginbottom10" id="in1-rules">
- <thead>
- <tr>
- <th><a name="in1"/><%= message('quality_profiles.x_rules_only_in', :params => @in1.size) %>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'show', :key => @profile1.kee -%>"><%= h @profile1.name %></a>
- </th>
- </tr>
- </thead>
- <% @in1.each do |diff| %>
- <tr id="rule_<%= u(diff.rule.key) -%>">
- <td class="<%= cycle('even', 'odd', :name => 'in1') -%>">
- <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule1, :aprofile => @profile1} %>
- </td>
- </tr>
- <% end %>
- </table>
- </td>
- <td width="2%"></td>
- <td width="49%"></td>
- </tr>
- <% end %>
-
- <% unless @in2.empty? %>
- <tr>
- <td width="49%"></td>
- <td width="2%"></td>
- <td width="49%">
- <table class="data width100 marginbottom10" id="in2-rules">
- <thead>
- <tr>
- <th><a name="in2"/><%= message('quality_profiles.x_rules_only_in', :params => @in2.size) %>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'show', :key => @profile2.kee -%>"><%= h @profile2.name %></a>
- </th>
- </tr>
- </thead>
- <% @in2.each do |diff| %>
- <tr id="rule_<%= u(diff.rule.key) -%>">
- <td class="<%= cycle('even', 'odd', :name => 'in2') -%>">
- <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule2, :aprofile => @profile2} %>
- </td>
- </tr>
- <% end %>
- </table>
- </td>
- </tr>
- <% end %>
-
-
- <% unless @modified.empty? %>
- <tr>
- <td colspan="3">
- <table class="data width100 marginbottom10" id="modified-rules">
- <thead>
- <tr>
- <th width="49%"><a name="modified"/><%= message('quality_profiles.x_rules_have_different_configuration', :params =>@modified.size) -%><br/>
- <a href="<%= url_for :controller => 'old_profiles', :action => 'show', :key => @profile1.kee -%>"><%= h @profile1.name %></a>
- </th>
- <th width="2%"></th>
- <th width="49%">
- <br/><a href="<%= url_for :controller => 'old_profiles', :action => 'show', :key => @profile2.kee -%>"><%= h @profile2.name %></a>
- </th>
- </tr>
- </thead>
- <% @modified.each do |diff|
- td_css=cycle('even', 'odd', :name => 'modified')
- %>
- <tr id="rule_<%= u(diff.rule.key) -%>">
- <td class="<%= td_css -%>" width="49%">
- <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule1, :aprofile => @profile1} %>
- <% if diff.removed_params && !diff.removed_params.empty? %>
- <ul>
- <% diff.removed_params.each do |parameter| %>
- <li><%= h(parameter.name) -%>:
- <span class="diffParam"><%= parameter.value.gsub(',', ', ') -%></span></li>
- <% end %>
- </ul>
- <% end %>
- </td>
- <td width="2%" class="<%= td_css -%>"></td>
- <td class="<%= td_css -%>" width="49%">
- <%= render :partial => 'diff_rule', :locals => {:arule => diff.arule2, :aprofile => @profile2} %>
- <% if diff.added_params && !diff.added_params.empty? %>
- <ul>
- <% diff.added_params.each do |parameter| %>
- <li><%= h(parameter.name) -%>:
- <span class="diffParam"><%= parameter.value.gsub(',', ', ') -%></span></li>
- <% end %>
- </ul>
- <% end %>
- </td>
- </tr>
- <% end %>
- </table>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
-<% end %>
-</div>
+++ /dev/null
-<h1>message('quality_profiles.editing_profile')</h1>
-
-<% form_for(@profile) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :name %><br />
- <%= f.text_field :name %>
- </p>
- <p>
- <%= f.label :active %><br />
- <%= f.check_box :active %>
- </p>
- <p>
- <%= f.submit message('update_verb') %>
- </p>
-<% end %>
-
-<%= link_to message('show_verb'), @profile %> |
-<%= link_to message('back'), profiles_path %>
+++ /dev/null
-<div class="page">
-
- <div class="page-header">
- <h1 class="page-title"><%= h message('quality_profiles.page') -%></h1>
-
- <div class="page-actions">
- <div class="button-group">
- <a href="old_profiles/compare" id="compare-link" class="button"><i class="icon-compare"></i> <%= message('quality_profiles.compare_profiles') -%>
- </a>
- <% if profiles_administrator? %>
- <a href="old_profiles/restore_form" class="open-modal button" id="restore-link"><i class="icon-restore"></i> <%= message('quality_profiles.restore_profile') -%>
- </a>
- <% end %>
- </div>
- </div>
- </div>
-
-<%
- Api::Utils.insensitive_sort(languages){|l| l.getName()}.each do |language|
- default_profile = Internal.component(Java::OrgSonarServerQualityprofile::QProfileService.java_class).getDefault(language.getKey())
-%>
- <div class="line-block">
- <% if profiles_administrator? %>
- <ul style="float: right" class="horizontal">
- <li class="marginleft10">
- <i class="icon-plus"></i>
- <a id="create-link-<%= language.getKey() -%>" href="<%= ApplicationController.root_context -%>/old_profiles/create_form?language=<%= u language.getKey() -%>"
- class="open-modal link-action"><%= message('create') -%></a>
- </li>
- </ul>
- <ul style="float: right" class="horizontal">
- <li class="marginleft10">
- <a id="create-link-<%= language.getKey() -%>" href="<%= ApplicationController.root_context -%>/old_profiles/restore_built_in_form?language=<%= u language.getKey() -%>"
- class="open-modal link-action"><%= message('quality_profiles.restore_built_in_profiles') -%></a>
- </li>
- </ul>
- <% end %>
- <h2><%= message('quality_profiles.x_language_profiles', :params => language.getName()) -%></h2>
- </div>
-
- <table class="data width100" id="profiles_<%= language.getKey() -%>">
- <thead>
- <tr>
- <th class="text-left"><%= message('name') -%></th>
- <th class="text-right"><%= message('rules') -%></th>
- <th class="text-right"><%= message('projects') -%></th>
- <th class="text-right"><%= message('default') -%></th>
- <% if profiles_administrator? %>
- <th width="1%" class="text-right" colspan="4"><%= message('operations') -%></th>
- <% end %>
- </tr>
- </thead>
- <tbody>
- <% @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()
- %>
- <tr class="<%= cycle 'even', 'odd', :name => language.getKey() -%> hoverable" id="<%= u profile.key() %>">
- <td width="40%">
- <a href="<%= url_for :controller => 'old_profiles', :action => 'show', :key => profile.key() -%>"
- id="rules-<%= profile.key() -%>"><%= h profile.name() -%></a>
- </td>
-
- <td align="right" width="10%">
- <%
- 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?
- %>
- <a class="widget-link"
- href="<%= "#{ApplicationController.root_context}/coding_rules#qprofile=#{profile.key()}|activation=true|languages=#{profile.language()}" -%>"
- title="<%= rules_tooltip %>">
- <span id="activated_rules_<%= u profile.key() -%>">
- <%= @active_rule_counts[profile.key()] || 0 -%>
- </span>
- </a>
- </td>
-
- <td align="right" width="10%" nowrap>
- <% unless is_default_profile %>
- <span id="projects_<%= u profile.key() -%>"><%= projects_count -%></span>
- <% end %>
- </td>
-
- <td align="right" width="10%" nowrap>
- <% 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 %>
- <i class="icon-check" id='<%= "is_active_#{u profile.key()}" -%>'></i>
- <% end %>
- </td>
-
- <td align="right" nowrap>
- <form method="post" action="<%= ApplicationController.root_context -%>/old_profiles/backup" id="backup-<%= profile.key().parameterize -%>-form">
- <input type="hidden" name="key" value="<%= profile.key() -%>"/>
- <a href="#" class="link-action" name="button_backup" id="backup_<%= u profile.key() -%>" onclick="$j('#backup-<%= profile.key().parameterize -%>-form').submit();return false;"><%= message('backup_verb') -%></a>
- </form>
- </td>
- <% if profiles_administrator? %>
- <td align="right">
- <a id="rename-<%= profile.key().parameterize -%>" href="<%= ApplicationController.root_context -%>/old_profiles/rename_form/<%= profile.id() -%>" class="link-action open-modal"><%= message('rename') -%></a>
- </td>
-
- <td align="right">
- <a id="copy-<%= profile.key().parameterize -%>" href="<%= ApplicationController.root_context -%>/old_profiles/copy_form/<%= profile.id() -%>" class="link-action open-modal"><%= message('copy') -%></a>
- </td>
-
- <td>
- <% 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 %>
- </td>
- <% end %>
- </tr>
- <% end %>
- </tbody>
- </table>
- <br/><br/>
-<% end %>
-</div>
+++ /dev/null
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= h @profile.name -%></h1>
- <div class="page-description">
- <a href="<%= ApplicationController.root_context -%>/old_profiles">← <%= h message('quality_profiles.page') -%></a>
- </div>
- </header>
-
-<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'inheritance'} %>
-
-<div class="tabs-panel marginbottom10">
-
- <table width="100%">
- <tr>
- <td align="center" valign="top">
- <div>
- <% @ancestors.reverse.each do |parent| %>
- <a href="<%= url_for :action => 'inheritance', :id => parent.id() -%>"><%= parent.name() -%></a>
- <span class="note">(<%= label_for_rules_count(parent, @all_profile_stats) -%>)</span><br/>
- <%= image_tag 'blue-up.png' -%><br/>
- <% end %>
-
- <b><%= @profile.name -%></b> <span class="note">(<%= label_for_rules_count(@profile, @all_profile_stats) -%>)</span><br/>
-
- <% if @children.size>0 %>
- <%= image_tag 'blue-up.png' -%><br/>
- <% @children.each_with_index do |child,index| %>
- <%= ', ' if index>0 -%>
- <a href="<%= url_for :action => 'inheritance', :id => child.id() -%>"><%= child.name() -%></a>
- <span class="note">(<%= label_for_rules_count(child, @all_profile_stats) -%>)</span>
- <% end %>
- <br/><%= image_tag 'blue-up.png' -%><br/>
- ...
- <% end %>
- </div>
- </td>
- <% if profiles_administrator? %>
- <td valign="top" width="300">
- <div class="admin">
- <h3><%= message('quality_profiles.set_parent') -%>:</h3>
- <p><%= message('quality_profiles.inherit_rules_from_profile') -%>:</p>
- <% 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 %>
- </div>
- </td>
- <% end %>
- </tr>
- </table>
-
-</div>
-</div>
+++ /dev/null
-<h1><%= message('quality_profiles.new_profile') -%></h1>
-
-<% form_for(@profile) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :name %><br />
- <%= f.text_field :name %>
- </p>
- <p>
- <%= f.label :active %><br />
- <%= f.check_box :active %>
- </p>
- <p>
- <%= f.submit message('create') %>
- </p>
-<% end %>
-
-<%= link_to message('back'), profiles_path %>
+++ /dev/null
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= h @profile.name -%></h1>
- <div class="page-description">
- <a href="<%= ApplicationController.root_context -%>/old_profiles">← <%= h message('quality_profiles.page') -%></a>
- </div>
- </header>
-
-<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'Permalinks'} %>
-
-<div class="tabs-panel marginbottom10 ">
- <% exporters = Internal.qprofile_exporters.exportersForLanguage(@profile.language()) %>
- <br/>
- <table class="data without-header marginbottom10" id="permalinks-table">
- <tbody>
- <tr class="even">
- <td width="1%" nowrap>
- <%= message('quality_profiles.export_all_rules') -%>
- </td>
- <td>
- <% permalink = url_for :controller => 'old_profiles', :action => 'export', :language => @profile.language(), :name => url_encode(@profile.name()), :only_path => false %>
- <span class="small"><%= link_to permalink, permalink %></span>
- </td>
- </tr>
- <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %>
- <tr class="<%= cycle('odd','even') -%>">
- <td width="1%" nowrap>
- <%= h exporter.getName() -%>
- </td>
- <td>
- <% permalink=url_for :controller => 'old_profiles', :action => 'export', :language => @profile.language(), :name => url_encode(@profile.name()), :format => exporter.getKey(), :only_path => false %>
- <span class="small"><%= link_to permalink, permalink, :id => "export_" + exporter.getKey().to_s + "_" + @profile.key() %></span>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
-</div>
-</div>
+++ /dev/null
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= h @profile.name -%></h1>
- <div class="page-description">
- <a href="<%= ApplicationController.root_context -%>/old_profiles">← <%= h message('quality_profiles.page') -%></a>
- </div>
- </header>
-
-<%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab => 'Projects'} %>
-
-<div class="tabs-panel">
- <% if profiles_administrator? %>
- <form method="POST" action="<%= ApplicationController.root_context -%>/old_profiles/add_project" id="add_project_form">
- <input type="hidden" name="id" value="<%= @profile.id -%>"/>
-
- Add project: <%= resource_select_tag 'project', {
- :qualifiers => ['TRK'],
- :width => '400px',
- :html_id => "select-project",
- } -%>
- <script>$j('#select-project').on("change", function (e) {
- $j(this).select2("disable");
- $j('#add_project_form').submit();
- })</script>
- </form>
-
- <% unless @projects.empty? %>
- <table class="data" id="projects-table">
- <thead>
- <tr>
- <th></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <% @projects.each do |project| %>
- <tr class="<%= cycle('even', 'odd') -%>">
- <td class="thin">
- <%= 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]
- -%>
- </td>
- <td><%= h project.name -%> <span class="small gray"><%= h project.key -%></span></td>
- </tr>
- <% end %>
- </tbody>
- <tfoot>
- <tr>
- <td colspan="2">
- <%= 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'
- -%>
- </td>
- </tr>
- </tfoot>
- </table>
- <% end %>
- <% else %>
-
- <% if @projects.empty? %>
- <p><%= message('quality_profiles.no_projects_associated_to_profile_x', :params => @profile.name) -%></p>
- <% else %>
- <p><%= message('quality_profiles.projects_warning') -%></p>
-
- <table class="data">
- <thead>
- <tr>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <% @projects.each do |project| %>
- <tr class="<%= cycle('even', 'odd') -%>">
- <td><%= h project.name -%> <span class="small gray"><%= h project.key -%></span></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <% end %>
- <% end %>
-</div>
-</div>
+++ /dev/null
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= h @profile.name -%></h1>
- <div class="page-description">
- <a href="<%= ApplicationController.root_context -%>/old_profiles">← <%= h message('quality_profiles.page') -%></a>
- </div>
- </header>
-
- <%= render :partial => 'old_profiles/tabs', :locals => {:selected_tab=>'Rules'} %>
-
- <div class="tabs-panel marginbottom10 ">
- <% active_rules = @stats.get('countActiveRules').get(0).getValue() if @stats && @stats.get('countActiveRules') %>
- <% active_rules ||= 0 %>
-
- <div class="widget-span widget-span-3">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('rules') -%></span>
- <span nowrap>
- <% tooltip = message('quality_profiles.see_rules_tooltip')
- tooltip = message('quality_profiles.manage_rules_tooltip') if profiles_administrator?
- %>
- <a class="widget-link"
- href="<%= "#{ApplicationController.root_context}/coding_rules#qprofile=#{@profile.key()}|activation=true|languages=#{@profile.language()}" -%>"
- title="<%= tooltip %>">
- <span><%= active_rules -%></span>
- </a>
- </span>
-
- </div>
- <% if @deprecated_active_rules > 0 %>
- <div class="widget-measure">
- <%= message('quality_profiles.including') %> <a
- href="<%= "#{ApplicationController.root_context}/coding_rules#qprofile=#{@profile.key()}|activation=true|languages=#{@profile.language()}|statuses=DEPRECATED" -%>"
- ><%= @deprecated_active_rules -%></a> <%= message('quality_profiles.deprecated') %>
- </div>
- <% end %>
- </div>
- </div>
-
- <% 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
- %>
- <div class="widget-span widget-span-3">
- <div class="widget-measure-container">
- <table class="data" style="width: 240px">
- <tbody>
- <% Severity::KEYS.each do |key|
- stat = severity_map[key]
- severity = key.downcase
- value = 0
- value = stat.getValue() if stat
- -%>
- <tr>
- <td>
- <i class="icon-severity-<%= severity %>"></i> <%= message(severity) -%>
- </td>
- <td class="thin text-right">
- <a href="<%= "#{ApplicationController.root_context}/coding_rules#qprofile=#{@profile.key()}|activation=true|languages=#{@profile.language()}|active_severities=#{severity.upcase}" -%>"
- class="widget-link">
- <span><%= value -%></span>
- </a>
- </td>
- <td class="nowrap ">
- <% if max > 0 %>
- <%= barchart(:width => 70, :percent => (100 * value / max).to_i) %>
- <% end %>
- </td>
- </tr>
- <% end -%>
- </tbody>
- </table>
- </div>
- </div>
- <% end -%>
- </div>
-</div>