diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-05 15:55:14 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-13 14:34:17 +0200 |
commit | bd28f67e3f5250a5e4ac5706eeb555f416e15782 (patch) | |
tree | be42afce0d9be47b147fda149bb66f4cd7e44f5d /server/sonar-web/src/main/js/apps/projectActivity/utils.js | |
parent | 223c274b837e855af0dc8c6fa7be3ea591f34feb (diff) | |
download | sonarqube-bd28f67e3f5250a5e4ac5706eeb555f416e15782.tar.gz sonarqube-bd28f67e3f5250a5e4ac5706eeb555f416e15782.zip |
SONAR-9415 Click on the graph or on the list to see the matching analysis on project activity page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectActivity/utils.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projectActivity/utils.js | 25 |
1 files changed, 18 insertions, 7 deletions
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 50b3ab32929..5e04dcc5436 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/utils.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/utils.js @@ -49,16 +49,25 @@ export const GRAPHS_METRICS = { }; export const activityQueryChanged = (prevQuery: Query, nextQuery: Query): boolean => - prevQuery.category !== nextQuery.category || - prevQuery.from !== nextQuery.from || - prevQuery.to !== nextQuery.to; + prevQuery.category !== nextQuery.category || datesQueryChanged(prevQuery, nextQuery); -export const datesQueryChanged = (prevQuery: Query, nextQuery: Query): boolean => - prevQuery.from !== nextQuery.from || prevQuery.to !== nextQuery.to; +export const datesQueryChanged = (prevQuery: Query, nextQuery: Query): boolean => { + const nextFrom = nextQuery.from ? nextQuery.from.valueOf() : null; + const previousFrom = prevQuery.from ? prevQuery.from.valueOf() : null; + const nextTo = nextQuery.to ? nextQuery.to.valueOf() : null; + const previousTo = prevQuery.to ? prevQuery.to.valueOf() : null; + return previousFrom !== nextFrom || previousTo !== nextTo; +}; export const historyQueryChanged = (prevQuery: Query, nextQuery: Query): boolean => prevQuery.graph !== nextQuery.graph; +export const selectedDateQueryChanged = (prevQuery: Query, nextQuery: Query): boolean => { + const nextSelectedDate = nextQuery.selectedDate ? nextQuery.selectedDate.valueOf() : null; + const previousSelectedDate = prevQuery.selectedDate ? prevQuery.selectedDate.valueOf() : null; + return nextSelectedDate !== previousSelectedDate; +}; + export const generateCoveredLinesMetric = ( uncoveredLines: MeasureHistory, measuresHistory: Array<MeasureHistory>, @@ -143,7 +152,8 @@ export const parseQuery = (urlQuery: RawQuery): Query => ({ from: parseAsDate(urlQuery['from']), graph: parseGraph(urlQuery['graph']), project: parseAsString(urlQuery['id']), - to: parseAsDate(urlQuery['to']) + to: parseAsDate(urlQuery['to']), + selectedDate: parseAsDate(urlQuery['selected_date']) }); export const serializeQuery = (query: Query): RawQuery => @@ -160,6 +170,7 @@ export const serializeUrlQuery = (query: Query): RawQuery => { from: serializeDate(query.from), graph: serializeGraph(query.graph), id: serializeString(query.project), - to: serializeDate(query.to) + to: serializeDate(query.to), + selected_date: serializeDate(query.selectedDate) }); }; |