diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-06-22 17:22:21 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-04 14:15:34 +0200 |
commit | b41d68b7105b3d9704319183dcb7e573e6dd1386 (patch) | |
tree | 98a5b66a1cb1435460d49409536f7a884c5a1180 /server/sonar-web/src/main/js/apps/projects/utils.js | |
parent | fd52ea47ca9353d13fa3f599154393a175669081 (diff) | |
download | sonarqube-b41d68b7105b3d9704319183dcb7e573e6dd1386.tar.gz sonarqube-b41d68b7105b3d9704319183dcb7e573e6dd1386.zip |
SONAR-9404 Remember last selected project history graph
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 | 44 |
1 files changed, 0 insertions, 44 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 68b26f1b41c..02f2ae59d59 100644 --- a/server/sonar-web/src/main/js/apps/projects/utils.js +++ b/server/sonar-web/src/main/js/apps/projects/utils.js @@ -20,50 +20,6 @@ // @flow import { translate } from '../../helpers/l10n'; -const DEFAULT_FILTER = 'sonarqube.projects.default'; -const FAVORITE = 'favorite'; -const ALL = 'all'; - -const VIEW = 'sonarqube.projects.view'; -const VISUALIZATION = 'sonarqube.projects.visualization'; -const SORT = 'sonarqube.projects.sort'; - -export const isFavoriteSet = (): boolean => { - const setting = window.localStorage.getItem(DEFAULT_FILTER); - return setting === FAVORITE; -}; - -export const isAllSet = (): boolean => { - const setting = window.localStorage.getItem(DEFAULT_FILTER); - return setting === ALL; -}; - -const save = (key: string, value: ?string) => { - try { - if (value) { - window.localStorage.setItem(key, value); - } else { - window.localStorage.removeItem(key); - } - } catch (e) { - // usually that means the storage is full - // just do nothing in this case - } -}; - -export const saveAll = () => save(DEFAULT_FILTER, ALL); - -export const saveFavorite = () => save(DEFAULT_FILTER, FAVORITE); - -export const saveView = (view: ?string) => save(VIEW, view); -export const getView = () => window.localStorage.getItem(VIEW); - -export const saveVisualization = (visualization: ?string) => save(VISUALIZATION, visualization); -export const getVisualization = () => window.localStorage.getItem(VISUALIZATION); - -export const saveSort = (sort: ?string) => save(SORT, sort); -export const getSort = () => window.localStorage.getItem(SORT); - export const SORTING_METRICS = [ { value: 'name' }, { value: 'analysis_date' }, |