From 2b6e974b64c2de988a5acffbb91fec8f715bacd1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Mon, 31 Jul 2017 10:30:55 +0200 Subject: [PATCH] SONAR-8550 Update function to group analyses by version --- .../__snapshots__/utils-test.js.snap | 119 +++++++++--------- .../projectActivity/__tests__/utils-test.js | 12 +- .../ProjectActivityAnalysesList-test.js.snap | 53 +++----- .../src/main/js/apps/projectActivity/utils.js | 25 ++-- 4 files changed, 98 insertions(+), 111 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap index 52f54d40c25..192b5d66cc8 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap @@ -57,46 +57,47 @@ exports[`getAnalysesByVersionByDay should also filter analysis based on the quer Array [ Object { "byDay": Object { - "2017-4-16": Array [ + "2017-4-18": Array [ Object { - "date": 2017-05-16T05:09:59.000Z, + "date": 2017-05-18T12:13:07.000Z, "events": Array [ - Object { - "category": "VERSION", - "key": "AVyM9oI1HjR_PLDzRciU", - "name": "1.0", - }, Object { "category": "QUALITY_PROFILE", - "key": "AVwQF7zXl-nNFgFWOJ3W", + "key": "AVxZtC-N7841nF4RNEMJ", "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], - "key": "AVwQF7kwl-nNFgFWOJ3V", + "key": "AVxZtCpH7841nF4RNEMI", }, ], - "2017-4-18": Array [ + }, + "key": "AVyM9oI1HjR_PLDzRciU", + "version": "1.1", + }, + Object { + "byDay": Object { + "2017-4-16": Array [ Object { - "date": 2017-05-18T12:13:07.000Z, + "date": 2017-05-16T05:09:59.000Z, "events": Array [ + Object { + "category": "VERSION", + "key": "AVyM9oI1HjR_PLDzRciU", + "name": "1.0", + }, Object { "category": "QUALITY_PROFILE", - "key": "AVxZtC-N7841nF4RNEMJ", + "key": "AVwQF7zXl-nNFgFWOJ3W", "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], - "key": "AVxZtCpH7841nF4RNEMI", + "key": "AVwQF7kwl-nNFgFWOJ3V", }, ], }, "key": "AVyM9oI1HjR_PLDzRciU", "version": "1.0", }, - Object { - "byDay": Object {}, - "key": undefined, - "version": undefined, - }, ] `; @@ -107,13 +108,7 @@ Array [ "2017-5-9": Array [ Object { "date": 2017-06-09T09:12:27.000Z, - "events": Array [ - Object { - "category": "VERSION", - "key": "AVyM9oI1HjR_PLDzRciU", - "name": "1.1-SNAPSHOT", - }, - ], + "events": Array [], "key": "AVyM9n3cHjR_PLDzRciT", }, ], @@ -139,18 +134,24 @@ Array [ "2017-5-9": Array [ Object { "date": 2017-06-09T09:12:27.000Z, - "events": Array [], + "events": Array [ + Object { + "category": "VERSION", + "key": "AVyM9oI1HjR_PLDzRciU", + "name": "1.1", + }, + ], "key": "AVyMjlK1HjR_PLDzRbB9", }, ], }, "key": "AVyM9oI1HjR_PLDzRciU", - "version": "1.0", + "version": "1.1", }, Object { "byDay": Object {}, - "key": undefined, - "version": undefined, + "key": "AVyM9oI1HjR_PLDzRciU", + "version": "1.0", }, ] `; @@ -162,11 +163,6 @@ Array [ "2017-5-9": Array [ Object { "date": 2017-06-09T11:06:10.000Z, - "events": Array [], - "key": "AVyMjlK1HjR_PLDzRbB9", - }, - Object { - "date": 2017-06-09T09:12:27.000Z, "events": Array [ Object { "category": "VERSION", @@ -174,6 +170,11 @@ Array [ "name": "1.1-SNAPSHOT", }, ], + "key": "AVyMjlK1HjR_PLDzRbB9", + }, + Object { + "date": 2017-06-09T09:12:27.000Z, + "events": Array [], "key": "AVyM9n3cHjR_PLDzRciT", }, ], @@ -183,24 +184,6 @@ Array [ }, Object { "byDay": Object { - "2017-4-16": Array [ - Object { - "date": 2017-05-16T05:09:59.000Z, - "events": Array [ - Object { - "category": "VERSION", - "key": "AVyM9oI1HjR_PLDzRciU", - "name": "1.0", - }, - Object { - "category": "QUALITY_PROFILE", - "key": "AVwQF7zXl-nNFgFWOJ3W", - "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", - }, - ], - "key": "AVwQF7kwl-nNFgFWOJ3V", - }, - ], "2017-4-18": Array [ Object { "date": 2017-05-18T12:13:07.000Z, @@ -222,16 +205,40 @@ Array [ "2017-5-9": Array [ Object { "date": 2017-06-09T09:12:27.000Z, - "events": Array [], + "events": Array [ + Object { + "category": "VERSION", + "key": "AVyM9oI1HjR_PLDzRciU", + "name": "1.1", + }, + ], "key": "AVyMjlK1HjR_PLDzRbB9", }, ], }, "key": "AVyM9oI1HjR_PLDzRciU", - "version": "1.0", + "version": "1.1", }, Object { "byDay": Object { + "2017-4-16": Array [ + Object { + "date": 2017-05-16T05:09:59.000Z, + "events": Array [ + Object { + "category": "VERSION", + "key": "AVyM9oI1HjR_PLDzRciU", + "name": "1.0", + }, + Object { + "category": "QUALITY_PROFILE", + "key": "AVwQF7zXl-nNFgFWOJ3W", + "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", + }, + ], + "key": "AVwQF7kwl-nNFgFWOJ3V", + }, + ], "2017-4-9": Array [ Object { "date": 2017-05-09T10:03:59.000Z, @@ -240,8 +247,8 @@ Array [ }, ], }, - "key": undefined, - "version": undefined, + "key": "AVyM9oI1HjR_PLDzRciU", + "version": "1.0", }, ] `; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js index 087184f52b2..7590775840a 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js @@ -21,13 +21,17 @@ import * as utils from '../utils'; const ANALYSES = [ - { key: 'AVyMjlK1HjR_PLDzRbB9', date: new Date('2017-06-09T13:06:10+0200'), events: [] }, { - key: 'AVyM9n3cHjR_PLDzRciT', - date: new Date('2017-06-09T11:12:27+0200'), + key: 'AVyMjlK1HjR_PLDzRbB9', + date: new Date('2017-06-09T13:06:10+0200'), events: [{ key: 'AVyM9oI1HjR_PLDzRciU', category: 'VERSION', name: '1.1-SNAPSHOT' }] }, - { key: 'AVyMjlK1HjR_PLDzRbB9', date: new Date('2017-06-09T11:12:27+0200'), events: [] }, + { key: 'AVyM9n3cHjR_PLDzRciT', date: new Date('2017-06-09T11:12:27+0200'), events: [] }, + { + key: 'AVyMjlK1HjR_PLDzRbB9', + date: new Date('2017-06-09T11:12:27+0200'), + events: [{ key: 'AVyM9oI1HjR_PLDzRciU', category: 'VERSION', name: '1.1' }] + }, { key: 'AVxZtCpH7841nF4RNEMI', date: new Date('2017-05-18T14:13:07+0200'), diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap index 53dc51ec351..aab488da157 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap @@ -185,38 +185,6 @@ exports[`should render correctly 1`] = ` selected={false} updateSelectedDate={[Function]} /> - - - - -
  • -
    - - 6.4 - -
    - +
  • +
  • +
    + + 6.4 + +
    +
  • - - -
  • -