@@ -1,36 +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 classNames from 'classnames'; | |||
import { CheckIcon, LightLabel } from 'design-system'; | |||
import * as React from 'react'; | |||
import { translate } from '../../../helpers/l10n'; | |||
export default function CaycConditionsListItem({ | |||
index, | |||
last, | |||
}: Readonly<{ index: number; last: boolean }>) { | |||
return ( | |||
<li className={classNames('sw-flex', { 'sw-mb-2': !last })}> | |||
<CheckIcon className="sw-mr-1 sw-pt-1/2" /> | |||
<LightLabel>{translate(`quality_gates.cayc.banner.list_item${index + 1}`)}</LightLabel> | |||
</li> | |||
); | |||
} |
@@ -30,7 +30,7 @@ import { | |||
SubnavigationFlowSeparator, | |||
Title, | |||
} from 'design-system'; | |||
import { differenceWith, map, times, uniqBy } from 'lodash'; | |||
import { differenceWith, map, uniqBy } from 'lodash'; | |||
import * as React from 'react'; | |||
import { FormattedMessage } from 'react-intl'; | |||
import withAvailableFeatures, { | |||
@@ -51,13 +51,10 @@ import { | |||
QualityGate, | |||
} from '../../../types/types'; | |||
import { groupAndSortByPriorityConditions } from '../utils'; | |||
import CaycConditionsListItem from './CaycConditionsListItem'; | |||
import ConditionModal from './ConditionModal'; | |||
import CaycReviewUpdateConditionsModal from './ConditionReviewAndUpdateModal'; | |||
import ConditionsTable from './ConditionsTable'; | |||
export const CAYC_CONDITIONS_LIST_ITEMS = 6; | |||
interface Props extends WithAvailableFeaturesProps { | |||
metrics: Dict<Metric>; | |||
onAddCondition: (condition: ConditionType) => void; | |||
@@ -169,37 +166,6 @@ export function Conditions({ | |||
return ( | |||
<div> | |||
{qualityGate.caycStatus !== CaycStatus.NonCompliant && ( | |||
<CardWithPrimaryBackground className="sw-mb-9 sw-p-8"> | |||
<Title as="h2" className="sw-mb-2 sw-heading-md"> | |||
{translate('quality_gates.cayc.banner.title')} | |||
</Title> | |||
<SubHeading className="sw-body-sm sw-mb-4"> | |||
<FormattedMessage | |||
id="quality_gates.cayc.banner.description1" | |||
defaultMessage={translate('quality_gates.cayc.banner.description1')} | |||
values={{ | |||
cayc_link: ( | |||
<Link to={getDocUrl('/user-guide/clean-as-you-code/')}> | |||
{translate('quality_gates.cayc')} | |||
</Link> | |||
), | |||
}} | |||
/>{' '} | |||
{translate('quality_gates.cayc.banner.description2')} | |||
</SubHeading> | |||
<ul className="sw-body-sm"> | |||
{times(CAYC_CONDITIONS_LIST_ITEMS, (i) => ( | |||
<CaycConditionsListItem | |||
index={i} | |||
key={i} | |||
last={i === CAYC_CONDITIONS_LIST_ITEMS - 1} | |||
/> | |||
))} | |||
</ul> | |||
</CardWithPrimaryBackground> | |||
)} | |||
{qualityGate.caycStatus === CaycStatus.NonCompliant && canEdit && ( | |||
<CardWithPrimaryBackground className="sw-mb-9 sw-p-8"> | |||
<Title as="h2" className="sw-mb-2 sw-heading-md"> |
@@ -97,10 +97,10 @@ export default function DetailsHeader({ | |||
<FlagWarningIcon className="sw-ml-2" description={<CaycBadgeTooltip />} /> | |||
</Tooltip> | |||
)} | |||
</div> | |||
<div className="sw-flex sw-gap-2 sw-mt-4"> | |||
{qualityGate.isDefault && <Badge>{translate('default')}</Badge>} | |||
{qualityGate.isBuiltIn && <BuiltInQualityGateBadge />} | |||
<div className="sw-flex sw-gap-2 sw-ml-4"> | |||
{qualityGate.isDefault && <Badge>{translate('default')}</Badge>} | |||
{qualityGate.isBuiltIn && <BuiltInQualityGateBadge />} | |||
</div> | |||
</div> | |||
</div> | |||
{actionsCount === 1 && ( |
@@ -388,10 +388,6 @@ it('should show success banner when quality gate is CAYC compliant', async () => | |||
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.queryByText('quality_gates.cayc_condition.missing_warning.title'), | |||
).not.toBeInTheDocument(); |
@@ -2212,15 +2212,6 @@ quality_gates.cayc.new_security_rating.A=No vulnerabilities | |||
quality_gates.cayc.unlock_edit=Unlock editing | |||
quality_gates.cayc.tooltip.message=This quality gate does not comply with Clean as You Code. | |||
quality_gates.cayc.badge.tooltip.learn_more=Learn more: Clean as You Code | |||
quality_gates.cayc.banner.title=This quality gate complies with Clean as You Code | |||
quality_gates.cayc.banner.description1=This quality gate complies with the {cayc_link} methodology, so that you benefit from the most efficient approach to delivering Clean Code. | |||
quality_gates.cayc.banner.description2=It ensures that: | |||
quality_gates.cayc.banner.list_item1=No new bugs are introduced | |||
quality_gates.cayc.banner.list_item2=No new vulnerabilities are introduced | |||
quality_gates.cayc.banner.list_item3=All new security hotspots are reviewed | |||
quality_gates.cayc.banner.list_item4=New code has limited technical debt | |||
quality_gates.cayc.banner.list_item5=New code has limited duplication | |||
quality_gates.cayc.banner.list_item6=New code is properly covered by tests | |||
quality_gates.cayc_unfollow.description=You may click unlock to edit this quality gate. Adding extra conditions to a compliant quality gate can result in drawbacks. Are you reconsidering {cayc_link}? We strongly recommend this methodology to achieve a Clean Code status. | |||
quality_gates.cayc.review_update_modal.add_condition.header= {0} condition(s) on New Code will be added | |||
quality_gates.cayc.review_update_modal.modify_condition.header= {0} condition(s) on New Code will be modified |