From 9bd9e27c04e16d632cd957a6fc48e26a76106ba8 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Mon, 2 Dec 2024 14:57:05 +0100 Subject: SONAR-23791 Show Software quality pills by order Security,Reliability,Maintainability --- .../js/components/shared/SoftwareImpactPillList.tsx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'server/sonar-web') diff --git a/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx b/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx index 80c0270d91c..f0967a62802 100644 --- a/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx +++ b/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx @@ -20,7 +20,6 @@ import classNames from 'classnames'; import React from 'react'; -import { translate } from '../../helpers/l10n'; import { useStandardExperienceModeQuery } from '../../queries/mode'; import { SoftwareImpact, @@ -41,12 +40,10 @@ interface SoftwareImpactPillListProps extends React.HTMLAttributes[0]['type']; } -const severityMap = { - [SoftwareImpactSeverity.Blocker]: 4, - [SoftwareImpactSeverity.High]: 3, - [SoftwareImpactSeverity.Medium]: 2, - [SoftwareImpactSeverity.Low]: 1, - [SoftwareImpactSeverity.Info]: 0, +const sqOrderMap = { + [SoftwareQuality.Security]: 3, + [SoftwareQuality.Reliability]: 2, + [SoftwareQuality.Maintainability]: 1, }; export default function SoftwareImpactPillList({ @@ -59,13 +56,8 @@ export default function SoftwareImpactPillList({ ...props }: Readonly) { const { data: isStandardMode } = useStandardExperienceModeQuery(); - const getQualityLabel = (quality: SoftwareQuality) => translate('software_quality', quality); - const sortingFn = (a: SoftwareImpact, b: SoftwareImpact) => { - if (a.severity !== b.severity) { - return severityMap[b.severity] - severityMap[a.severity]; - } - return getQualityLabel(a.softwareQuality).localeCompare(getQualityLabel(b.softwareQuality)); - }; + const sortingFn = (a: SoftwareImpact, b: SoftwareImpact) => + sqOrderMap[b.softwareQuality] - sqOrderMap[a.softwareQuality]; return (
    -- cgit v1.2.3