From cba808dd9122029150b7d966f4bb8faac53f2ef7 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Thu, 28 May 2020 15:34:46 +0200 Subject: [PATCH] SONAR-13419 Show complete 1 year history on overview activity panel --- .../apps/overview/branches/ActivityPanel.tsx | 3 +- .../apps/overview/branches/BranchOverview.tsx | 4 +- .../__tests__/BranchOverview-test.tsx | 6 +-- .../__snapshots__/ActivityPanel-test.tsx.snap | 40 +------------------ 4 files changed, 7 insertions(+), 46 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx index 6118f97707d..cab50039608 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx @@ -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) {
{ const graphMetrics = getHistoryMetrics(graph, []); const metrics = uniq([...HISTORY_METRICS_LIST, ...graphMetrics]); - return getTimeMachineData({ + return getAllTimeMachineData({ ...getBranchLikeQuery(branchLike), from: FROM_DATE, component: component.key, diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx index d8029dd0e1d..a5f60fd235e 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx @@ -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); diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap index 90b14ae0e81..19e732ab810 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap @@ -38,45 +38,7 @@ exports[`should render correctly 1`] = ` updateGraph={[MockFunction]} />