From 9676f33bfcdeb599e26de963a938e33e753261fe Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Wed, 2 Dec 2020 16:33:31 +0100 Subject: [PATCH] SONAR-13564 Allow sorting projects by security review rating --- .../ProjectsSortingSelect-test.tsx.snap | 15 +++++++++++++++ .../sonar-web/src/main/js/apps/projects/utils.ts | 8 ++++++-- .../main/resources/org/sonar/l10n/core.properties | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap index 4ec06a7a8c0..e4e2e330431 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap @@ -33,6 +33,11 @@ exports[`should handle the descending sort direction 1`] = ` "label": "projects.sorting.security", "value": "security", }, + Object { + "class": undefined, + "label": "projects.sorting.security_review", + "value": "security_review", + }, Object { "class": undefined, "label": "projects.sorting.maintainability", @@ -107,6 +112,11 @@ exports[`should render correctly for leak view 1`] = ` "label": "projects.sorting.new_security", "value": "new_security", }, + Object { + "class": "projects-leak-sorting-option", + "label": "projects.sorting.new_security_review", + "value": "new_security_review", + }, Object { "class": "projects-leak-sorting-option", "label": "projects.sorting.new_maintainability", @@ -181,6 +191,11 @@ exports[`should render correctly for overall view 1`] = ` "label": "projects.sorting.security", "value": "security", }, + Object { + "class": undefined, + "label": "projects.sorting.security_review", + "value": "security_review", + }, Object { "class": undefined, "label": "projects.sorting.maintainability", diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts index 7f0f6d097e7..2305c1af302 100644 --- a/server/sonar-web/src/main/js/apps/projects/utils.ts +++ b/server/sonar-web/src/main/js/apps/projects/utils.ts @@ -41,6 +41,7 @@ export const SORTING_METRICS: SortingOption[] = [ { value: 'analysis_date' }, { value: 'reliability' }, { value: 'security' }, + { value: 'security_review' }, { value: 'maintainability' }, { value: 'coverage' }, { value: 'duplications' }, @@ -52,6 +53,7 @@ export const SORTING_LEAK_METRICS: SortingOption[] = [ { value: 'analysis_date' }, { value: 'new_reliability', class: 'projects-leak-sorting-option' }, { value: 'new_security', class: 'projects-leak-sorting-option' }, + { value: 'new_security_review', class: 'projects-leak-sorting-option' }, { value: 'new_maintainability', class: 'projects-leak-sorting-option' }, { value: 'new_coverage', class: 'projects-leak-sorting-option' }, { value: 'new_duplications', class: 'projects-leak-sorting-option' }, @@ -63,12 +65,14 @@ export const SORTING_SWITCH: T.Dict = { name: 'name', reliability: 'new_reliability', security: 'new_security', + security_review: 'new_security_review', maintainability: 'new_maintainability', coverage: 'new_coverage', duplications: 'new_duplications', size: 'new_lines', new_reliability: 'reliability', new_security: 'security', + new_security_review: 'security_review', new_maintainability: 'maintainability', new_coverage: 'coverage', new_duplications: 'duplications', @@ -320,8 +324,8 @@ const propertyToMetricMap: T.Dict = { new_reliability: 'new_reliability_rating', security: 'security_rating', new_security: 'new_security_rating', - security_review_rating: 'security_review_rating', - new_security_review_rating: 'new_security_review_rating', + security_review: 'security_review_rating', + new_security_review: 'new_security_review_rating', maintainability: 'sqale_rating', new_maintainability: 'new_maintainability_rating', coverage: 'coverage', diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 68cb4d8e9b4..fe486a541d3 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -962,12 +962,14 @@ projects.sorting.name=Name projects.sorting.analysis_date=Last analysis date projects.sorting.reliability=Reliability projects.sorting.security=Security +projects.sorting.security_review=Security Review projects.sorting.maintainability=Maintainability projects.sorting.coverage=Coverage projects.sorting.duplications=Duplications projects.sorting.size=Size projects.sorting.new_reliability=Reliability projects.sorting.new_security=Security +projects.sorting.new_security_review=Security Review projects.sorting.new_maintainability=Maintainability projects.sorting.new_coverage=Coverage projects.sorting.new_duplications=Duplications -- 2.39.5