diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2017-05-03 09:57:12 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2017-05-03 10:34:32 +0200 |
commit | 8020c3b68d1e1cbac040e287b2f3d3b41ea08a98 (patch) | |
tree | db87ec5c555e9a695b845c7fafc571a0b1273da9 | |
parent | 5c4b668ed14f307d22df715bcaf323cf27ee2c21 (diff) | |
download | sonarqube-8020c3b68d1e1cbac040e287b2f3d3b41ea08a98.tar.gz sonarqube-8020c3b68d1e1cbac040e287b2f3d3b41ea08a98.zip |
SONAR-8865 allow to change rules inside organization
3 files changed, 20 insertions, 12 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js index b7c512a091b..6bca7d2b32b 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js @@ -61,14 +61,18 @@ export default Marionette.ItemView.extend({ submitExtendDescription() { const that = this; this.ui.extendDescriptionForm.addClass('hidden'); + const data = { + key: this.model.get('key'), + markdown_note: this.ui.extendDescriptionText.val() + }; + if (this.options.app.organization) { + data.organization = this.options.app.organization; + } return $.ajax({ type: 'POST', url: window.baseUrl + '/api/rules/update', dataType: 'json', - data: { - key: this.model.get('key'), - markdown_note: this.ui.extendDescriptionText.val() - } + data }) .done(r => { that.model.set({ @@ -97,7 +101,7 @@ export default Marionette.ItemView.extend({ return { ...Marionette.ItemView.prototype.serializeData.apply(this, arguments), isCustom: this.model.get('isCustom'), - canCustomizeRule: this.options.app.canWrite && this.options.app.customRules + canCustomizeRule: this.options.app.canWrite }; } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js index 5d33a109a92..68c9748e386 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js @@ -58,7 +58,10 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ requestTags() { const url = window.baseUrl + '/api/rules/tags'; - return $.get(url); + const data = this.options.app.organization + ? { organization: this.options.app.organization } + : undefined; + return $.get(url, data); }, changeTags() { @@ -88,13 +91,14 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ editDone() { const that = this; const tags = this.ui.tagInput.val(); + const data = { key: this.model.get('key'), tags }; + if (this.options.app.organization) { + data.organization = this.options.app.organization; + } return $.ajax({ type: 'POST', url: window.baseUrl + '/api/rules/update', - data: { - key: this.model.get('key'), - tags - } + data }) .done(r => { that.model.set('tags', r.rule.tags); @@ -112,7 +116,7 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ return { ...Marionette.ItemView.prototype.serializeData.apply(this, arguments), - canCustomizeRule: this.options.app.canWrite && this.options.app.customRules, + canCustomizeRule: this.options.app.canWrite, allTags: union(this.model.get('sysTags'), this.model.get('tags')), permalink: window.baseUrl + permalinkPath + '#rule_key=' + encodeURIComponent(this.model.id) }; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs index 255f97fea08..1b3603cdef4 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs +++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs @@ -38,7 +38,7 @@ data-toggle="tooltip" data-placement="bottom" title="Rule tags"> <i class="icon-tags"></i> <span>{{#if allTags}}{{join allTags ', '}}{{else}}{{t 'coding_rules.no_tags'}}{{/if}}</span> - {{#if canWrite}}<i class="icon-dropdown"></i>{{/if}} + {{#if canCustomizeRule}}<i class="icon-dropdown"></i>{{/if}} </li> {{#if canCustomizeRule}} |