diff options
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' }, |