From 9a10a1475e5988adc64ebdacaf75d65b3feaecd3 Mon Sep 17 00:00:00 2001 From: Nolwenn Cadic <98824442+Nolwenn-cadic-sonarsource@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:43:50 +0200 Subject: SONAR-20219 Remove over compliant Quality Gate warnings Co-authored-by: Zipeng WU --- .../branches/ApplicationNonCaycProjectWarning.tsx | 34 +++--------- .../CleanAsYouCodeWarningOverCompliant.tsx | 64 ---------------------- .../js/apps/overview/branches/QualityGatePanel.tsx | 27 +-------- .../branches/__tests__/BranchOverview-it.tsx | 15 ----- .../components/CaycOverCompliantBadgeTooltip.tsx | 35 ------------ .../js/apps/quality-gates/components/Condition.tsx | 15 ----- .../apps/quality-gates/components/Conditions.tsx | 21 ------- .../components/__tests__/QualityGate-it.tsx | 23 -------- .../src/main/js/apps/quality-gates/styles.css | 4 -- 9 files changed, 9 insertions(+), 229 deletions(-) delete mode 100644 server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx delete mode 100644 server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx (limited to 'server/sonar-web/src/main/js') diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx index 8e7d0139efb..9544aaec21f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx @@ -24,34 +24,22 @@ import { useDocUrl } from '../../../helpers/docs'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { getProjectQueryUrl } from '../../../helpers/urls'; import { QualityGateStatus } from '../../../types/quality-gates'; -import { CaycStatus } from '../../../types/types'; interface Props { projects: QualityGateStatus[]; - caycStatus: CaycStatus; } -export default function ApplicationNonCaycProjectWarning({ projects, caycStatus }: Props) { +export default function ApplicationNonCaycProjectWarning({ projects }: Props) { const caycUrl = useDocUrl('/user-guide/clean-as-you-code/'); - const caycDrawbacksUrl = useDocUrl('/user-guide/clean-as-you-code/#potential-drawbacks'); return ( - {caycStatus === CaycStatus.NonCompliant ? ( - - {translateWithParameters( - 'overview.quality_gate.application.non_cayc.projects_x', - projects.length - )} - - ) : ( -

- {translateWithParameters( - 'overview.quality_gate.application.cayc_over_compliant.projects_x', - projects.length - )} -

- )} + + {translateWithParameters( + 'overview.quality_gate.application.non_cayc.projects_x', + projects.length + )} +
- {caycStatus === CaycStatus.NonCompliant ? ( - {translate('overview.quality_gate.conditions.cayc.link')} - ) : ( - - {translate('overview.quality_gate.conditions.cayc_over_compliant.link')} - - )} + {translate('overview.quality_gate.conditions.cayc.link')}
); diff --git a/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx b/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx deleted file mode 100644 index 38a2b966f99..00000000000 --- a/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { DiscreetLink, Link } from 'design-system'; -import * as React from 'react'; -import { FormattedMessage } from 'react-intl'; -import { useDocUrl } from '../../../helpers/docs'; -import { translate } from '../../../helpers/l10n'; -import { getQualityGateUrl } from '../../../helpers/urls'; -import { Component } from '../../../types/types'; - -interface Props { - component: Pick; -} - -export default function CleanAsYouCodeWarningOverCompliant({ component }: Props) { - const caycDrawbackUrl = useDocUrl('/user-guide/clean-as-you-code/#potential-drawbacks'); - - return ( - <> - {component.qualityGate ? ( -

- - {translate('overview.quality_gate.conditions.cayc_over_compliant.warning.link')} - - ), - }} - /> -

- ) : ( -

- {translate('overview.quality_gate.conditions.cayc_over_compliant.details')} -

- )} - - - {translate('overview.quality_gate.conditions.cayc_over_compliant.link')} - - - ); -} diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx index 3df69b32c76..a06e88baa3f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx @@ -31,7 +31,6 @@ import { QualityGateStatusTitle } from '../components/QualityGateStatusTitle'; import SonarLintPromotion from '../components/SonarLintPromotion'; import ApplicationNonCaycProjectWarning from './ApplicationNonCaycProjectWarning'; import CleanAsYouCodeWarning from './CleanAsYouCodeWarning'; -import CleanAsYouCodeWarningOverCompliant from './CleanAsYouCodeWarningOverCompliant'; import QualityGatePanelSection from './QualityGatePanelSection'; export interface QualityGatePanelProps { @@ -65,12 +64,6 @@ export function QualityGatePanel(props: QualityGatePanelProps) { .sort(({ name: a }, { name: b }) => a.localeCompare(b, undefined, { sensitivity: 'base' })) : []; - const overCompliantCaycProjectsInApp = isApp - ? qgStatuses - .filter(({ caycStatus }) => caycStatus === CaycStatus.OverCompliant) - .sort(({ name: a }, { name: b }) => a.localeCompare(b, undefined, { sensitivity: 'base' })) - : []; - const showIgnoredConditionWarning = component.qualifier === ComponentQualifier.Project && qgStatuses.some((p) => Boolean(p.ignoredConditions)); @@ -114,17 +107,7 @@ export function QualityGatePanel(props: QualityGatePanelProps) { {nonCaycProjectsInApp.length > 0 && ( - - )} - - {overCompliantCaycProjectsInApp.length > 0 && ( - + )} {qgStatuses.length === 1 && @@ -135,14 +118,6 @@ export function QualityGatePanel(props: QualityGatePanelProps) { )} - {qgStatuses.length === 1 && - qgStatuses[0].caycStatus === CaycStatus.OverCompliant && - !isApp && ( - - - - )} - qgStatus.failedConditions)} /> diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx index 203aeb5a512..93f8b78d687 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx @@ -232,21 +232,6 @@ describe('project overview', () => { expect(screen.getByText('overview.quality_gate.conditions.cayc.warning')).toBeInTheDocument(); }); - it('should show Cayc message when QG is over-compliant', async () => { - jest - .mocked(getQualityGateProjectStatus) - .mockResolvedValueOnce( - mockQualityGateProjectStatus({ status: 'OK', caycStatus: CaycStatus.OverCompliant }) - ); - - renderBranchOverview(); - - expect(await screen.findByText('metric.level.OK')).toBeInTheDocument(); - expect( - screen.getByText('overview.quality_gate.conditions.cayc_over_compliant.link') - ).toBeInTheDocument(); - }); - it('should show a failed QG', async () => { renderBranchOverview(); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx deleted file mode 100644 index 1ca53aa2ea9..00000000000 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 DocLink from '../../../components/common/DocLink'; -import { translate } from '../../../helpers/l10n'; - -export default function CaycOverCompliantBadgeTooltip() { - return ( -
-

- {translate('quality_gates.cayc_over_compliant.tooltip.message')} -

- - {translate('quality_gates.cayc_over_compliant.badge.tooltip.learn_more')} - -
- ); -} diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx index ea476fca3f1..39debe2a694 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx @@ -21,11 +21,8 @@ import classNames from 'classnames'; import * as React from 'react'; import { deleteCondition } from '../../../api/quality-gates'; import withMetricsContext from '../../../app/components/metrics/withMetricsContext'; -import { colors } from '../../../app/theme'; import { DeleteButton, EditButton } from '../../../components/controls/buttons'; import ConfirmModal from '../../../components/controls/ConfirmModal'; -import Tooltip from '../../../components/controls/Tooltip'; -import InfoIcon from '../../../components/icons/InfoIcon'; import { getLocalizedMetricName, translate, translateWithParameters } from '../../../helpers/l10n'; import { CaycStatus, @@ -39,7 +36,6 @@ import { getLocalizedMetricNameNoDiffMetric, isCaycCondition, } from '../utils'; -import CaycOverCompliantBadgeTooltip from './CaycOverCompliantBadgeTooltip'; import ConditionModal from './ConditionModal'; import ConditionValue from './ConditionValue'; @@ -61,7 +57,6 @@ interface State { modal: boolean; } -const TOOLTIP_MOUSE_LEAVE_DELAY = 0.3; export class ConditionComponent extends React.PureComponent { constructor(props: Props) { super(props); @@ -140,16 +135,6 @@ export class ConditionComponent extends React.PureComponent { /> - {!isCaycCondition(condition) && isCaycCompliantAndOverCompliant && ( - - } - mouseLeaveDelay={TOOLTIP_MOUSE_LEAVE_DELAY} - > - - - - )} {!isCaycModal && canEdit && ( <> {(!isCaycCompliantAndOverCompliant || diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx index 10885d4f923..2bc8876a107 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx @@ -194,27 +194,6 @@ export class Conditions extends React.PureComponent { )} - {qualityGate.caycStatus === CaycStatus.OverCompliant && ( - -

- {translate('quality_gates.cayc_over_compliant.banner.title')} -

-
- - {translate('quality_gates.cayc_over_compliant.banner.link')} - - ), - }} - /> -
-
- )} - {qualityGate.caycStatus === CaycStatus.NonCompliant && (

diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx index e1e0b8dfcd4..cea9b441406 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx @@ -376,29 +376,6 @@ it('should show success banner when quality gate is CAYC compliant', async () => expect(await conditionsWrapper.findByText('Duplicated Lines (%)')).toBeInTheDocument(); }); -it('should show info banner when quality gate is CAYC over-compliant', async () => { - const user = userEvent.setup(); - handler.setIsAdmin(true); - renderQualityGateApp(); - - const qualityGate = await screen.findByText('Over Compliant CAYC QG'); - - await user.click(qualityGate); - - expect(screen.getByText('quality_gates.cayc.banner.title')).toBeInTheDocument(); - expect( - screen.getByText('quality_gates.cayc.banner.description1', { exact: false }) - ).toBeInTheDocument(); - expect(screen.getByText('quality_gates.cayc_over_compliant.banner.title')).toBeInTheDocument(); - expect( - screen.queryByText('quality_gates.cayc_condition.missing_warning.title') - ).not.toBeInTheDocument(); - expect( - screen.queryByRole('button', { name: 'quality_gates.cayc_condition.review_update' }) - ).not.toBeInTheDocument(); - expect(screen.getByText('quality_gates.cayc.unlock_edit')).toBeInTheDocument(); -}); - it('should unlock editing option for CAYC conditions', async () => { const user = userEvent.setup(); handler.setIsAdmin(true); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/styles.css b/server/sonar-web/src/main/js/apps/quality-gates/styles.css index 20597091444..966eec709dc 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/styles.css +++ b/server/sonar-web/src/main/js/apps/quality-gates/styles.css @@ -73,10 +73,6 @@ color: var(--alertTextSuccess); } -.cayc-over-compliant-header { - color: var(--veryDarkBlue); -} - .cayc-warning-description { line-height: 18px; } -- cgit v1.2.3