diff options
author | stanislavh <stanislav.honcharov@sonarsource.com> | 2024-12-02 14:57:05 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-12-03 20:03:22 +0000 |
commit | 9bd9e27c04e16d632cd957a6fc48e26a76106ba8 (patch) | |
tree | 978bc042d6025b92f4e269275c8dc5a3496ab9dd /server/sonar-web | |
parent | 111c03ece19ebb629d510d83670593693dcb6a76 (diff) | |
download | sonarqube-9bd9e27c04e16d632cd957a6fc48e26a76106ba8.tar.gz sonarqube-9bd9e27c04e16d632cd957a6fc48e26a76106ba8.zip |
SONAR-23791 Show Software quality pills by order Security,Reliability,Maintainability
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx | 20 |
1 files changed, 6 insertions, 14 deletions
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<HTMLUListElem type?: Parameters<typeof SoftwareImpactPill>[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<SoftwareImpactPillListProps>) { 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 ( <ul className={classNames('sw-flex sw-gap-2', className)} {...props}> |