From fe9acaf8c182b0a6e3b7f459919922c7fb75f366 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Fri, 30 Jun 2017 16:05:12 +0200 Subject: [PATCH] SONAR-9483 Add language filter and facet sorting when comparing with sonar way profile --- .../js/apps/coding-rules/facets/quality-profile-facet.js | 9 +++++++++ .../apps/quality-profiles/components/ProfileContainer.js | 2 +- .../js/apps/quality-profiles/details/ProfileRules.js | 1 + .../details/ProfileRulesSonarWayComparison.js | 8 +++++++- .../__tests__/ProfileRulesSonarWayComparison-test.js | 1 + .../__tests__/__snapshots__/ProfileRules-test.js.snap | 1 + .../ProfileRulesSonarWayComparison-test.js.snap | 2 +- 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 ( -
+
0 && { expect( shallow(
158 -- 2.39.5