From b833cf484f15bd1e689afac1eedcf8fe11b28d21 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Mon, 24 Aug 2020 15:55:38 +0200 Subject: [PATCH] SONAR-12616 Drop deprecated 'periods' --- server/sonar-web/src/main/js/api/measures.ts | 32 +- .../ProjectInformation-test.tsx.snap | 12 +- .../__snapshots__/utils-test.ts.snap | 30 +- .../__tests__/utils-test.ts | 12 +- .../components/MeasureContent.tsx | 4 +- .../drilldown/FilesView.tsx | 2 +- .../sidebar/__tests__/DomainFacet-test.tsx | 4 +- .../__tests__/FacetMeasureValue-test.tsx | 4 +- .../sidebar/__tests__/Sidebar-test.tsx | 6 +- .../__snapshots__/DomainFacet-test.tsx.snap | 40 +- .../__snapshots__/Sidebar-test.tsx.snap | 30 +- .../__tests__/BranchOverview-test.tsx | 2 +- .../__snapshots__/ActivityPanel-test.tsx.snap | 24 +- .../BranchOverview-test.tsx.snap | 696 ++++---- .../BranchOverviewRenderer-test.tsx.snap | 36 +- .../__snapshots__/MeasuresPanel-test.tsx.snap | 1468 +++++++---------- ...MeasuresPanelIssueMeasureRow-test.tsx.snap | 720 ++++---- .../QualityGatePanel-test.tsx.snap | 72 +- .../QualityGatePanelSection-test.tsx.snap | 144 +- .../components/QualityGateCondition.tsx | 6 +- .../__tests__/QualityGateCondition-test.tsx | 2 +- .../PullRequestOverview-test.tsx.snap | 1164 ++++++------- .../js/apps/projects/__tests__/utils-test.ts | 2 +- .../src/main/js/apps/projects/utils.ts | 6 +- .../src/main/js/components/measure/utils.ts | 7 +- .../js/helpers/__tests__/measures-test.ts | 20 +- .../sonar-web/src/main/js/helpers/measures.ts | 23 +- .../sonar-web/src/main/js/helpers/periods.ts | 11 - .../src/main/js/helpers/testMocks.ts | 24 +- .../sonar-web/src/main/js/types/measures.ts | 35 + server/sonar-web/src/main/js/types/types.d.ts | 2 +- 31 files changed, 1961 insertions(+), 2679 deletions(-) create mode 100644 server/sonar-web/src/main/js/types/measures.ts diff --git a/server/sonar-web/src/main/js/api/measures.ts b/server/sonar-web/src/main/js/api/measures.ts index 712ba286f0f..856fc620fb1 100644 --- a/server/sonar-web/src/main/js/api/measures.ts +++ b/server/sonar-web/src/main/js/api/measures.ts @@ -20,16 +20,18 @@ import { getJSON, post, postJSON } from 'sonar-ui-common/helpers/request'; import throwGlobalError from '../app/utils/throwGlobalError'; import { BranchParameters } from '../types/branch-like'; +import { + MeasuresAndMetaWithMetrics, + MeasuresAndMetaWithPeriod, + MeasuresForProjects +} from '../types/measures'; + +const COMPONENT_URL = '/api/measures/component'; export function getMeasures( data: { component: string; metricKeys: string } & BranchParameters ): Promise { - return getJSON('/api/measures/component', data).then(r => r.component.measures, throwGlobalError); -} - -interface MeasuresAndMetaWithMetrics { - component: T.ComponentMeasure; - metrics: T.Metric[]; + return getJSON(COMPONENT_URL, data).then(r => r.component.measures, throwGlobalError); } export function getMeasuresWithMetrics( @@ -37,7 +39,7 @@ export function getMeasuresWithMetrics( metrics: string[], branchParameters?: BranchParameters ): Promise { - return getJSON('/api/measures/component', { + return getJSON(COMPONENT_URL, { additionalFields: 'metrics', component, metricKeys: metrics.join(','), @@ -45,17 +47,12 @@ export function getMeasuresWithMetrics( }).catch(throwGlobalError); } -interface MeasuresAndMetaWithPeriod { - component: T.ComponentMeasure; - period: T.Period; -} - export function getMeasuresWithPeriod( component: string, metrics: string[], branchParameters?: BranchParameters ): Promise { - return getJSON('/api/measures/component', { + return getJSON(COMPONENT_URL, { additionalFields: 'period', component, metricKeys: metrics.join(','), @@ -68,7 +65,7 @@ export function getMeasuresWithPeriodAndMetrics( metrics: string[], branchParameters?: BranchParameters ): Promise { - return getJSON('/api/measures/component', { + return getJSON(COMPONENT_URL, { additionalFields: 'period,metrics', component, metricKeys: metrics.join(','), @@ -76,13 +73,6 @@ export function getMeasuresWithPeriodAndMetrics( }).catch(throwGlobalError); } -interface MeasuresForProjects { - component: string; - metric: string; - periods?: T.PeriodMeasure[]; - value?: string; -} - export function getMeasuresForProjects( projectKeys: string[], metricKeys: string[] diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/__snapshots__/ProjectInformation-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/__snapshots__/ProjectInformation-test.tsx.snap index 211df6ee16f..ccf3c69f46b 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/__snapshots__/ProjectInformation-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/__snapshots__/ProjectInformation-test.tsx.snap @@ -169,13 +169,11 @@ exports[`should render correctly: measures loaded 1`] = ` Object { "bestValue": true, "metric": "bugs", - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] diff --git a/server/sonar-web/src/main/js/apps/component-measures/__tests__/__snapshots__/utils-test.ts.snap b/server/sonar-web/src/main/js/apps/component-measures/__tests__/__snapshots__/utils-test.ts.snap index 4493d5a8038..607d0107af0 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/__tests__/__snapshots__/utils-test.ts.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/__tests__/__snapshots__/utils-test.ts.snap @@ -13,12 +13,10 @@ Array [ "name": "Lines to Cover", "type": "INT", }, - "periods": Array [ - Object { - "index": 1, - "value": "70", - }, - ], + "period": Object { + "index": 1, + "value": "70", + }, "value": "431", }, Object { @@ -30,12 +28,10 @@ Array [ "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "index": 1, - "value": "0.0999999999999943", - }, - ], + "period": Object { + "index": 1, + "value": "0.0999999999999943", + }, "value": "99.3", }, ], @@ -52,12 +48,10 @@ Array [ "name": "Duplicated Lines (%)", "type": "PERCENT", }, - "periods": Array [ - Object { - "index": 1, - "value": "0.0", - }, - ], + "period": Object { + "index": 1, + "value": "0.0", + }, "value": "3.2", }, ], diff --git a/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts index b507940e6fe..bdd5e0e028b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts @@ -31,7 +31,7 @@ const MEASURES = [ domain: 'Coverage' }, value: '431', - periods: [{ index: 1, value: '70' }], + period: { index: 1, value: '70' }, leak: '70' }, { @@ -43,7 +43,7 @@ const MEASURES = [ domain: 'Coverage' }, value: '99.3', - periods: [{ index: 1, value: '0.0999999999999943' }], + period: { index: 1, value: '0.0999999999999943' }, leak: '0.0999999999999943' }, { @@ -55,7 +55,7 @@ const MEASURES = [ domain: 'Duplications' }, value: '3.2', - periods: [{ index: 1, value: '0.0' }], + period: { index: 1, value: '0.0' }, leak: '0.0' } ]; @@ -163,17 +163,17 @@ describe('extract measure', () => { { metric: 'alert_status', value: '3.2', - periods: [{ index: 1, value: '0.0' }] + period: { index: 1, value: '0.0' } }, { metric: 'releasability_rating', value: '3.2', - periods: [{ index: 1, value: '0.0' }] + period: { index: 1, value: '0.0' } }, { metric: 'releasability_effort', value: '3.2', - periods: [{ index: 1, value: '0.0' }] + period: { index: 1, value: '0.0' } } ] }; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx index 73e6a4c22e5..81e4bdf340a 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx @@ -27,7 +27,7 @@ import { getMeasures } from '../../../api/measures'; import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import SourceViewer from '../../../components/SourceViewer/SourceViewer'; import { getBranchLikeQuery, isSameBranchLike } from '../../../helpers/branch-like'; -import { getPeriodValue, isDiffMetric } from '../../../helpers/measures'; +import { isDiffMetric } from '../../../helpers/measures'; import { getProjectUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; import { MetricKey } from '../../../types/metrics'; @@ -299,7 +299,7 @@ export default class MeasureContent extends React.PureComponent { } const measureValue = - measure && (isDiffMetric(measure.metric) ? getPeriodValue(measure, 1) : measure.value); + measure && (isDiffMetric(measure.metric) ? measure.period?.value : measure.value); const isFile = isFileType(baseComponent); const selectedIdx = this.getSelectedIndex(); diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx index 5df6baee14a..1350eb20b56 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx @@ -123,7 +123,7 @@ export default class FilesView extends React.PureComponent { const { metric } = this.props; const focusedMeasure = component.measures.find(measure => measure.metric.key === metric.key); if (focusedMeasure && isDiffMetric(metric.key)) { - return isPeriodBestValue(focusedMeasure, 1); + return isPeriodBestValue(focusedMeasure); } return Boolean(focusedMeasure && focusedMeasure.bestValue); }; diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx index f4c6ef105a4..289c7437d14 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx @@ -87,7 +87,7 @@ function shallowRender(props: Partial = {}) { domain: 'Reliability' }, value: '5', - periods: [{ index: 1, value: '5' }], + period: { index: 1, value: '5' }, leak: '5' }, { @@ -98,7 +98,7 @@ function shallowRender(props: Partial = {}) { name: 'New Bugs', domain: 'Reliability' }, - periods: [{ index: 1, value: '5' }], + period: { index: 1, value: '5' }, leak: '5' } ] diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx index 65bc657dd77..d6cdf337a93 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx @@ -30,7 +30,7 @@ const MEASURE = { domain: 'Reliability' }, value: '5', - periods: [{ index: 1, value: '5' }], + period: { index: 1, value: '5' }, leak: '5' }; const LEAK_MEASURE = { @@ -41,7 +41,7 @@ const LEAK_MEASURE = { name: 'New Bugs', domain: 'Reliability' }, - periods: [{ index: 1, value: '5' }], + period: { index: 1, value: '5' }, leak: '5' }; diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx index 461d7d59c9f..cf070d272b1 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx @@ -47,7 +47,7 @@ function shallowRender(props = {}) { domain: 'Coverage' }, value: '431', - periods: [{ index: 1, value: '70' }], + period: { index: 1, value: '70' }, leak: '70' }, { @@ -59,7 +59,7 @@ function shallowRender(props = {}) { domain: 'Coverage' }, value: '99.3', - periods: [{ index: 1, value: '0.0999999999999943' }], + period: { index: 1, value: '0.0999999999999943' }, leak: '0.0999999999999943' }, { @@ -71,7 +71,7 @@ function shallowRender(props = {}) { domain: 'Duplications' }, value: '3.2', - periods: [{ index: 1, value: '0.0' }], + period: { index: 1, value: '0.0' }, leak: '0.0' } ]} diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.tsx.snap index 8fbc7721286..11dab834f4b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/DomainFacet-test.tsx.snap @@ -71,12 +71,10 @@ exports[`should display facet item list 1`] = ` "name": "New Bugs", "type": "INT", }, - "periods": Array [ - Object { - "index": 1, - "value": "5", - }, - ], + "period": Object { + "index": 1, + "value": "5", + }, } } /> @@ -122,12 +120,10 @@ exports[`should display facet item list 1`] = ` "name": "Bugs", "type": "INT", }, - "periods": Array [ - Object { - "index": 1, - "value": "5", - }, - ], + "period": Object { + "index": 1, + "value": "5", + }, "value": "5", } } @@ -215,12 +211,10 @@ exports[`should display facet item list with bugs selected 1`] = ` "name": "New Bugs", "type": "INT", }, - "periods": Array [ - Object { - "index": 1, - "value": "5", - }, - ], + "period": Object { + "index": 1, + "value": "5", + }, } } /> @@ -266,12 +260,10 @@ exports[`should display facet item list with bugs selected 1`] = ` "name": "Bugs", "type": "INT", }, - "periods": Array [ - Object { - "index": 1, - "value": "5", - }, - ], + "period": Object { + "index": 1, + "value": "5", + }, "value": "5", } } diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.tsx.snap index e5b6c398f32..75e622da8f5 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/__snapshots__/Sidebar-test.tsx.snap @@ -25,12 +25,10 @@ exports[`should display two facets 1`] = ` "name": "Lines to Cover", "type": "INT", }, - "periods": Array [ - Object { - "index": 1, - "value": "70", - }, - ], + "period": Object { + "index": 1, + "value": "70", + }, "value": "431", }, Object { @@ -42,12 +40,10 @@ exports[`should display two facets 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "index": 1, - "value": "0.0999999999999943", - }, - ], + "period": Object { + "index": 1, + "value": "0.0999999999999943", + }, "value": "99.3", }, ], @@ -74,12 +70,10 @@ exports[`should display two facets 1`] = ` "name": "Duplicated Lines (%)", "type": "PERCENT", }, - "periods": Array [ - Object { - "index": 1, - "value": "0.0", - }, - ], + "period": Object { + "index": 1, + "value": "0.0", + }, "value": "3.2", }, ], 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 a5f60fd235e..8981816952b 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 @@ -67,7 +67,7 @@ jest.mock('../../../../api/measures', () => { measures.push( mockMeasure({ metric: key, - ...(isDiffMetric(key) ? { leak: '1' } : { periods: undefined }) + ...(isDiffMetric(key) ? { leak: '1' } : { period: undefined }) }) ); }); 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 19e732ab810..652aa74202f 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 @@ -69,13 +69,11 @@ exports[`should render correctly 1`] = ` }, ], "metric": "bugs", - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -241,13 +239,11 @@ exports[`should render correctly 2`] = ` }, ], "metric": "bugs", - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverview-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverview-test.tsx.snap index af58cd3e38a..65a67fdbc66 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverview-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverview-test.tsx.snap @@ -109,7 +109,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "alert_status", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -120,7 +120,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "quality_gate_details", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -131,7 +131,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "bugs", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -143,13 +143,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -160,7 +158,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "reliability_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -172,13 +170,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_reliability_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -189,7 +185,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "vulnerabilities", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -201,13 +197,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_vulnerabilities", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -218,7 +212,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "security_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -230,13 +224,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_security_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -247,7 +239,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "security_hotspots", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -259,13 +251,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_security_hotspots", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -276,7 +266,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "security_hotspots_reviewed", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -288,13 +278,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_security_hotspots_reviewed", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -305,7 +293,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "security_review_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -317,13 +305,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_security_review_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -334,7 +320,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "code_smells", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -346,13 +332,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_code_smells", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -363,7 +347,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "sqale_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -375,13 +359,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_maintainability_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -392,7 +374,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "sqale_index", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -404,13 +386,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_technical_debt", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -421,7 +401,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "coverage", "type": "PERCENT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -433,13 +413,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -450,7 +428,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "lines_to_cover", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -462,13 +440,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_lines_to_cover", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -479,7 +455,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "tests", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -490,7 +466,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "duplicated_lines_density", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -502,13 +478,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_duplicated_lines_density", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -519,7 +493,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "duplicated_blocks", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -530,7 +504,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "ncloc", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -541,7 +515,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "ncloc_language_distribution", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -552,7 +526,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "projects", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -563,7 +537,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "lines", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -575,13 +549,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_lines", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -877,7 +849,7 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "coverage", "type": "PERCENT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, "metric": "coverage", @@ -897,13 +869,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -931,13 +901,11 @@ exports[`application overview should fetch correctly other branch 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -1063,7 +1031,7 @@ exports[`application overview should render correctly 1`] = ` "name": "alert_status", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1074,7 +1042,7 @@ exports[`application overview should render correctly 1`] = ` "name": "quality_gate_details", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1085,7 +1053,7 @@ exports[`application overview should render correctly 1`] = ` "name": "bugs", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1097,13 +1065,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1114,7 +1080,7 @@ exports[`application overview should render correctly 1`] = ` "name": "reliability_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1126,13 +1092,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_reliability_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1143,7 +1107,7 @@ exports[`application overview should render correctly 1`] = ` "name": "vulnerabilities", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1155,13 +1119,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_vulnerabilities", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1172,7 +1134,7 @@ exports[`application overview should render correctly 1`] = ` "name": "security_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1184,13 +1146,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_security_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1201,7 +1161,7 @@ exports[`application overview should render correctly 1`] = ` "name": "security_hotspots", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1213,13 +1173,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_security_hotspots", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1230,7 +1188,7 @@ exports[`application overview should render correctly 1`] = ` "name": "security_hotspots_reviewed", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1242,13 +1200,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_security_hotspots_reviewed", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1259,7 +1215,7 @@ exports[`application overview should render correctly 1`] = ` "name": "security_review_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1271,13 +1227,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_security_review_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1288,7 +1242,7 @@ exports[`application overview should render correctly 1`] = ` "name": "code_smells", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1300,13 +1254,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_code_smells", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1317,7 +1269,7 @@ exports[`application overview should render correctly 1`] = ` "name": "sqale_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1329,13 +1281,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_maintainability_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1346,7 +1296,7 @@ exports[`application overview should render correctly 1`] = ` "name": "sqale_index", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1358,13 +1308,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_technical_debt", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1375,7 +1323,7 @@ exports[`application overview should render correctly 1`] = ` "name": "coverage", "type": "PERCENT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1387,13 +1335,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1404,7 +1350,7 @@ exports[`application overview should render correctly 1`] = ` "name": "lines_to_cover", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1416,13 +1362,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_lines_to_cover", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1433,7 +1377,7 @@ exports[`application overview should render correctly 1`] = ` "name": "tests", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1444,7 +1388,7 @@ exports[`application overview should render correctly 1`] = ` "name": "duplicated_lines_density", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1456,13 +1400,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_duplicated_lines_density", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1473,7 +1415,7 @@ exports[`application overview should render correctly 1`] = ` "name": "duplicated_blocks", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1484,7 +1426,7 @@ exports[`application overview should render correctly 1`] = ` "name": "ncloc", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1495,7 +1437,7 @@ exports[`application overview should render correctly 1`] = ` "name": "ncloc_language_distribution", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1506,7 +1448,7 @@ exports[`application overview should render correctly 1`] = ` "name": "projects", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1517,7 +1459,7 @@ exports[`application overview should render correctly 1`] = ` "name": "lines", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -1529,13 +1471,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_lines", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1831,7 +1771,7 @@ exports[`application overview should render correctly 1`] = ` "name": "coverage", "type": "PERCENT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, "metric": "coverage", @@ -1851,13 +1791,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -1885,13 +1823,11 @@ exports[`application overview should render correctly 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -2010,7 +1946,7 @@ exports[`project overview should render correctly 1`] = ` "name": "alert_status", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2021,7 +1957,7 @@ exports[`project overview should render correctly 1`] = ` "name": "quality_gate_details", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2032,7 +1968,7 @@ exports[`project overview should render correctly 1`] = ` "name": "bugs", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2044,13 +1980,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2061,7 +1995,7 @@ exports[`project overview should render correctly 1`] = ` "name": "reliability_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2073,13 +2007,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_reliability_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2090,7 +2022,7 @@ exports[`project overview should render correctly 1`] = ` "name": "vulnerabilities", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2102,13 +2034,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_vulnerabilities", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2119,7 +2049,7 @@ exports[`project overview should render correctly 1`] = ` "name": "security_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2131,13 +2061,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_security_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2148,7 +2076,7 @@ exports[`project overview should render correctly 1`] = ` "name": "security_hotspots", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2160,13 +2088,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_security_hotspots", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2177,7 +2103,7 @@ exports[`project overview should render correctly 1`] = ` "name": "security_hotspots_reviewed", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2189,13 +2115,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_security_hotspots_reviewed", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2206,7 +2130,7 @@ exports[`project overview should render correctly 1`] = ` "name": "security_review_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2218,13 +2142,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_security_review_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2235,7 +2157,7 @@ exports[`project overview should render correctly 1`] = ` "name": "code_smells", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2247,13 +2169,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_code_smells", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2264,7 +2184,7 @@ exports[`project overview should render correctly 1`] = ` "name": "sqale_rating", "type": "RATING", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2276,13 +2196,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_maintainability_rating", "type": "RATING", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2293,7 +2211,7 @@ exports[`project overview should render correctly 1`] = ` "name": "sqale_index", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2305,13 +2223,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_technical_debt", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2322,7 +2238,7 @@ exports[`project overview should render correctly 1`] = ` "name": "coverage", "type": "PERCENT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2334,13 +2250,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2351,7 +2265,7 @@ exports[`project overview should render correctly 1`] = ` "name": "lines_to_cover", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2363,13 +2277,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_lines_to_cover", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2380,7 +2292,7 @@ exports[`project overview should render correctly 1`] = ` "name": "tests", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2391,7 +2303,7 @@ exports[`project overview should render correctly 1`] = ` "name": "duplicated_lines_density", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2403,13 +2315,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_duplicated_lines_density", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2420,7 +2330,7 @@ exports[`project overview should render correctly 1`] = ` "name": "duplicated_blocks", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2431,7 +2341,7 @@ exports[`project overview should render correctly 1`] = ` "name": "ncloc", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2442,7 +2352,7 @@ exports[`project overview should render correctly 1`] = ` "name": "ncloc_language_distribution", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2453,7 +2363,7 @@ exports[`project overview should render correctly 1`] = ` "name": "projects", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2464,7 +2374,7 @@ exports[`project overview should render correctly 1`] = ` "name": "lines", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, Object { @@ -2476,13 +2386,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_lines", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2784,13 +2692,11 @@ exports[`project overview should render correctly 1`] = ` "name": "new_bugs", "type": "INT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -2809,7 +2715,7 @@ exports[`project overview should render correctly 1`] = ` "name": "bugs", "type": "INT", }, - "periods": undefined, + "period": undefined, "value": "1.0", }, "metric": "bugs", diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverviewRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverviewRenderer-test.tsx.snap index a45e5e85cb3..9caecddb2bd 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverviewRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/BranchOverviewRenderer-test.tsx.snap @@ -93,13 +93,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -203,13 +201,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -312,13 +308,11 @@ exports[`should render correctly 3`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanel-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanel-test.tsx.snap index d147379a768..dec79947e5e 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanel-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanel-test.tsx.snap @@ -96,13 +96,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -114,13 +112,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -132,13 +128,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -150,13 +144,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -208,13 +200,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -226,13 +216,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -244,13 +232,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -262,13 +248,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -320,13 +304,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -338,13 +320,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -356,13 +336,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -374,13 +352,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -432,13 +408,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -450,13 +424,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -468,13 +440,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -486,13 +456,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -550,13 +518,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -568,13 +534,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -586,13 +550,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -604,13 +566,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -666,13 +626,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -684,13 +642,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -702,13 +658,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -720,13 +674,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -836,13 +788,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -854,13 +804,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -872,13 +820,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -890,13 +836,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -948,13 +892,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -966,13 +908,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -984,13 +924,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1002,13 +940,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1060,13 +996,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1078,13 +1012,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1096,13 +1028,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1114,13 +1044,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1172,13 +1100,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1190,13 +1116,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1208,13 +1132,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1226,13 +1148,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1290,13 +1210,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1308,13 +1226,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1326,13 +1242,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1344,13 +1258,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1404,13 +1316,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1422,13 +1332,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1440,13 +1348,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1458,13 +1364,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1520,13 +1424,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1538,13 +1440,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1556,13 +1456,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1574,13 +1472,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1634,13 +1530,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1652,13 +1546,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1670,13 +1562,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1688,13 +1578,11 @@ exports[`should render correctly for applications 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1804,13 +1692,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1822,13 +1708,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1840,13 +1724,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1858,13 +1740,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1916,13 +1796,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1934,13 +1812,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1952,13 +1828,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1970,13 +1844,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2028,13 +1900,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2046,13 +1916,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2064,13 +1932,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2082,13 +1948,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2140,13 +2004,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2158,13 +2020,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2176,13 +2036,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2194,13 +2052,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2258,13 +2114,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2276,13 +2130,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2294,13 +2146,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2312,13 +2162,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2374,13 +2222,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2392,13 +2238,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2408,15 +2252,13 @@ exports[`should render correctly for projects 1`] = ` "id": "bugs", "key": "bugs", "name": "Bugs", - "type": "PERCENT", - }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "type": "PERCENT", + }, + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2428,13 +2270,11 @@ exports[`should render correctly for projects 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2544,13 +2384,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2562,13 +2400,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2580,13 +2416,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2598,13 +2432,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2656,13 +2488,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2674,13 +2504,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2692,13 +2520,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2710,13 +2536,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2768,13 +2592,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2786,13 +2608,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2804,13 +2624,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2822,13 +2640,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2880,13 +2696,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2898,13 +2712,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2916,13 +2728,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2934,13 +2744,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2998,13 +2806,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3016,13 +2822,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3034,13 +2838,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3052,13 +2854,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3112,13 +2912,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3130,13 +2928,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3148,13 +2944,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3166,13 +2960,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3228,13 +3020,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3246,13 +3036,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3264,13 +3052,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3282,13 +3068,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3342,13 +3126,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3360,13 +3142,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3378,13 +3158,11 @@ exports[`should render correctly for projects 2`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3396,13 +3174,11 @@ exports[`should render correctly for projects 2`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3748,13 +3524,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3766,13 +3540,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3824,13 +3596,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3842,13 +3612,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3900,13 +3668,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3918,13 +3684,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -3976,13 +3740,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -3994,13 +3756,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -4057,13 +3817,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -4075,13 +3833,11 @@ exports[`should render correctly if there is no coverage 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelIssueMeasureRow-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelIssueMeasureRow-test.tsx.snap index c2ce6a22934..39b67ec8b20 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelIssueMeasureRow-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelIssueMeasureRow-test.tsx.snap @@ -51,13 +51,11 @@ exports[`should render correctly for apps: new code 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -69,13 +67,11 @@ exports[`should render correctly for apps: new code 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -87,13 +83,11 @@ exports[`should render correctly for apps: new code 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -105,13 +99,11 @@ exports[`should render correctly for apps: new code 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -174,13 +166,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -192,13 +182,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -210,13 +198,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -228,13 +214,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -289,13 +273,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -307,13 +289,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -325,13 +305,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -343,13 +321,11 @@ exports[`should render correctly for apps: overview 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -412,13 +388,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -430,13 +404,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -448,13 +420,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -466,13 +436,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -527,13 +495,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -545,13 +511,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -563,13 +527,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -581,13 +543,11 @@ exports[`should render correctly for projects: Bug 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -650,13 +610,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -668,13 +626,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -686,13 +642,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -704,13 +658,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -764,13 +716,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -782,13 +732,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -800,13 +748,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -818,13 +764,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -879,13 +823,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -897,13 +839,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -915,13 +855,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -933,13 +871,11 @@ exports[`should render correctly for projects: Code Smell 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1003,13 +939,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1021,13 +955,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1039,13 +971,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1057,13 +987,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1087,13 +1015,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1105,13 +1031,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1123,13 +1047,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1141,13 +1063,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1201,13 +1121,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1219,13 +1137,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1237,13 +1153,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1255,13 +1169,11 @@ exports[`should render correctly for projects: Hotspot 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1324,13 +1236,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1342,13 +1252,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1360,13 +1268,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1378,13 +1284,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1439,13 +1343,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1457,13 +1359,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1475,13 +1375,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1493,13 +1391,11 @@ exports[`should render correctly for projects: Overview 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1562,13 +1458,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1580,13 +1474,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1598,13 +1490,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1616,13 +1506,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1677,13 +1565,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1695,13 +1581,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "New_coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1713,13 +1597,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "Bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1731,13 +1613,11 @@ exports[`should render correctly for projects: Vulnerabilty 1`] = ` "name": "New_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanel-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanel-test.tsx.snap index e2db924120d..1e720788806 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanel-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanel-test.tsx.snap @@ -76,13 +76,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "foo", @@ -137,13 +135,11 @@ exports[`should render correctly for applications 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "foo", @@ -162,13 +158,11 @@ exports[`should render correctly for applications 1`] = ` "name": "New_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_code_smells", @@ -263,13 +257,11 @@ exports[`should render correctly for applications 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "foo", @@ -399,13 +391,11 @@ exports[`should render correctly for projects 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "foo", @@ -551,13 +541,11 @@ exports[`should render correctly for projects 3`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "foo", diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanelSection-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanelSection-test.tsx.snap index 862ea8b1930..99121173ca4 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanelSection-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/QualityGatePanelSection-test.tsx.snap @@ -26,13 +26,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "bugs", @@ -51,13 +49,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -85,13 +81,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -122,13 +116,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "bugs", @@ -147,13 +139,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -181,13 +171,11 @@ exports[`should render correctly 1`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "bugs", @@ -230,13 +218,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "bugs", @@ -255,13 +241,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -289,13 +273,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -326,13 +308,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "bugs", @@ -351,13 +331,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_bugs", @@ -385,13 +363,11 @@ exports[`should render correctly 2`] = ` "name": "Coverage", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "bugs", diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx index 01ef15f7917..97253ee00bd 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx @@ -26,7 +26,7 @@ import { formatMeasure } from 'sonar-ui-common/helpers/measures'; import Measure from '../../../components/measure/Measure'; import DrilldownLink from '../../../components/shared/DrilldownLink'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; -import { getPeriodValue, isDiffMetric } from '../../../helpers/measures'; +import { isDiffMetric } from '../../../helpers/measures'; import { getComponentIssuesUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; @@ -120,9 +120,7 @@ export default class QualityGateCondition extends React.PureComponent { const isDiff = isDiffMetric(metric.key); const threshold = (condition.level === 'ERROR' ? condition.error : condition.warning) as string; - const actual = (condition.period - ? getPeriodValue(measure, condition.period) - : measure.value) as string; + const actual = (condition.period ? measure.period?.value : measure.value) as string; let operator = translate('quality_gates.operator', condition.op); diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx index 42105cac517..4cd6ab61ca0 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx @@ -102,7 +102,7 @@ function quickMock( type }), value: '3', - ...(addPeriod ? { periods: [{ value: '3', index: 1 }] } : {}) + ...(addPeriod ? { period: { value: '3', index: 1 } } : {}) }, metric, ...(addPeriod ? { period: 1 } : {}) diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/PullRequestOverview-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/PullRequestOverview-test.tsx.snap index 267d6b7bd55..1ba05b2bde0 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/PullRequestOverview-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/PullRequestOverview-test.tsx.snap @@ -106,13 +106,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, "metric": "new_code_smells", @@ -185,13 +183,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -202,13 +198,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -219,13 +213,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -236,13 +228,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -298,13 +288,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -315,13 +303,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -332,13 +318,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -349,13 +333,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -416,13 +398,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -433,13 +413,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -450,13 +428,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -467,13 +443,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -529,13 +503,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -546,13 +518,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -563,13 +533,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -580,13 +548,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -647,13 +613,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -664,13 +628,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -681,13 +643,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -698,13 +658,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -760,13 +718,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -777,13 +733,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -794,13 +748,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -811,13 +763,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -878,13 +828,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -895,13 +843,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -912,13 +858,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -929,13 +873,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -991,13 +933,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1008,13 +948,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1025,13 +963,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1042,13 +978,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1109,13 +1043,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1126,13 +1058,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1143,13 +1073,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1160,13 +1088,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1187,13 +1113,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1204,13 +1128,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1221,13 +1143,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1238,13 +1158,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1303,13 +1221,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1320,13 +1236,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1337,13 +1251,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1354,13 +1266,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1381,13 +1291,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1398,13 +1306,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1415,13 +1321,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1432,13 +1336,11 @@ exports[`should render correctly for a failed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1564,13 +1466,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1581,13 +1481,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1598,13 +1496,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1615,13 +1511,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1677,13 +1571,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1694,13 +1586,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1711,13 +1601,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1728,13 +1616,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1795,13 +1681,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1812,13 +1696,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1829,13 +1711,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1846,13 +1726,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -1908,13 +1786,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1925,13 +1801,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1942,13 +1816,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -1959,13 +1831,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2026,13 +1896,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2043,13 +1911,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2060,13 +1926,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2077,13 +1941,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2139,13 +2001,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2156,13 +2016,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2173,13 +2031,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2190,13 +2046,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2257,13 +2111,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2274,13 +2126,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2291,13 +2141,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2308,13 +2156,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2370,13 +2216,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2387,13 +2231,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2404,13 +2246,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2421,13 +2261,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2488,13 +2326,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2505,13 +2341,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2522,13 +2356,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2539,13 +2371,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2566,13 +2396,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2583,13 +2411,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2600,13 +2426,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2617,13 +2441,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2682,13 +2504,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2699,13 +2519,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2716,13 +2534,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2733,13 +2549,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] @@ -2760,13 +2574,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_bugs", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2777,13 +2589,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_vulnerabilities", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2794,13 +2604,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_code_smells", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, Object { @@ -2811,13 +2619,11 @@ exports[`should render correctly for a passed QG 1`] = ` "name": "new_security_hotspots", "type": "PERCENT", }, - "periods": Array [ - Object { - "bestValue": true, - "index": 1, - "value": "1.0", - }, - ], + "period": Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, "value": "1.0", }, ] diff --git a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts index f61d62d3ead..247de5267ae 100644 --- a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts @@ -27,7 +27,7 @@ jest.mock('../../../api/components', () => ({ jest.mock('../../../api/measures', () => ({ getMeasuresForProjects: jest.fn().mockResolvedValue([ - { component: 'foo', metric: 'new_coverage', periods: [{ index: 1, value: '10' }] }, + { component: 'foo', metric: 'new_coverage', period: { index: 1, value: '10' } }, { component: 'bar', metric: 'languages', value: '20' } ]) })); diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts index 753a9c457d0..7f0f6d097e7 100644 --- a/server/sonar-web/src/main/js/apps/projects/utils.ts +++ b/server/sonar-web/src/main/js/apps/projects/utils.ts @@ -23,7 +23,7 @@ import { RequestData } from 'sonar-ui-common/helpers/request'; import { Facet, searchProjects } from '../../api/components'; import { getMeasuresForProjects } from '../../api/measures'; import { getOrganizations } from '../../api/organizations'; -import { getPeriodValue, isDiffMetric } from '../../helpers/measures'; +import { isDiffMetric } from '../../helpers/measures'; import { MetricKey } from '../../types/metrics'; import { convertToFilter, Query } from './query'; @@ -225,9 +225,7 @@ export function fetchProjects( measures .filter(measure => measure.component === component.key) .forEach(measure => { - const value = isDiffMetric(measure.metric) - ? getPeriodValue(measure, 1) - : measure.value; + const value = isDiffMetric(measure.metric) ? measure.period?.value : measure.value; if (value !== undefined) { componentMeasures[measure.metric] = value; } diff --git a/server/sonar-web/src/main/js/components/measure/utils.ts b/server/sonar-web/src/main/js/components/measure/utils.ts index 6d07dcb1b05..05895c358d2 100644 --- a/server/sonar-web/src/main/js/components/measure/utils.ts +++ b/server/sonar-web/src/main/js/components/measure/utils.ts @@ -18,7 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { getRatingTooltip as nextGetRatingTooltip, isDiffMetric } from '../../helpers/measures'; -import { getLeakPeriod } from '../../helpers/periods'; const KNOWN_RATINGS = [ 'sqale_rating', @@ -37,11 +36,7 @@ export function enhanceMeasure(measure: T.Measure, metrics: T.Dict): T } export function getLeakValue(measure: T.MeasureIntern | undefined): string | undefined { - if (!measure || !measure.periods) { - return undefined; - } - const period = getLeakPeriod(measure.periods); - return period && period.value; + return measure?.period?.value; } export function getRatingTooltip(metricKey: string, value: number): string | undefined { diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts index ea9bffaf05a..4b5506f1d78 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts @@ -17,14 +17,14 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { enhanceConditionWithMeasure } from '../measures'; +import { enhanceConditionWithMeasure, isPeriodBestValue } from '../measures'; import { mockQualityGateStatusCondition } from '../mocks/quality-gates'; import { mockMeasureEnhanced, mockMetric } from '../testMocks'; describe('enhanceConditionWithMeasure', () => { it('should correctly map enhance conditions with measure data', () => { const measures = [ - mockMeasureEnhanced({ metric: mockMetric({ key: 'bugs' }), periods: undefined }), + mockMeasureEnhanced({ metric: mockMetric({ key: 'bugs' }), period: undefined }), mockMeasureEnhanced({ metric: mockMetric({ key: 'new_bugs' }) }) ]; @@ -48,3 +48,19 @@ describe('enhanceConditionWithMeasure', () => { expect(enhanceConditionWithMeasure(mockQualityGateStatusCondition(), [])).toBeUndefined(); }); }); + +describe('isPeriodBestValue', () => { + it('should work as expected', () => { + expect(isPeriodBestValue(mockMeasureEnhanced({ period: undefined }))).toBe(false); + expect( + isPeriodBestValue( + mockMeasureEnhanced({ period: { index: 1, value: '1.0', bestValue: false } }) + ) + ).toBe(false); + expect( + isPeriodBestValue( + mockMeasureEnhanced({ period: { index: 1, value: '1.0', bestValue: true } }) + ) + ).toBe(true); + }); +}); diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts index 0c180278b2c..6b08e3dd663 100644 --- a/server/sonar-web/src/main/js/helpers/measures.ts +++ b/server/sonar-web/src/main/js/helpers/measures.ts @@ -62,30 +62,15 @@ export function enhanceConditionWithMeasure( // Make sure we have a period index. This is necessary when dealing with // applications. let { period } = condition; - if (measure && measure.periods && !period) { - period = measure.periods[0].index; + if (measure && measure.period && !period) { + period = measure.period.index; } return measure && { ...condition, period, measure }; } -/** Get period value of a measure */ -export function getPeriodValue( - measure: T.Measure | T.MeasureEnhanced, - periodIndex: number -): string | undefined { - const { periods } = measure; - const period = periods && periods.find(period => period.index === periodIndex); - return period ? period.value : undefined; -} - -export function isPeriodBestValue( - measure: T.Measure | T.MeasureEnhanced, - periodIndex: number -): boolean { - const { periods } = measure; - const period = periods && periods.find(period => period.index === periodIndex); - return (period && period.bestValue) || false; +export function isPeriodBestValue(measure: T.Measure | T.MeasureEnhanced): boolean { + return measure.period?.bestValue || false; } /** Check if metric is differential */ diff --git a/server/sonar-web/src/main/js/helpers/periods.ts b/server/sonar-web/src/main/js/helpers/periods.ts index 8d714909592..b94b75275bf 100644 --- a/server/sonar-web/src/main/js/helpers/periods.ts +++ b/server/sonar-web/src/main/js/helpers/periods.ts @@ -21,17 +21,6 @@ import { parseDate } from 'sonar-ui-common/helpers/dates'; import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import { ApplicationPeriod } from '../types/application'; -function getPeriod(periods: T[] | undefined, index: number) { - if (!Array.isArray(periods)) { - return undefined; - } - return periods.find(period => period.index === index); -} - -export function getLeakPeriod(periods: T[] | undefined) { - return getPeriod(periods, 1); -} - export function getPeriodLabel( period: T.Period | undefined, dateFormatter: (date: string) => string diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts index 9fa4ab66780..f1bf1cc7fcf 100644 --- a/server/sonar-web/src/main/js/helpers/testMocks.ts +++ b/server/sonar-web/src/main/js/helpers/testMocks.ts @@ -470,13 +470,11 @@ export function mockMeasure(overrides: Partial = {}): T.Measure { return { bestValue: true, metric: 'bugs', - periods: [ - { - bestValue: true, - index: 1, - value: '1.0' - } - ], + period: { + bestValue: true, + index: 1, + value: '1.0' + }, value: '1.0', ...overrides }; @@ -487,13 +485,11 @@ export function mockMeasureEnhanced(overrides: Partial = {}): bestValue: true, leak: '1', metric: mockMetric({ ...(overrides.metric || {}) }), - periods: [ - { - bestValue: true, - index: 1, - value: '1.0' - } - ], + period: { + bestValue: true, + index: 1, + value: '1.0' + }, value: '1.0', ...overrides }; diff --git a/server/sonar-web/src/main/js/types/measures.ts b/server/sonar-web/src/main/js/types/measures.ts new file mode 100644 index 00000000000..a99bed5d0c7 --- /dev/null +++ b/server/sonar-web/src/main/js/types/measures.ts @@ -0,0 +1,35 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +export interface MeasuresForProjects { + component: string; + metric: string; + period?: T.PeriodMeasure; + value?: string; +} + +export interface MeasuresAndMetaWithMetrics { + component: T.ComponentMeasure; + metrics: T.Metric[]; +} + +export interface MeasuresAndMetaWithPeriod { + component: T.ComponentMeasure; + period: T.Period; +} diff --git a/server/sonar-web/src/main/js/types/types.d.ts b/server/sonar-web/src/main/js/types/types.d.ts index 9f92aa7cd85..687fb81f70a 100644 --- a/server/sonar-web/src/main/js/types/types.d.ts +++ b/server/sonar-web/src/main/js/types/types.d.ts @@ -452,7 +452,7 @@ declare namespace T { interface MeasureIntern { bestValue?: boolean; - periods?: PeriodMeasure[]; + period?: PeriodMeasure; value?: string; } -- 2.39.5