diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-29 12:18:58 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-06-09 08:26:48 +0200 |
commit | 8a173aa3175c846291b8b56f2cfd84ab0e782627 (patch) | |
tree | c3fafd7d782521c25ccd93dcd5816103f3f5145c /server/sonar-web/src/main/js/apps/projects/utils.js | |
parent | eb029461e77fbb1f7a9dde462512d88fc65d46b4 (diff) | |
download | sonarqube-8a173aa3175c846291b8b56f2cfd84ab0e782627.tar.gz sonarqube-8a173aa3175c846291b8b56f2cfd84ab0e782627.zip |
SONAR-9254 Move projects facets sorting to the topbar of the projects page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/utils.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projects/utils.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/utils.js b/server/sonar-web/src/main/js/apps/projects/utils.js index a81d6258c14..ab4d157c3a2 100644 --- a/server/sonar-web/src/main/js/apps/projects/utils.js +++ b/server/sonar-web/src/main/js/apps/projects/utils.js @@ -47,6 +47,42 @@ export const saveAll = () => save(LOCALSTORAGE_ALL); export const saveFavorite = () => save(LOCALSTORAGE_FAVORITE); +export const SORTING_METRICS = [ + { value: 'name' }, + { value: 'reliability' }, + { value: 'security' }, + { value: 'maintainability' }, + { value: 'coverage' }, + { value: 'duplications' }, + { value: 'size' } +]; + +export const SORTING_LEAK_METRICS = [ + { value: 'name' }, + { value: 'new_reliability', complement: 'on_new_code' }, + { value: 'new_security', complement: 'on_new_code' }, + { value: 'new_maintainability', complement: 'on_new_code' }, + { value: 'new_coverage', complement: 'on_new_code' }, + { value: 'new_duplications', complement: 'on_new_lines' }, + { value: 'new_lines' } +]; + +export const SORTING_SWITCH = { + name: 'name', + reliability: 'new_reliability', + security: 'new_security', + maintainability: 'new_maintainability', + coverage: 'new_coverage', + duplications: 'new_duplications', + size: 'new_lines', + new_reliability: 'reliability', + new_security: 'security', + new_maintainability: 'maintainability', + new_coverage: 'coverage', + new_duplications: 'duplications', + new_lines: 'size' +}; + export const VIEWS = ['overall', 'leak']; export const VISUALIZATIONS = [ @@ -61,3 +97,8 @@ export const VISUALIZATIONS = [ export const localizeSorting = (sort?: string) => { return translate('projects.sort', sort || 'name'); }; + +export const parseSorting = (sort: string): { sortValue: string, sortDesc: boolean } => { + const desc = sort[0] === '-'; + return { sortValue: desc ? sort.substr(1) : sort, sortDesc: desc }; +}; |