From: Viktor Vorona Date: Fri, 11 Oct 2024 07:05:24 +0000 (+0200) Subject: SONAR-23250 Rename softwareQualityImpact to impacts X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a49dcbfad564db95c05d538d7aff110a33db12a1;p=sonarqube.git SONAR-23250 Rename softwareQualityImpact to impacts --- diff --git a/server/sonar-web/src/main/js/api/mocks/CodingRulesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/CodingRulesServiceMock.ts index 27e43c8dee5..6d14b4948c0 100644 --- a/server/sonar-web/src/main/js/api/mocks/CodingRulesServiceMock.ts +++ b/server/sonar-web/src/main/js/api/mocks/CodingRulesServiceMock.ts @@ -607,10 +607,10 @@ export default class CodingRulesServiceMock { ) && (!data.severity || currentActivation.severity === data.severity) && currentActivation.prioritizedRule === data.prioritizedRule && - (!data.softwareQualityImpact || + (!data.impacts || isEqual( currentActivation.impacts, - Object.entries(data.softwareQualityImpact).map(([softwareQuality, severity]) => ({ + Object.entries(data.impacts).map(([softwareQuality, severity]) => ({ softwareQuality, severity, })), @@ -623,8 +623,8 @@ export default class CodingRulesServiceMock { const inheritedImpacts = this.rulesActivations[data.rule]?.find(({ qProfile }) => qProfile === data.key)?.impacts ?? []; - const severity = data.softwareQualityImpact - ? MQRtoStandardSeverityMap[data.softwareQualityImpact[SoftwareQuality.Maintainability]] + const severity = data.impacts + ? MQRtoStandardSeverityMap[data.impacts[SoftwareQuality.Maintainability]] : data.severity; const impacts = data.severity ? [ @@ -642,7 +642,7 @@ export default class CodingRulesServiceMock { StandardtoMQRSeverityMap[data.severity as keyof typeof StandardtoMQRSeverityMap], }, ] - : Object.entries(data.softwareQualityImpact ?? {}).map( + : Object.entries(data.impacts ?? {}).map( ([softwareQuality, severity]: [SoftwareQuality, SoftwareImpactSeverity]) => ({ softwareQuality, severity, diff --git a/server/sonar-web/src/main/js/api/quality-profiles.ts b/server/sonar-web/src/main/js/api/quality-profiles.ts index 124b2b0abe0..f8ed8782c79 100644 --- a/server/sonar-web/src/main/js/api/quality-profiles.ts +++ b/server/sonar-web/src/main/js/api/quality-profiles.ts @@ -326,25 +326,23 @@ export function bulkDeactivateRules(data: BulkActivateParameters) { } export interface ActivateRuleParameters { + impacts?: Record; key: string; params?: Record; prioritizedRule?: boolean; reset?: boolean; rule: string; severity?: string; - softwareQualityImpact?: Record; } export function activateRule(data: ActivateRuleParameters) { const params = data.params && map(data.params, (value, key) => `${key}=${csvEscape(value)}`).join(';'); - const softwareQualityImpact = - data.softwareQualityImpact && - map(data.softwareQualityImpact, (value, key) => `${key}=${value}`).join(';'); + const impacts = data.impacts && map(data.impacts, (value, key) => `${key}=${value}`).join(';'); return post('/api/qualityprofiles/activate_rule', { ...data, params, - softwareQualityImpact, + impacts, }).catch(throwGlobalError); } diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx index 6c439093d7c..d4ab8d8557d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx @@ -128,7 +128,7 @@ export default function ActivationFormModal(props: Readonly) { rule: rule.key, severity: !isMQRMode ? severity : undefined, prioritizedRule, - softwareQualityImpact: isMQRMode + impacts: isMQRMode ? (Object.fromEntries(impacts) as Record) : undefined, };