diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-21 13:32:19 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-24 08:20:48 +0200 |
commit | cbd59575a5e66f5d4421bf5625c454db526fc584 (patch) | |
tree | 0c197d6a1b34cc64d1ecb6e8b6d2e4d5831d6ad5 /server/sonar-web/src | |
parent | 15ed3abf008b93923fe37457c57913b40989d788 (diff) | |
download | sonarqube-cbd59575a5e66f5d4421bf5625c454db526fc584.tar.gz sonarqube-cbd59575a5e66f5d4421bf5625c454db526fc584.zip |
Correctly display Issues graph as default if no custom metrics are selected.
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js | 7 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/storage.js | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js index 01a3a09af36..d5ea86bad0c 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js @@ -273,9 +273,12 @@ class ProjectActivityAppContainer extends React.PureComponent { key => key !== 'id' && locationQuery[key] !== '' ); - // if there is no filter, but there are saved preferences in the localStorage const graph = getGraph(); - return !filtered && graph != null && graph !== DEFAULT_GRAPH; + const emptyCustomGraph = isCustomGraph(graph) && getCustomGraph().length <= 0; + + // if there is no filter, but there are saved preferences in the localStorage + // also don't redirect to custom if there is no metrics selected for it + return !filtered && graph != null && graph !== DEFAULT_GRAPH && !emptyCustomGraph; } }; diff --git a/server/sonar-web/src/main/js/helpers/storage.js b/server/sonar-web/src/main/js/helpers/storage.js index 977f184443e..763aa3d64b1 100644 --- a/server/sonar-web/src/main/js/helpers/storage.js +++ b/server/sonar-web/src/main/js/helpers/storage.js @@ -66,8 +66,10 @@ export const getSort = () => window.localStorage.getItem(PROJECTS_SORT); export const saveCustomGraph = (metrics: ?Array<string>) => save(PROJECT_ACTIVITY_GRAPH_CUSTOM, metrics ? metrics.join(',') : ''); -export const getCustomGraph = (): Array<string> => - (window.localStorage.getItem(PROJECT_ACTIVITY_GRAPH_CUSTOM) || '').split(','); +export const getCustomGraph = (): Array<string> => { + const customGraphs = window.localStorage.getItem(PROJECT_ACTIVITY_GRAPH_CUSTOM); + return customGraphs ? customGraphs.split(',') : []; +}; export const saveGraph = (graph: ?string) => save(PROJECT_ACTIVITY_GRAPH, graph); export const getGraph = (): string => |