aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
author7PH <benjamin.raymond@sonarsource.com>2024-02-01 10:07:02 +0100
committersonartech <sonartech@sonarsource.com>2024-02-01 20:02:48 +0000
commitb34069455784e666ba22f1d4f83104431466f302 (patch)
tree21bd4a4bdb9206f803a41eb79b3c53f21f98a94a /server
parentcab06a5a89e4f3f085f4e3a7fe5fbcfea4a8e5cc (diff)
downloadsonarqube-b34069455784e666ba22f1d4f83104431466f302.tar.gz
sonarqube-b34069455784e666ba22f1d4f83104431466f302.zip
SONAR-21455 Change security hotspot review condition label to 'required .. reviewed'
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/utils.tsx28
2 files changed, 19 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx
index b45c3c3780c..172eb8717ba 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx
@@ -62,7 +62,7 @@ export default function NewCodeMeasuresPanel(props: Readonly<Props>) {
const failedConditions = qgStatuses?.flatMap((qg) => qg.failedConditions) ?? [];
const newIssues = getLeakValue(findMeasure(measures, MetricKey.new_violations));
- const newIssuesCondition = failedConditions.find((c) => c.metric === MetricKey.new_violations);
+ const newIssuesCondition = conditions.find((c) => c.metric === MetricKey.new_violations);
const issuesConditionFailed = newIssuesCondition?.level === Status.ERROR;
const newAcceptedIssues = getLeakValue(findMeasure(measures, MetricKey.new_accepted_issues));
const newSecurityHotspots = getLeakValue(
diff --git a/server/sonar-web/src/main/js/apps/overview/utils.tsx b/server/sonar-web/src/main/js/apps/overview/utils.tsx
index 0745bc43797..40c962140d1 100644
--- a/server/sonar-web/src/main/js/apps/overview/utils.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/utils.tsx
@@ -252,6 +252,18 @@ export function getAnalysisVariations(measures: MeasureHistory[], analysesCount:
}, emptyVariations);
}
+export function getConditionRequiredTranslateId(metric: MetricKey) {
+ if (
+ [MetricKey.security_hotspots_reviewed, MetricKey.new_security_hotspots_reviewed].includes(
+ metric,
+ )
+ ) {
+ return 'overview.quality_gate.required_x_reviewed';
+ }
+
+ return 'overview.quality_gate.required_x';
+}
+
export function getConditionRequiredLabel(
condition: QualityGateStatusConditionEnhanced,
intl: IntlShape,
@@ -271,20 +283,16 @@ export function getConditionRequiredLabel(
operator = '=';
}
- const conditionEl = (
- <>
- {operator}{' '}
- {formatMeasure(condition.error, condition.measure.metric.type, {
- decimals: 2,
- omitExtraDecimalZeros: true,
- })}
- </>
- );
+ const conditionEl = formatMeasure(condition.error, condition.measure.metric.type, {
+ decimals: 2,
+ omitExtraDecimalZeros: true,
+ });
return intl.formatMessage(
- { id: 'overview.quality_gate.required_x' },
+ { id: getConditionRequiredTranslateId(condition.metric) },
{
+ operator,
requirement: failed ? <b>{conditionEl}</b> : conditionEl,
},
);