aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-12 16:03:13 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-17 10:03:56 +0200
commit139facb4c713471036fe72f00bdfa1e86ee33f5e (patch)
tree93f03bff74f3eae3ba08249419bbf18afa260bdb /server/sonar-web/src/main/js
parenta344a9b3647f3227ebe50fb5620d51a1eba36ec4 (diff)
downloadsonarqube-139facb4c713471036fe72f00bdfa1e86ee33f5e.tar.gz
sonarqube-139facb4c713471036fe72f00bdfa1e86ee33f5e.zip
SONAR-8303 Create new rule from template with custom rule type
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js12
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-custom-rule-creation.hbs10
2 files changed, 21 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
index 194bb2cf823..7e95d520be4 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
@@ -33,6 +33,7 @@ export default ModalFormView.extend({
customRuleCreationKey: '#coding-rules-custom-rule-creation-key',
customRuleCreationName: '#coding-rules-custom-rule-creation-name',
customRuleCreationHtmlDescription: '#coding-rules-custom-rule-creation-html-description',
+ customRuleCreationType: '#coding-rules-custom-rule-creation-type',
customRuleCreationSeverity: '#coding-rules-custom-rule-creation-severity',
customRuleCreationStatus: '#coding-rules-custom-rule-creation-status',
customRuleCreationParameters: '[name]',
@@ -85,11 +86,18 @@ export default ModalFormView.extend({
return `<i class="icon-severity-${state.id.toLowerCase()}"></i> ${state.text}`;
}
};
+ const type = (this.model && this.model.get('type')) || this.options.templateRule.get('type');
const severity =
(this.model && this.model.get('severity')) || this.options.templateRule.get('severity');
const status =
(this.model && this.model.get('status')) || this.options.templateRule.get('status');
+ this.ui.customRuleCreationType.val(type);
+ this.ui.customRuleCreationType.select2({
+ width: '250px',
+ minimumResultsForSearch: 999
+ });
+
this.ui.customRuleCreationSeverity.val(severity);
this.ui.customRuleCreationSeverity.select2({
width: '250px',
@@ -111,6 +119,7 @@ export default ModalFormView.extend({
const options = {
name: this.ui.customRuleCreationName.val(),
markdown_description: this.ui.customRuleCreationHtmlDescription.val(),
+ type: this.ui.customRuleCreationType.val(),
severity: this.ui.customRuleCreationSeverity.val(),
status: this.ui.customRuleCreationStatus.val()
};
@@ -208,7 +217,8 @@ export default ModalFormView.extend({
params,
statuses,
change: this.model && this.model.has('key'),
- severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']
+ severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'],
+ types: ['BUG', 'VULNERABILITY', 'CODE_SMELL']
};
}
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-custom-rule-creation.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-custom-rule-creation.hbs
index 93f2a770390..389522453af 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-custom-rule-creation.hbs
+++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-custom-rule-creation.hbs
@@ -38,6 +38,16 @@
</td>
</tr>
<tr class="property">
+ <th class="nowrap"><h3>{{t 'type'}}</h3></th>
+ <td>
+ <select id="coding-rules-custom-rule-creation-type">
+ {{#each types}}
+ <option value="{{this}}">{{t 'issue.type' this}}</option>
+ {{/each}}
+ </select>
+ </td>
+ </tr>
+ <tr class="property">
<th class="nowrap"><h3>{{t 'severity'}}</h3></th>
<td>
<select id="coding-rules-custom-rule-creation-severity">