]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13419 Show complete 1 year history on overview activity panel
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Thu, 28 May 2020 13:34:46 +0000 (15:34 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 2 Jun 2020 20:05:09 +0000 (20:05 +0000)
server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx
server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx
server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx
server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap

index 6118f97707d6ff1b567ce87242fedd3858e8b95d..cab5003960870f39890598c7dade6254061d6dc2 100644 (file)
@@ -69,7 +69,6 @@ export function ActivityPanel(props: ActivityPanelProps) {
     getDisplayedHistoryMetrics(graph, [])
   );
   const graphs = splitSeriesInGraphs(series, MAX_GRAPH_NB, MAX_SERIES_PER_GRAPH);
-  const parsedAnalyses = analyses.map(a => ({ ...a, date: parseDate(a.date) }));
   let shownLeakPeriodDate;
   if (leakPeriodDate !== undefined) {
     const startDate = measuresHistory.reduce((oldest: Date, { history }) => {
@@ -96,7 +95,7 @@ export function ActivityPanel(props: ActivityPanelProps) {
             <div aria-hidden={true} className="overview-panel-padded display-flex-column flex-1">
               <GraphsHeader graph={graph} metrics={metrics} updateGraph={props.onGraphChange} />
               <GraphsHistory
-                analyses={parsedAnalyses}
+                analyses={[]}
                 graph={graph}
                 graphs={graphs}
                 leakPeriodDate={shownLeakPeriodDate}
index e242265c3595791ef649b2dbb5f5e0bade42d88b..6268623fb949338f6ae94fee5ec527396ee292f3 100644 (file)
@@ -25,7 +25,7 @@ import { getApplicationDetails, getApplicationLeak } from '../../../api/applicat
 import { getMeasuresWithPeriodAndMetrics } from '../../../api/measures';
 import { getProjectActivity } from '../../../api/projectActivity';
 import { getApplicationQualityGate, getQualityGateProjectStatus } from '../../../api/quality-gates';
-import { getTimeMachineData } from '../../../api/time-machine';
+import { getAllTimeMachineData } from '../../../api/time-machine';
 import {
   getActivityGraph,
   getHistoryMetrics,
@@ -298,7 +298,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
     const graphMetrics = getHistoryMetrics(graph, []);
     const metrics = uniq([...HISTORY_METRICS_LIST, ...graphMetrics]);
 
-    return getTimeMachineData({
+    return getAllTimeMachineData({
       ...getBranchLikeQuery(branchLike),
       from: FROM_DATE,
       component: component.key,
index d8029dd0e1dd20448a57e605798f0b41cc19a6a8..a5f60fd235e9f8c3922f82e9c9f975ce3749e702 100644 (file)
@@ -29,7 +29,7 @@ import {
   getApplicationQualityGate,
   getQualityGateProjectStatus
 } from '../../../../api/quality-gates';
-import { getTimeMachineData } from '../../../../api/time-machine';
+import { getAllTimeMachineData } from '../../../../api/time-machine';
 import { getActivityGraph, saveActivityGraph } from '../../../../components/activity-graph/utils';
 import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like';
 import { mockComponent } from '../../../../helpers/testMocks';
@@ -126,7 +126,7 @@ jest.mock('../../../../api/quality-gates', () => {
 jest.mock('../../../../api/time-machine', () => {
   const { MetricKey } = require.requireActual('../../../../types/metrics');
   return {
-    getTimeMachineData: jest.fn().mockResolvedValue({
+    getAllTimeMachineData: jest.fn().mockResolvedValue({
       measures: [
         { metric: MetricKey.bugs, history: [{ date: '2019-01-05', value: '2.0' }] },
         { metric: MetricKey.vulnerabilities, history: [{ date: '2019-01-05', value: '0' }] },
@@ -333,7 +333,7 @@ it("should correctly load a component's history", async () => {
   const wrapper = shallowRender();
   await waitAndUpdate(wrapper);
   expect(getProjectActivity).toBeCalled();
-  expect(getTimeMachineData).toBeCalled();
+  expect(getAllTimeMachineData).toBeCalled();
 
   const { measuresHistory } = wrapper.state();
   expect(measuresHistory).toHaveLength(6);
index 90b14ae0e81d20be3bb4f773e5fe4904b550c015..19e732ab8109d8b3d7a616a60ed3e7eb637dfa91 100644 (file)
@@ -38,45 +38,7 @@ exports[`should render correctly 1`] = `
             updateGraph={[MockFunction]}
           />
           <GraphsHistory
-            analyses={
-              Array [
-                Object {
-                  "date": 2017-03-01T08:36:01.000Z,
-                  "events": Array [
-                    Object {
-                      "category": "QUALITY_GATE",
-                      "description": "Lorem ipsum dolor sit amet",
-                      "key": "E11",
-                      "name": "Lorem ipsum",
-                      "qualityGate": Object {
-                        "failing": Array [
-                          Object {
-                            "branch": "master",
-                            "key": "foo",
-                            "name": "Foo",
-                          },
-                          Object {
-                            "branch": "feature/bar",
-                            "key": "bar",
-                            "name": "Bar",
-                          },
-                        ],
-                        "status": "ERROR",
-                        "stillFailing": true,
-                      },
-                    },
-                  ],
-                  "key": "foo",
-                  "projectVersion": "1.0",
-                },
-                Object {
-                  "date": 2017-03-01T08:36:01.000Z,
-                  "events": Array [],
-                  "key": "foo",
-                  "projectVersion": "1.0",
-                },
-              ]
-            }
+            analyses={Array []}
             graph="issues"
             graphs={
               Array [