diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-14 17:01:34 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-16 09:14:40 +0200 |
commit | a212d447fddcff546a0d274d5186d5963f9ecf83 (patch) | |
tree | 64a3a75acd558cd2205195ed6da9c72e709abf54 /server/sonar-web/src/main/js/apps/projectActivity | |
parent | 83c40b005c2ed08bd1d1b3459e6b5a4c7224d476 (diff) | |
download | sonarqube-a212d447fddcff546a0d274d5186d5963f9ecf83.tar.gz sonarqube-a212d447fddcff546a0d274d5186d5963f9ecf83.zip |
Fix quality flaws
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectActivity')
4 files changed, 18 insertions, 18 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js b/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js index 55251df9328..1b931a0f838 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Event.js @@ -125,11 +125,9 @@ export default class Event extends React.PureComponent { removeEventButtonText={ 'project_activity.' + (isVersion ? 'remove_version' : 'remove_custom_event') } - removeEventQuestion={ - 'project_activity.' + - (isVersion ? 'remove_version' : 'remove_custom_event') + - '.question' - } + removeEventQuestion={`project_activity.${isVersion + ? 'remove_version' + : 'remove_custom_event'}.question`} />} </div> ); 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 8572a4be9b5..1e212bc5f13 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 @@ -274,18 +274,19 @@ class ProjectActivityAppContainer extends React.PureComponent { shouldRedirect = () => { const locationQuery = this.props.location.query; - if (locationQuery) { - const filtered = Object.keys(locationQuery).some( - key => key !== 'id' && locationQuery[key] !== '' - ); + if (!locationQuery) { + return false; + } + const filtered = Object.keys(locationQuery).some( + key => key !== 'id' && locationQuery[key] !== '' + ); - const graph = getGraph(); - const emptyCustomGraph = isCustomGraph(graph) && getCustomGraph().length <= 0; + const graph = getGraph(); + 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; - } + // 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; }; render() { diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.js index e97d205640e..51f4df10221 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.js @@ -134,6 +134,7 @@ export default class ProjectActivityGraphs extends React.PureComponent { graphStartDate: firstValid ? firstValid.x : newDates.from }; } + return null; }; getMetricsTypeFilter = () => { diff --git a/server/sonar-web/src/main/js/apps/projectActivity/utils.js b/server/sonar-web/src/main/js/apps/projectActivity/utils.js index 4e85eb3ced6..12694dba2bf 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/utils.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/utils.js @@ -53,15 +53,15 @@ export const GRAPHS_METRICS = { duplications: GRAPHS_METRICS_DISPLAYED['duplications'].concat(['duplicated_lines_density']) }; +export const datesQueryChanged = (prevQuery /*: Query */, nextQuery /*: Query */) => + !isEqual(prevQuery.from, nextQuery.from) || !isEqual(prevQuery.to, nextQuery.to); + export const activityQueryChanged = (prevQuery /*: Query */, nextQuery /*: Query */) => prevQuery.category !== nextQuery.category || datesQueryChanged(prevQuery, nextQuery); export const customMetricsChanged = (prevQuery /*: Query */, nextQuery /*: Query */) => !isEqual(prevQuery.customMetrics, nextQuery.customMetrics); -export const datesQueryChanged = (prevQuery /*: Query */, nextQuery /*: Query */) => - !isEqual(prevQuery.from, nextQuery.from) || !isEqual(prevQuery.to, nextQuery.to); - export const hasDataValues = (serie /*: Serie */) => serie.data.some(point => point.y || point.y === 0); |