aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-06-30 16:05:12 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-07-04 16:29:36 +0200
commitfe9acaf8c182b0a6e3b7f459919922c7fb75f366 (patch)
treee10d08798ac1db72c7567632550c1d85e019e08a
parent5477e21cb5f5329739e5e42c2cbcfbf79174e10f (diff)
downloadsonarqube-fe9acaf8c182b0a6e3b7f459919922c7fb75f366.tar.gz
sonarqube-fe9acaf8c182b0a6e3b7f459919922c7fb75f366.zip
SONAR-9483 Add language filter and facet sorting when comparing with sonar way profile
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js9
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.js2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.js8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.js1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.js.snap1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.js.snap2
7 files changed, 21 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
index 01aa4a90a0c..836e10783c9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
@@ -69,6 +69,15 @@ export default BaseFacet.extend({
label: profile.name,
val: profile.key
}));
+ const compareProfile = this.options.app.state.get('query').compareToProfile;
+ if (compareProfile != null) {
+ const property = this.model.get('property');
+ const selectedProfile = this.options.app.state.get('query')[property];
+ return sortBy(values, [
+ profile => (profile.val === compareProfile || profile.val === selectedProfile ? 0 : 1),
+ 'label'
+ ]);
+ }
return sortBy(values, 'label');
},
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.js b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.js
index def400e57fb..25ddb0e6391 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.js
@@ -87,7 +87,7 @@ export default class ProfileContainer extends React.PureComponent {
});
return (
- <div>
+ <div id="quality-profile">
<Helmet title={profile.name} />
<ProfileHeader
canAdmin={this.props.canAdmin}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js
index d9bb55dfefd..51bc22ee082 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js
@@ -194,6 +194,7 @@ export default class ProfileRules extends React.PureComponent {
{compareToSonarWay != null &&
compareToSonarWay.missingRuleCount > 0 &&
<ProfileRulesSonarWayComparison
+ language={profile.language}
organization={organization}
profile={profile.key}
sonarway={compareToSonarWay.profile}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.js b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.js
index edf0ab821b4..9dae0f2c518 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.js
@@ -25,6 +25,7 @@ import { getRulesUrl } from '../../../helpers/urls';
import { translate } from '../../../helpers/l10n';
type Props = {
+ language: string,
organization: ?string,
profile: string,
sonarway: string,
@@ -33,7 +34,12 @@ type Props = {
export default function ProfileRulesSonarWayComparison(props: Props) {
const url = getRulesUrl(
- { qprofile: props.profile, activation: false, compareToProfile: props.sonarway },
+ {
+ qprofile: props.profile,
+ activation: false,
+ compareToProfile: props.sonarway,
+ languages: props.language
+ },
props.organization
);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.js b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.js
index 35c0548ccb5..ef992d630ba 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.js
@@ -26,6 +26,7 @@ it('should render correctly', () => {
expect(
shallow(
<ProfileRulesSonarWayComparison
+ language="Java"
organization="foo"
profile="bar"
sonarway="baz"
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.js.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.js.snap
index ea4e92251cb..22be4264e2a 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.js.snap
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.js.snap
@@ -57,6 +57,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] =
</table>
</div>
<ProfileRulesSonarWayComparison
+ language="java"
organization="foo"
profile="foo"
sonarWayMissingRules={4}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.js.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.js.snap
index 9d9c67072bf..481846b23ad 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.js.snap
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.js.snap
@@ -21,7 +21,7 @@ exports[`should render correctly 1`] = `
className="pull-right"
onlyActiveOnIndex={false}
style={Object {}}
- to="/organizations/foo/rules#qprofile=bar|activation=false|compareToProfile=baz"
+ to="/organizations/foo/rules#qprofile=bar|activation=false|compareToProfile=baz|languages=Java"
>
158
</Link>