From 31f4bf37272da9cbb703c5c104ad5412239fe39b Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 29 May 2020 15:32:36 +0200 Subject: SONAR-13391 handle missing newcode --- .../js/apps/overview/branches/BranchOverview.tsx | 5 +- .../overview/branches/BranchOverviewRenderer.tsx | 12 +- .../js/apps/overview/branches/MeasuresPanel.tsx | 118 +- .../branches/MeasuresPanelIssueMeasureRow.tsx | 100 + .../overview/branches/MeasuresPanelNoNewCode.tsx | 102 + .../branches/__tests__/MeasuresPanel-test.tsx | 27 +- .../MeasuresPanelIssueMeasureRow-test.tsx | 62 + .../__tests__/MeasuresPanelNoNewCode-test.tsx | 101 + .../__snapshots__/BranchOverview-test.tsx.snap | 28 +- .../__snapshots__/MeasuresPanel-test.tsx.snap | 8432 +++++++------------- .../MeasuresPanelIssueMeasureRow-test.tsx.snap | 1750 ++++ .../MeasuresPanelNoNewCode-test.tsx.snap | 89 + 12 files changed, 5192 insertions(+), 5634 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx create mode 100644 server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx create mode 100644 server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelIssueMeasureRow-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap (limited to 'server/sonar-web/src/main/js/apps') diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx index 6268623fb94..80a41ecc993 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx @@ -403,8 +403,6 @@ export default class BranchOverview extends React.PureComponent { qgStatuses } = this.state; - const leakPeriod = component.qualifier === ComponentQualifier.Application ? appLeak : period; - const projectIsEmpty = loadingStatus === false && (measures === undefined || @@ -415,16 +413,17 @@ export default class BranchOverview extends React.PureComponent { return ( diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx index 45b0f93ce0f..58443d64bd4 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx @@ -22,6 +22,7 @@ import { parseDate } from 'sonar-ui-common/helpers/dates'; import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import { ApplicationPeriod } from '../../../types/application'; import { BranchLike } from '../../../types/branch-like'; +import { ComponentQualifier } from '../../../types/component'; import { GraphType, MeasureHistory } from '../../../types/project-activity'; import { QualityGateStatus } from '../../../types/quality-gates'; import ActivityPanel from './ActivityPanel'; @@ -31,16 +32,17 @@ import QualityGatePanel from './QualityGatePanel'; export interface BranchOverviewRendererProps { analyses?: T.Analysis[]; + appLeak?: ApplicationPeriod; branchLike?: BranchLike; component: T.Component; graph?: GraphType; - leakPeriod?: T.Period | ApplicationPeriod; loadingHistory?: boolean; loadingStatus?: boolean; measures?: T.MeasureEnhanced[]; measuresHistory?: MeasureHistory[]; metrics?: T.Metric[]; onGraphChange: (graph: GraphType) => void; + period?: T.Period; projectIsEmpty?: boolean; qgStatuses?: QualityGateStatus[]; } @@ -48,20 +50,23 @@ export interface BranchOverviewRendererProps { export function BranchOverviewRenderer(props: BranchOverviewRendererProps) { const { analyses, + appLeak, branchLike, component, graph, - leakPeriod, loadingHistory, loadingStatus, measures, measuresHistory = [], metrics = [], onGraphChange, + period, projectIsEmpty, qgStatuses } = props; + const leakPeriod = component.qualifier === ComponentQualifier.Application ? appLeak : period; + return (
@@ -82,11 +87,12 @@ export function BranchOverviewRenderer(props: BranchOverviewRendererProps) {
isDiffMetric(m.metric.key)); const isApp = component.qualifier === ComponentQualifier.Application; + const leakPeriod = isApp ? appLeak : period; const [tab, selectTab] = React.useState(MeasuresPanelTabs.New); @@ -109,34 +106,11 @@ export function MeasuresPanel(props: MeasuresPanelProps) {
{!hasDiffMeasures && isNewCodeTab ? ( -
- -
-

- {translate('overview.measures.empty_explanation')} -

-

- - {translate('learn_more')} - - ) - }} - /> -

-
-
+ ) : ( <> {[ @@ -145,68 +119,14 @@ export function MeasuresPanel(props: MeasuresPanelProps) { IssueType.SecurityHotspot, IssueType.CodeSmell ].map((type: IssueType) => ( -
- {type === IssueType.CodeSmell ? ( - <> -
- -
-
- -
- - ) : ( -
- -
- )} - {type === IssueType.SecurityHotspot && ( -
- -
- )} - {(!isApp || tab === MeasuresPanelTabs.Overall) && ( -
- -
- )} -
+ ))}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx new file mode 100644 index 00000000000..dfe8795ce2c --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx @@ -0,0 +1,100 @@ +/* + * 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. + */ +import * as React from 'react'; +import { BranchLike } from '../../../types/branch-like'; +import { ComponentQualifier } from '../../../types/component'; +import IssueLabel from '../components/IssueLabel'; +import IssueRating from '../components/IssueRating'; +import { IssueType } from '../utils'; +import DebtValue from './DebtValue'; +import SecurityHotspotsReviewed from './SecurityHotspotsReviewed'; + +export interface MeasuresPanelIssueMeasureRowProps { + branchLike?: BranchLike; + component: T.Component; + isNewCodeTab: boolean; + measures: T.MeasureEnhanced[]; + type: IssueType; +} + +export default function MeasuresPanelIssueMeasureRow(props: MeasuresPanelIssueMeasureRowProps) { + const { branchLike, component, isNewCodeTab, measures, type } = props; + + const isApp = component.qualifier === ComponentQualifier.Application; + + return ( +
+ {type === IssueType.CodeSmell ? ( + <> +
+ +
+
+ +
+ + ) : ( +
+ +
+ )} + {type === IssueType.SecurityHotspot && ( +
+ +
+ )} + {(!isApp || !isNewCodeTab) && ( +
+ +
+ )} +
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx new file mode 100644 index 00000000000..71642f4f99a --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx @@ -0,0 +1,102 @@ +/* + * 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. + */ +import * as React from 'react'; +import { FormattedMessage } from 'react-intl'; +import { Link } from 'react-router'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import { getBaseUrl } from 'sonar-ui-common/helpers/urls'; +import { getBranchLikeQuery } from '../../../helpers/branch-like'; +import { BranchLike } from '../../../types/branch-like'; +import { ComponentQualifier } from '../../../types/component'; + +export interface MeasuresPanelNoNewCodeProps { + branchLike?: BranchLike; + component: T.Component; + period?: T.Period; +} + +export default function MeasuresPanelNoNewCode(props: MeasuresPanelNoNewCodeProps) { + const { branchLike, component, period } = props; + + const isApp = component.qualifier === ComponentQualifier.Application; + /* + * If the period is "reference branch"-based, and if there's no date, it means + * that we're not lacking a second analysis, but that we'll never have new code because the + * selected reference branch is itself, or has disappeared for some reason. + * Makes no sense for Apps (project aggregate) + */ + const hasBadNewCodeSetting = + !isApp && !!period && !period.date && period.mode === 'REFERENCE_BRANCH'; + + const showSettingsLink = !!(component.configuration && component.configuration.showSettings); + + return ( +
+ +
+

+ {hasBadNewCodeSetting + ? translate('overview.measures.bad_setting.explanation') + : translate('overview.measures.empty_explanation')} +

+ {hasBadNewCodeSetting ? ( + showSettingsLink && ( +

+ + {translate('settings.new_code_period.category')} + + ) + }} + /> +

+ ) + ) : ( +

+ + {translate('learn_more')} + + ) + }} + /> +

+ )} +
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx index c6bd613049b..9693016bbab 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx @@ -20,8 +20,13 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import BoxedTabs from 'sonar-ui-common/components/controls/BoxedTabs'; -import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; +import { + mockComponent, + mockMeasureEnhanced, + mockMetric, + mockPeriod +} from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { MeasuresPanel, MeasuresPanelProps, MeasuresPanelTabs } from '../MeasuresPanel'; @@ -53,6 +58,22 @@ it('should render correctly if there is no new code measures', () => { expect(wrapper).toMatchSnapshot(); }); +it('should render correctly if branch is misconfigured', () => { + const wrapper = shallowRender({ + branchLike: mockBranch({ name: 'own-reference' }), + measures: [ + mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }), + mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }) + ], + period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'own-reference' }) + }); + wrapper.find(BoxedTabs).prop('onSelect')(MeasuresPanelTabs.New); + expect(wrapper).toMatchSnapshot('hide settings'); + + wrapper.setProps({ component: mockComponent({ configuration: { showSettings: true } }) }); + expect(wrapper).toMatchSnapshot('show settings'); +}); + it('should render correctly if there is no coverage', () => { expect( shallowRender({ @@ -69,7 +90,7 @@ it('should render correctly if the data is still loading', () => { }); function shallowRender(props: Partial = {}) { - return shallow( + return shallow( { + expect(shallowRender({ type: IssueType.Bug })).toMatchSnapshot('Bug'); + expect(shallowRender({ type: IssueType.CodeSmell })).toMatchSnapshot('Code Smell'); + expect(shallowRender({ type: IssueType.SecurityHotspot })).toMatchSnapshot('Hotspot'); + expect(shallowRender({ type: IssueType.Vulnerability })).toMatchSnapshot('Vulnerabilty'); + expect(shallowRender({ isNewCodeTab: false })).toMatchSnapshot('Overview'); +}); + +it('should render correctly for apps', () => { + const app = mockComponent({ qualifier: ComponentQualifier.Application }); + + expect(shallowRender({ component: app })).toMatchSnapshot('new code'); + expect(shallowRender({ component: app, isNewCodeTab: false })).toMatchSnapshot('overview'); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx new file mode 100644 index 00000000000..a1c8a59e833 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx @@ -0,0 +1,101 @@ +/* + * 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. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; +import { mockComponent, mockPeriod } from '../../../../helpers/testMocks'; +import { ComponentQualifier } from '../../../../types/component'; +import MeasuresPanelNoNewCode, { MeasuresPanelNoNewCodeProps } from '../MeasuresPanelNoNewCode'; + +it('should render the default message', () => { + const defaultMessage = ` +
+ +
+

+ overview.measures.empty_explanation +

+

+ + learn_more + , + } + } + /> +

+
+
+`; + + expect(shallowRender()).toMatchInlineSnapshot(defaultMessage); + expect( + shallowRender({ component: mockComponent({ qualifier: ComponentQualifier.Application }) }) + ).toMatchInlineSnapshot(defaultMessage); + expect( + shallowRender({ period: mockPeriod({ date: '2018-05-23', mode: 'REFERENCE_BRANCH' }) }) + ).toMatchInlineSnapshot(defaultMessage); + expect( + shallowRender({ period: mockPeriod({ date: '2018-05-23', mode: 'PREVIOUS_VERSION' }) }) + ).toMatchInlineSnapshot(defaultMessage); +}); + +it('should render "bad code setting" explanation', () => { + const period = mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH' }); + expect(shallowRender({ period })).toMatchSnapshot('no link'); + expect( + shallowRender({ component: mockComponent({ configuration: { showSettings: true } }), period }) + ).toMatchSnapshot('with link'); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} 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 b41fbed0fa4..af58cd3e38a 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 @@ -36,6 +36,13 @@ exports[`application overview should fetch correctly other branch 1`] = ` }, ] } + appLeak={ + Object { + "date": "2017-01-05", + "project": "foo", + "projectName": "Foo", + } + } branchLike={ Object { "analysisDate": "2018-01-01", @@ -90,13 +97,6 @@ exports[`application overview should fetch correctly other branch 1`] = ` } } graph="coverage" - leakPeriod={ - Object { - "date": "2017-01-05", - "project": "foo", - "projectName": "Foo", - } - } loadingHistory={false} loadingStatus={false} measures={ @@ -990,6 +990,13 @@ exports[`application overview should render correctly 1`] = ` }, ] } + appLeak={ + Object { + "date": "2017-01-05", + "project": "foo", + "projectName": "Foo", + } + } branchLike={ Object { "analysisDate": "2018-01-01", @@ -1044,13 +1051,6 @@ exports[`application overview should render correctly 1`] = ` } } graph="coverage" - leakPeriod={ - Object { - "date": "2017-01-05", - "project": "foo", - "projectName": "Foo", - } - } loadingHistory={false} loadingStatus={false} measures={ 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 e6ac3a7b6b1..d147379a768 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 @@ -51,136 +51,462 @@ exports[`should render correctly for applications 1`] = `
-
-
- + + + -
-
+ ], + "value": "1.0", + }, + Object { + "bestValue": true, + "leak": "1", + "metric": Object { + "id": "bugs", + "key": "bugs", + "name": "Bugs", + "type": "PERCENT", + }, + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + Object { + "bestValue": true, + "leak": "1", + "metric": Object { + "id": "new_bugs", + "key": "new_bugs", + "name": "New_bugs", + "type": "PERCENT", + }, + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + ] + } + type="CODE_SMELL" + />
-
-
-
-
-
- +
+
+`; + +exports[`should render correctly for applications 2`] = ` +
+

+ overview.measures +

+ + + overview.new_code + +
, + }, + Object { + "key": 1, + "label":
+ + overview.overall_code + +
, + }, + ] + } + /> +
+ -
-
+ ], + "value": "1.0", + }, + Object { + "bestValue": true, + "leak": "1", + "metric": Object { + "id": "bugs", + "key": "bugs", + "name": "Bugs", + "type": "PERCENT", + }, + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + Object { + "bestValue": true, + "leak": "1", + "metric": Object { + "id": "new_bugs", + "key": "new_bugs", + "name": "New_bugs", + "type": "PERCENT", + }, + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + ] + } + type="BUG" + /> + + +
- -
-
- + + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + ] + } + metric="tests" + /> +
-
-
-
-
- + + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + ] + } + metric="duplicated_blocks" + /> +
`; -exports[`should render correctly for applications 2`] = ` +exports[`should render correctly for projects 1`] = `
+ + + +
-
-
+
+
+`; + +exports[`should render correctly for projects 2`] = ` +
+

+ overview.measures +

+ + + overview.new_code + +
, + }, + Object { + "key": 1, + "label":
+ + overview.overall_code + +
, + }, + ] + } + /> +
+ + + +
- -
-
- + + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + ] + } + metric="tests" + /> +
-
-
- -
-
- + -
-
- + ] + } + metric="duplicated_blocks" + /> +
-
-
- +
+`; + +exports[`should render correctly if branch is misconfigured: hide settings 1`] = ` +
+

+ overview.measures +

+ + + overview.new_code + + -
-
- -
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- - -`; - -exports[`should render correctly for projects 1`] = ` -
-

- overview.measures -

- - - overview.new_code - -
, - }, - Object { - "key": 1, - "label":
- - overview.overall_code - -
, - }, - ] - } - /> -
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
- -`; - -exports[`should render correctly for projects 2`] = ` -
-

- overview.measures -

- - - overview.new_code - -
, - }, - Object { - "key": 1, - "label":
- - overview.overall_code - -
, - }, - ] - } - /> -
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
-
- -`; - -exports[`should render correctly if the data is still loading 1`] = ` -
-

- overview.measures -

-
- -
-
-`; - -exports[`should render correctly if there is no coverage 1`] = ` -
-

- overview.measures -

- - - overview.new_code - -
, - }, - Object { - "key": 1, - "label":
- - overview.overall_code - -
, - }, - ] - } - /> -
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
- +
, + }, + Object { + "key": 1, + "label":
+ + overview.overall_code + +
, + }, + ] + } + /> +
+ +
+
+`; + +exports[`should render correctly if branch is misconfigured: show settings 1`] = ` +
+

+ overview.measures +

+ + + overview.new_code + + -
-
-
-
- +
, + }, + Object { + "key": 1, + "label":
+ + overview.overall_code + +
, + }, + ] + } + /> +
+ +
+
+`; + +exports[`should render correctly if the data is still loading 1`] = ` +
+

+ overview.measures +

+
+ +
+
+`; + +exports[`should render correctly if there is no coverage 1`] = ` +
+

+ overview.measures +

+ + + overview.new_code + +
, + }, + Object { + "key": 1, + "label":
+ + overview.overall_code + +
, + }, + ] + } + /> +
+ -
-
- + -
-
- + + -
- + ], + "value": "1.0", + }, + Object { + "bestValue": true, + "leak": "1", + "metric": Object { + "id": "new_bugs", + "key": "new_bugs", + "name": "New_bugs", + "type": "PERCENT", + }, + "periods": Array [ + Object { + "bestValue": true, + "index": 1, + "value": "1.0", + }, + ], + "value": "1.0", + }, + ] + } + type="CODE_SMELL" + />
@@ -6725,52 +4146,39 @@ exports[`should render correctly if there is no new code measures 1`] = `
-
- -
-

- overview.measures.empty_explanation -

-

- - learn_more - , - } - } - /> -

-
-
+ } + />
`; 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 new file mode 100644 index 00000000000..c2ce6a22934 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelIssueMeasureRow-test.tsx.snap @@ -0,0 +1,1750 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly for apps: new code 1`] = ` +
+
+ +
+
+`; + +exports[`should render correctly for apps: overview 1`] = ` +
+
+ +
+
+ +
+
+`; + +exports[`should render correctly for projects: Bug 1`] = ` +
+
+ +
+
+ +
+
+`; + +exports[`should render correctly for projects: Code Smell 1`] = ` +
+
+ +
+
+ +
+
+ +
+
+`; + +exports[`should render correctly for projects: Hotspot 1`] = ` +
+
+ +
+
+ +
+
+ +
+
+`; + +exports[`should render correctly for projects: Overview 1`] = ` +
+
+ +
+
+ +
+
+`; + +exports[`should render correctly for projects: Vulnerabilty 1`] = ` +
+
+ +
+
+ +
+
+`; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap new file mode 100644 index 00000000000..85573941439 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render "bad code setting" explanation: no link 1`] = ` +
+ +
+

+ overview.measures.bad_setting.explanation +

+
+
+`; + +exports[`should render "bad code setting" explanation: with link 1`] = ` +
+ +
+

+ overview.measures.bad_setting.explanation +

+

+ + settings.new_code_period.category + , + } + } + /> +

+
+
+`; -- cgit v1.2.3