-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONAR-20993 Add option to optimize quality gates CaYC compliant witho…
…ut 0 issues conditions (#9929)
- Loading branch information
Andrey Luiz
authored and
sonartech
committed
Nov 15, 2023
1 parent
85f3049
commit 917bbd0
Showing
10 changed files
with
385 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
server/sonar-web/src/main/js/apps/quality-gates/components/CaycCompliantBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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 { | ||
CardWithPrimaryBackground, | ||
CheckIcon, | ||
LightLabel, | ||
SubHeadingHighlight, | ||
} from 'design-system'; | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import DocumentationLink from '../../../components/common/DocumentationLink'; | ||
import { translate } from '../../../helpers/l10n'; | ||
import { OPTIMIZED_CAYC_CONDITIONS } from '../utils'; | ||
|
||
export default function CaycCompliantBanner() { | ||
return ( | ||
<CardWithPrimaryBackground className="sw-mb-9 sw-p-8"> | ||
<SubHeadingHighlight className="sw-mb-2"> | ||
{translate('quality_gates.cayc.banner.title')} | ||
</SubHeadingHighlight> | ||
|
||
<div> | ||
<FormattedMessage | ||
id="quality_gates.cayc.banner.description1" | ||
values={{ | ||
cayc_link: ( | ||
<DocumentationLink to="/user-guide/clean-as-you-code/"> | ||
{translate('quality_gates.cayc')} | ||
</DocumentationLink> | ||
), | ||
}} | ||
/> | ||
</div> | ||
<div className="sw-my-2">{translate('quality_gates.cayc.banner.description2')}</div> | ||
<ul className="sw-body-sm sw-flex sw-flex-col sw-gap-2"> | ||
{Object.values(OPTIMIZED_CAYC_CONDITIONS).map((condition) => ( | ||
<li key={condition.metric}> | ||
<CheckIcon className="sw-mr-1 sw-pt-1/2" /> | ||
<LightLabel>{translate(`metric.${condition.metric}.description.positive`)}</LightLabel> | ||
</li> | ||
))} | ||
</ul> | ||
</CardWithPrimaryBackground> | ||
); | ||
} |
32 changes: 0 additions & 32 deletions
32
server/sonar-web/src/main/js/apps/quality-gates/components/CaycConditionsListItem.tsx
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
server/sonar-web/src/main/js/apps/quality-gates/components/CaycFixOptimizeBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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 { ButtonPrimary, CardWithPrimaryBackground, SubHeadingHighlight } from 'design-system'; | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import DocumentationLink from '../../../components/common/DocumentationLink'; | ||
import ModalButton from '../../../components/controls/ModalButton'; | ||
import { translate } from '../../../helpers/l10n'; | ||
|
||
interface Props { | ||
renderCaycModal: ({ onClose }: { onClose: () => void }) => React.ReactNode; | ||
isOptimizing?: boolean; | ||
} | ||
|
||
export default function CaycNonCompliantBanner({ renderCaycModal, isOptimizing }: Readonly<Props>) { | ||
return ( | ||
<CardWithPrimaryBackground className="sw-mb-9 sw-p-8"> | ||
<SubHeadingHighlight className="sw-mb-2"> | ||
{translate( | ||
isOptimizing | ||
? 'quality_gates.cayc_optimize.banner.title' | ||
: 'quality_gates.cayc_missing.banner.title', | ||
)} | ||
</SubHeadingHighlight> | ||
<div> | ||
<FormattedMessage | ||
id={ | ||
isOptimizing | ||
? 'quality_gates.cayc_optimize.banner.description' | ||
: 'quality_gates.cayc_missing.banner.description' | ||
} | ||
values={{ | ||
cayc_link: ( | ||
<DocumentationLink to="/user-guide/clean-as-you-code/"> | ||
{translate('quality_gates.cayc')} | ||
</DocumentationLink> | ||
), | ||
}} | ||
/> | ||
</div> | ||
<ModalButton modal={renderCaycModal}> | ||
{({ onClick }) => ( | ||
<ButtonPrimary className="sw-mt-4" onClick={onClick}> | ||
{translate( | ||
isOptimizing | ||
? 'quality_gates.cayc_condition.review_optimize' | ||
: 'quality_gates.cayc_condition.review_update', | ||
)} | ||
</ButtonPrimary> | ||
)} | ||
</ModalButton> | ||
</CardWithPrimaryBackground> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.