aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-03-28 16:42:37 +0200
committerStas Vilchik <stas-vilchik@users.noreply.github.com>2017-04-03 10:38:52 +0200
commitadb4265900d35345f8d900dca47cc6c2f490cb21 (patch)
tree1a3e27f58ff84c51cccd3f36d6a13ce2eec26c24 /server/sonar-web/src/main/js/components
parent32a73efa05cb12056a93f08b9124e647213f1f02 (diff)
downloadsonarqube-adb4265900d35345f8d900dca47cc6c2f490cb21.tar.gz
sonarqube-adb4265900d35345f8d900dca47cc6c2f490cb21.zip
SONAR-9005 support rules for organizations
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r--server/sonar-web/src/main/js/components/issue/issue-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/main.js3
-rw-r--r--server/sonar-web/src/main/js/components/workspace/templates/workspace-rule.hbs2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/views/rule-view.js10
4 files changed, 13 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js
index eca902adbe9..e9b4c47cfcd 100644
--- a/server/sonar-web/src/main/js/components/issue/issue-view.js
+++ b/server/sonar-web/src/main/js/components/issue/issue-view.js
@@ -245,7 +245,7 @@ export default Marionette.ItemView.extend({
const ruleKey = this.model.get('rule');
// lazy load Workspace
const Workspace = require('../workspace/main').default;
- Workspace.openRule({ key: ruleKey });
+ Workspace.openRule({ key: ruleKey, organization: this.model.get('projectOrganization') });
},
action(action) {
diff --git a/server/sonar-web/src/main/js/components/workspace/main.js b/server/sonar-web/src/main/js/components/workspace/main.js
index 8c8cfd05f44..bb834be5a3a 100644
--- a/server/sonar-web/src/main/js/components/workspace/main.js
+++ b/server/sonar-web/src/main/js/components/workspace/main.js
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+// @flow
import $ from 'jquery';
import Item from './models/item';
import Items from './models/items';
@@ -77,7 +78,7 @@ Workspace.prototype = {
return this.open({ ...options, __type__: 'component' });
},
- openRule(options) {
+ openRule(options: { key: string, organization: string }) {
return this.open({ ...options, __type__: 'rule' });
},
diff --git a/server/sonar-web/src/main/js/components/workspace/templates/workspace-rule.hbs b/server/sonar-web/src/main/js/components/workspace/templates/workspace-rule.hbs
index 9c43694986b..377035a4d2f 100644
--- a/server/sonar-web/src/main/js/components/workspace/templates/workspace-rule.hbs
+++ b/server/sonar-web/src/main/js/components/workspace/templates/workspace-rule.hbs
@@ -42,7 +42,7 @@
{{/if}}
<li class="pull-right spacer-left">
- <a class="icon-link" target="_blank" href="{{rulePermalink key}}"></a>
+ <a class="icon-link" target="_blank" href="{{permalink}}"></a>
</li>
<li class="pull-right">
diff --git a/server/sonar-web/src/main/js/components/workspace/views/rule-view.js b/server/sonar-web/src/main/js/components/workspace/views/rule-view.js
index 1fe6440d64c..be86ab3e38d 100644
--- a/server/sonar-web/src/main/js/components/workspace/views/rule-view.js
+++ b/server/sonar-web/src/main/js/components/workspace/views/rule-view.js
@@ -21,6 +21,8 @@ import { union } from 'lodash';
import Marionette from 'backbone.marionette';
import BaseView from './base-viewer-view';
import Template from '../templates/workspace-rule.hbs';
+import { getRulesUrl } from '../../../helpers/urls';
+import { areThereCustomOrganizations } from '../../../store/organizations/utils';
export default BaseView.extend({
template: Template,
@@ -35,9 +37,15 @@ export default BaseView.extend({
},
serializeData() {
+ const query = { rule_key: this.model.get('key') };
+ const permalink = areThereCustomOrganizations()
+ ? getRulesUrl(query, this.model.get('organization'))
+ : getRulesUrl(query);
+
return {
...Marionette.LayoutView.prototype.serializeData.apply(this, arguments),
- allTags: union(this.model.get('sysTags'), this.model.get('tags'))
+ allTags: union(this.model.get('sysTags'), this.model.get('tags')),
+ permalink
};
}
});