"to.downcase": "to",
"widget.sqaleSunburst.cant_display": "SQALE technical debt is 0 so the breakdown by characteristic can't be displayed.",
"measure_filter.name_contains": "Name contains",
- "manual_rules.page": "Manual Rules",
"name_too_long_x": "Name is too long (maximum is {0} characters)",
"metric.line_coverage.name": "Line coverage",
"measure_filter.criteria.key": "Key",
Backbone.history.start();
};
-App.manualRepository = function () {
- return {
- key: 'manual',
- name: translate('coding_rules.manual_rule'),
- language: 'none'
- };
-};
-
const appXHR = $.get('/api/rules/app').done(function (r) {
App.canWrite = r.canWrite;
App.qualityProfiles = _.sortBy(r.qualityprofiles, ['name', 'lang']);
profile.language = App.languages[profile.lang];
});
App.repositories = r.repositories;
- App.repositories.push(App.manualRepository());
App.statuses = r.statuses;
});
*/
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import ManualRuleCreationView from './rule/manual-rule-creation-view';
import Template from './templates/coding-rules-filters.hbs';
export default Marionette.ItemView.extend({
template: Template,
- events: {
- 'click .js-create-manual-rule': 'createManualRule'
- },
-
- createManualRule () {
- new ManualRuleCreationView({
- app: this.options.app
- }).render();
- },
-
serializeData () {
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
canWrite: this.options.app.canWrite
import ParamView from './rule/rule-parameters-view';
import ProfilesView from './rule/rule-profiles-view';
import CustomRulesView from './rule/custom-rules-view';
-import ManualRuleCreationView from './rule/manual-rule-creation-view';
import CustomRuleCreationView from './rule/custom-rule-creation-view';
import DeleteRuleView from './rule/delete-rule-view';
import IssuesView from './rule/rule-issues-view';
},
events: {
- 'click .js-edit-manual': 'editManualRule',
'click .js-edit-custom': 'editCustomRule',
'click .js-delete': 'deleteRule'
},
key.deleteScope('details');
},
- editManualRule () {
- new ManualRuleCreationView({
- app: this.options.app,
- model: this.model
- }).render();
- },
-
editCustomRule () {
new CustomRuleCreationView({
app: this.options.app,
},
serializeData () {
- const isManual = this.model.get('isManual');
const isCustom = this.model.has('templateKey');
- const isEditable = this.options.app.canWrite && (isManual || isCustom);
- let qualityProfilesVisible = !isManual;
-
- if (qualityProfilesVisible) {
- if (this.model.get('isTemplate')) {
- qualityProfilesVisible = !_.isEmpty(this.options.actives);
- }
- else {
- qualityProfilesVisible = (this.options.app.canWrite || !_.isEmpty(this.options.actives));
- }
+ const isEditable = this.options.app.canWrite && (isCustom);
+ let qualityProfilesVisible = true;
+
+ if (this.model.get('isTemplate')) {
+ qualityProfilesVisible = !_.isEmpty(this.options.actives);
}
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.
- */
-import $ from 'jquery';
-import _ from 'underscore';
-import ModalFormView from '../../../components/common/modal-form';
-import Template from '../templates/rule/coding-rules-manual-rule-creation.hbs';
-import latinize from '../../../helpers/latinize';
-import { translate } from '../../../helpers/l10n';
-
-export default ModalFormView.extend({
- template: Template,
-
- ui () {
- return _.extend(ModalFormView.prototype.ui.apply(this.arguments), {
- manualRuleCreationKey: '#coding-rules-manual-rule-creation-key',
- manualRuleCreationName: '#coding-rules-manual-rule-creation-name',
- manualRuleCreationHtmlDescription: '#coding-rules-manual-rule-creation-html-description',
- manualRuleCreationSeverity: '#coding-rules-manual-rule-creation-severity',
- manualRuleCreationStatus: '#coding-rules-manual-rule-creation-status',
- manualRuleCreationParameters: '[name]',
- manualRuleCreationCreate: '#coding-rules-manual-rule-creation-create',
- manualRuleCreationReactivate: '#coding-rules-manual-rule-creation-reactivate',
- modalFoot: '.modal-foot'
- });
- },
-
- events () {
- return _.extend(ModalFormView.prototype.events.apply(this.arguments), {
- 'input @ui.manualRuleCreationName': 'generateKey',
- 'keydown @ui.manualRuleCreationName': 'generateKey',
- 'keyup @ui.manualRuleCreationName': 'generateKey',
-
- 'input @ui.manualRuleCreationKey': 'flagKey',
- 'keydown @ui.manualRuleCreationKey': 'flagKey',
- 'keyup @ui.manualRuleCreationKey': 'flagKey',
-
- 'click #coding-rules-manual-rule-creation-cancel': 'hide',
- 'click @ui.manualRuleCreationCreate': 'create',
- 'click @ui.manualRuleCreationReactivate': 'reactivate'
- });
- },
-
- onRender () {
- ModalFormView.prototype.onRender.apply(this, arguments);
- this.keyModifiedByUser = false;
- this.ui.manualRuleCreationReactivate.addClass('hidden');
- },
-
- generateKey () {
- if (!this.keyModifiedByUser && this.ui.manualRuleCreationKey) {
- const generatedKey = latinize(this.ui.manualRuleCreationName.val()).replace(/[^A-Za-z0-9]/g, '_');
- this.ui.manualRuleCreationKey.val(generatedKey);
- }
- },
-
- flagKey () {
- this.keyModifiedByUser = true;
- },
-
- create () {
- const action = (this.model && this.model.has('key')) ? 'update' : 'create';
- const options = {
- name: this.ui.manualRuleCreationName.val(),
- markdown_description: this.ui.manualRuleCreationHtmlDescription.val()
- };
- if (action === 'update') {
- options.key = this.model.get('key');
- } else {
- options.manual_key = this.ui.manualRuleCreationKey.val();
- options.prevent_reactivation = true;
- }
- this.sendRequest(action, options);
- },
-
- reactivate () {
- const options = {
- name: this.existingRule.name,
- markdown_description: this.existingRule.mdDesc,
- manual_key: this.ui.manualRuleCreationKey.val(),
- prevent_reactivation: false
- };
- this.sendRequest('create', options);
- },
-
- sendRequest (action, options) {
- const that = this;
- const url = '/api/rules/' + action;
- return $.ajax({
- url,
- type: 'POST',
- data: options,
- statusCode: {
- // do not show global error
- 400: null
- }
- }).done(function (r) {
- if (typeof r === 'string') {
- r = JSON.parse(r);
- }
- that.options.app.controller.showDetails(r.rule.key);
- that.destroy();
- }).fail(function (jqXHR) {
- if (jqXHR.status === 409) {
- that.existingRule = jqXHR.responseJSON.rule;
- that.showErrors([], [{ msg: translate('coding_rules.reactivate.help') }]);
- that.ui.manualRuleCreationCreate.addClass('hidden');
- that.ui.manualRuleCreationReactivate.removeClass('hidden');
- } else {
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- }
- });
- },
-
- serializeData () {
- return _.extend(ModalFormView.prototype.serializeData.apply(this, arguments), {
- change: this.model && this.model.has('key')
- });
- }
-});
},
serializeData () {
- const isEditable = this.options.app.canWrite && (this.model.get('isManual') || this.model.get('isCustom'));
+ const isEditable = this.options.app.canWrite && (this.model.get('isCustom'));
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
isEditable,
},
serializeData () {
- const isEditable = this.options.app.canWrite && (this.model.get('isManual') || this.model.get('isCustom'));
+ const isEditable = this.options.app.canWrite && this.model.get('isCustom');
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
isEditable,
},
onRender () {
- const isManual = this.model.get('isManual');
- let qualityProfilesVisible = !isManual;
+ let qualityProfilesVisible = true;
- if (qualityProfilesVisible) {
- if (this.model.get('isTemplate')) {
- qualityProfilesVisible = this.collection.length > 0;
- }
- else {
- qualityProfilesVisible = (this.options.app.canWrite || this.collection.length > 0);
- }
+ if (this.model.get('isTemplate')) {
+ qualityProfilesVisible = this.collection.length > 0;
}
this.$el.toggleClass('hidden', !qualityProfilesVisible);
<h1 class="page-title">
{{t 'coding_rules.page'}}
</h1>
-
-{{#if canWrite}}
- <div class="pull-right button-group">
- <button class="js-create-manual-rule">{{t 'coding_rules.create_manual_rule'}}</button>
- </div>
-{{/if}}
{{#if isEditable}}
<div class="coding-rules-detail-description">
<div class="button-group">
- {{#if isManual}}
- <button class="js-edit-manual" id="coding-rules-detail-manual-rule-change">{{t 'edit'}}</button>
- {{else}}
- <button class="js-edit-custom" id="coding-rules-detail-custom-rule-change">{{t 'edit'}}</button>
- {{/if}}
+ <button class="js-edit-custom" id="coding-rules-detail-custom-rule-change">{{t 'edit'}}</button>
<button class="button-red js-delete" id="coding-rules-detail-rule-delete" class="button-red">{{t 'delete'}}</button>
</div>
</div>
+++ /dev/null
-<form>
- <div class="modal-head">
- {{#if change}}
- <h2>{{t 'coding_rules.update_manual_rule'}}</h2>
- {{else}}
- <h2>{{t 'coding_rules.create_manual_rule'}}</h2>
- {{/if}}
- </div>
-
- <div class="modal-body">
- <div class="alert alert-warning hidden">{{t 'coding_rules.reactivate.help'}}</div>
- <div class="js-modal-messages"></div>
-
- <table>
- <tr class="property">
- <th class="nowrap"><h3>{{t 'name'}} <em class="mandatory">*</em></h3></th>
- <td>
- <input type="text" name="name" id="coding-rules-manual-rule-creation-name"
- class="coding-rules-name-key" value="{{name}}"/>
- </td>
- </tr>
- <tr class="property">
- <th class="nowrap"><h3>{{t 'key'}}{{#unless change}} <em class="mandatory">*</em>{{/unless}}</h3></th>
- <td>
- {{#if change}}
- {{key}}
- {{else}}
- <input type="text" name="key" id="coding-rules-manual-rule-creation-key"
- class="coding-rules-name-key" value="{{internalKey}}"/>
- {{/if}}
- </td>
- </tr>
- <tr class="property">
- <th class="nowrap"><h3>{{t 'description'}} <em class="mandatory">*</em></h3></th>
- <td>
- <textarea name="markdown_description" id="coding-rules-manual-rule-creation-html-description"
- class="coding-rules-markdown-description" rows="15">{{{mdDesc}}}</textarea>
- <span class="text-right">{{> '../../../../components/common/templates/_markdown-tips' }}</span>
- </td>
- </tr>
- </table>
- </div>
-
- <div class="modal-foot">
- <button id="coding-rules-manual-rule-creation-create">
- {{#if change}}{{t 'save'}}{{else}}{{t 'create'}}{{/if}}
- </button>
- <button id="coding-rules-manual-rule-creation-reactivate">{{t 'coding_rules.reactivate'}}</button>
- <a id="coding-rules-manual-rule-creation-cancel" class="js-modal-close">{{t 'cancel'}}</a>
- </div>
-</form>
<div class="coding-rules-detail-description rule-desc markdown">{{{htmlDesc}}}</div>
{{#unless isEditable}}
- {{#unless isManual}}
- <div class="coding-rules-detail-description coding-rules-detail-description-extra">
- <div id="coding-rules-detail-description-extra">
- {{#if htmlNote}}
- <div class="rule-desc marginbottom10 markdown">{{{htmlNote}}}</div>
- {{/if}}
- {{#if canWrite}}
- <div class="button-group">
- <button id="coding-rules-detail-extend-description">{{t 'coding_rules.extend_description'}}</button>
- </div>
- {{/if}}
- </div>
-
+ <div class="coding-rules-detail-description coding-rules-detail-description-extra">
+ <div id="coding-rules-detail-description-extra">
+ {{#if htmlNote}}
+ <div class="rule-desc marginbottom10 markdown">{{{htmlNote}}}</div>
+ {{/if}}
{{#if canWrite}}
- <div class="coding-rules-detail-extend-description-form hidden">
- <table class="width100">
- <tbody>
- <tr>
- <td class="width100" colspan="2">
- <textarea id="coding-rules-detail-extend-description-text" rows="4"
- style="width: 100%; margin-bottom: 4px;">{{mdNote}}</textarea>
- </td>
- </tr>
- <tr>
- <td>
- <div class="button-group">
- <button id="coding-rules-detail-extend-description-submit">{{t 'save'}}</button>
- {{#if mdNote}}
- <button id="coding-rules-detail-extend-description-remove"
- class="button-red">{{t 'remove'}}</button>
- {{/if}}
- </div>
- <a id="coding-rules-detail-extend-description-cancel" class="action">{{t 'cancel'}}</a>
- </td>
- <td class="text-right">
- {{> '../../../../components/common/templates/_markdown-tips' }}
- </td>
- </tr>
- </tbody>
- </table>
+ <div class="button-group">
+ <button id="coding-rules-detail-extend-description">{{t 'coding_rules.extend_description'}}</button>
</div>
{{/if}}
</div>
- {{/unless}}
+
+ {{#if canWrite}}
+ <div class="coding-rules-detail-extend-description-form hidden">
+ <table class="width100">
+ <tbody>
+ <tr>
+ <td class="width100" colspan="2">
+ <textarea id="coding-rules-detail-extend-description-text" rows="4"
+ style="width: 100%; margin-bottom: 4px;">{{mdNote}}</textarea>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div class="button-group">
+ <button id="coding-rules-detail-extend-description-submit">{{t 'save'}}</button>
+ {{#if mdNote}}
+ <button id="coding-rules-detail-extend-description-remove"
+ class="button-red">{{t 'remove'}}</button>
+ {{/if}}
+ </div>
+ <a id="coding-rules-detail-extend-description-cancel" class="action">{{t 'cancel'}}</a>
+ </td>
+ <td class="text-right">
+ {{> '../../../../components/common/templates/_markdown-tips' }}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ {{/if}}
+ </div>
{{/unless}}
</header>
<ul class="coding-rules-detail-properties">
- {{#unless isManual}}
- <li class="coding-rules-detail-property"
- data-toggle="tooltip" data-placement="bottom" title="{{t 'coding_rules.type.tooltip' this.type}}">
- {{issueType this.type}}
- </li>
+ <li class="coding-rules-detail-property"
+ data-toggle="tooltip" data-placement="bottom" title="{{t 'coding_rules.type.tooltip' this.type}}">
+ {{issueType this.type}}
+ </li>
- <li class="coding-rules-detail-property"
- data-toggle="tooltip" data-placement="bottom" title="Default rule severity">
- {{severityIcon severity}} {{t "severity" severity}}
- </li>
- {{/unless}}
+ <li class="coding-rules-detail-property"
+ data-toggle="tooltip" data-placement="bottom" title="Default rule severity">
+ {{severityIcon severity}} {{t "severity" severity}}
+ </li>
{{#notEq status 'READY'}}
<li class="coding-rules-detail-property"
<li class="coding-rules-detail-property">{{t 'coding_rules.available_since'}} {{d createdAt}}</li>
<li class="coding-rules-detail-property"
- data-toggle="tooltip" data-placement="bottom" title="Rule repository{{#unless isManual}} (language){{/unless}}">
- {{repoName}}{{#unless isManual}} ({{langName}}){{/unless}}
+ data-toggle="tooltip" data-placement="bottom" title="Rule repository{(language)">
+ {{repoName}}({{langName}})
</li>
{{#if isTemplate}}
<ul class="coding-rules-detail-properties">
{{#if severity}}
- {{#unless isManual}}
- <li class="coding-rules-detail-property"
- data-toggle="tooltip" data-placement="bottom" title="{{t 'coding_rules.type.tooltip' this.type}}">
- {{issueType this.type}}
- </li>
-
- <li class="coding-rules-detail-property"
- data-toggle="tooltip" data-placement="bottom" title="Default rule severity">
- {{severityIcon severity}} {{t "severity" severity}}
- </li>
- {{/unless}}
+ <li class="coding-rules-detail-property"
+ data-toggle="tooltip" data-placement="bottom" title="{{t 'coding_rules.type.tooltip' this.type}}">
+ {{issueType this.type}}
+ </li>
+
+ <li class="coding-rules-detail-property"
+ data-toggle="tooltip" data-placement="bottom" title="Default rule severity">
+ {{severityIcon severity}} {{t "severity" severity}}
+ </li>
{{/if}}
{{#notEq status 'READY'}}
manual_measures.page.description=Update the values of manual metrics for this project. Changes will take effect at the project's next analysis. Manual Metrics must be created at the global level.
custom_measures.page=Custom Measures
custom_measures.page.description=Update the values of custom metrics for this project. Changes will take effect at the project's next analysis. Custom metrics must be created at the global level.
-manual_rules.page=Manual Rules
-manual_rules.page.description=These rules are available for all projects. Manual issues can be created at project level via the component code viewer.
-manual_rules.delete_manual_rule=Delete Manual Rule
-manual_rules.delete_manual_rule_message=Are you sure that you want to delete manual rule "{0}"?
roles.page=Project Permissions
roles.page.description=Grant and revoke project-level permissions to Browse (view a project's metrics), See Source Code, and Administer individual projects. Permissions can be granted to groups or individual users.
roles.page.description2=Grant and revoke project-level permissions. Permissions can be granted to groups or individual users.
issue.updated=Updated:
issue.manual.missing_rule=Missing rule
-issue.manual.no_rules.admin=Manual rules must be defined before manual issues can be created.
-issue.manual.no_rules.non_admin=At least one manual rule must exist before manual issues can be created. Please contact your project administrator.
issue.reported_by=Reported by
issue.authorLogin=Author:
issue.component_deleted=Removed
coding_rules.change_details=Change Details of Quality Profile
coding_rules.create=Create
coding_rules.create_custom_rule=Create Custom Rule
-coding_rules.create_manual_rule=Create Manual Rule
coding_rules.custom_rule=Custom Rule
coding_rules.custom_rule.title=This rule has been created through customization of a rule template
coding_rules.custom_rule.activation_notice=Note: parameters of a custom rule are not customizable on rule activation, only during creation/edit.
coding_rules.custom_rules=Custom Rules
coding_rules.delete_rule=Delete Rule
coding_rules.delete.custom.confirm=Are you sure you want to delete custom rule "{0}"?
-coding_rules.delete.manual.confirm=Are you sure you want to delete manual rule "{0}"?
coding_rules.extend_description=Extend Description
coding_rules.deactivate_in=Deactivate In
coding_rules.deactivate=Deactivate
coding_rules.inherits="{0}" inherits from "{1}"
coding_rules.issues=Issues
coding_rules.key=Key:
-coding_rules.manual_rule=Manual Rule
-coding_rules.manual_rules=Manual Rules
coding_rules.most_violated_projects=Most Violated Projects
coding_rules.new_search=New Search
coding_rules.no_results=No Coding Rules
coding_rules.type.tooltip.VULNERABILITY=Vulnerability Detection Rule
coding_rules.noncharacterized=Uncharacterized
coding_rules.update_custom_rule=Update Custom Rule
-coding_rules.update_manual_rule=Update Manual Rule
coding_rules.filter_similar_rules=Filter Similar Rules
coding_rules.validation.invalid_rule_key=The rule key "%s" is invalid, it should only contain: a-z, 0-9, "_"
coding_rules.validation.missing_severity=The severity is missing
coding_rules.validation.invalid_severity=Severity "{0}" is invalid
coding_rules.validation.missing_status=The status is missing
-coding_rules.validation.manual_rule_params=No parameter can be set on a manual rule
coding_rules.filters.activation=Activation
coding_rules.filters.activation.active=Active
component_viewer.x_lines_are_covered={0} lines are covered
component_viewer.details=Details
-component_viewer.add_manual_issue=Add Manual Issue
component_viewer.line_actions=Line Actions
component_viewer.no_issues=No Issues
component_viewer.no_coverage=No Coverage