aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-04-26 08:51:46 +0200
committerGitHub <noreply@github.com>2017-04-26 08:51:46 +0200
commitdb12ff3dfee31b538a7b2d9217109901a375ea8c (patch)
tree7da0342a04ce88f0fa48db1220b9686087fd61a8
parent5c0394c5645ceafb88511f1bf9d5bf6ba39cf596 (diff)
downloadsonarqube-db12ff3dfee31b538a7b2d9217109901a375ea8c.tar.gz
sonarqube-db12ff3dfee31b538a7b2d9217109901a375ea8c.zip
SONAR-9005 apply feedback to the organization rules (#1976)
* pass organization to /api/rules/show * completely disable custom rules when orgs are enabled
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/controller.js3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/init.js4
2 files changed, 6 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/controller.js b/server/sonar-web/src/main/js/apps/coding-rules/controller.js
index dd15fb39b92..5f61c68dda9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/controller.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/controller.js
@@ -114,6 +114,9 @@ export default Controller.extend({
key: rule.id,
actives: true
};
+ if (this.app.organization) {
+ options.organization = this.app.organization;
+ }
return $.get(url, options).done(data => {
rule.set(data.rule);
rule.addExtraAttributes(that.app.repositories);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/init.js b/server/sonar-web/src/main/js/apps/coding-rules/init.js
index e3e23817c05..6dab31d13b6 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/init.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/init.js
@@ -33,6 +33,7 @@ import WorkspaceListView from './workspace-list-view';
import WorkspaceHeaderView from './workspace-header-view';
import FacetsView from './facets-view';
import FiltersView from './filters-view';
+import { areThereCustomOrganizations } from '../../store/organizations/utils';
const App = new Marionette.Application();
@@ -43,10 +44,11 @@ App.on('start', function(
isDefaultOrganization: boolean
}
) {
+ App.organization = options.organization;
const data = options.organization ? { organization: options.organization } : {};
$.get(window.baseUrl + '/api/rules/app', data)
.done(r => {
- App.customRules = options.organization == null || options.isDefaultOrganization;
+ App.customRules = !areThereCustomOrganizations();
App.canWrite = r.canWrite;
App.organization = options.organization;
App.qualityProfiles = sortBy(r.qualityprofiles, ['name', 'lang']);