From: 7PH Date: Thu, 1 Feb 2024 09:07:02 +0000 (+0100) Subject: SONAR-21455 Change security hotspot review condition label to 'required .. reviewed' X-Git-Tag: 10.4.0.87286~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b34069455784e666ba22f1d4f83104431466f302;p=sonarqube.git SONAR-21455 Change security hotspot review condition label to 'required .. reviewed' --- 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) { 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 ? {conditionEl} : conditionEl, }, ); diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 996c5548215..0ccf0d6c394 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3898,7 +3898,8 @@ overview.quality_gate.on_x_new_lines=On {link} New Lines. overview.quality_gate.x_estimated_after_merge={value} Estimated after merge overview.quality_gate.require_fixing={count, plural, one {requires} other {require}} fixing overview.quality_gate.require_reviewing={count, plural, one {requires} other {require}} reviewing -overview.quality_gate.required_x=Required {requirement} +overview.quality_gate.required_x=Required {operator} {requirement} +overview.quality_gate.required_x_reviewed=Required review: {requirement} overview.quality_profiles=Quality Profiles used overview.new_code_period_x=New Code: {0} overview.max_new_code_period_from_x=Max New Code from: {0}