aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/api/mocks/CodingRulesServiceMock.ts10
-rw-r--r--server/sonar-web/src/main/js/api/quality-profiles.ts8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx2
3 files changed, 9 insertions, 11 deletions
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<SoftwareQuality, SoftwareImpactSeverity>;
key: string;
params?: Record<string, string>;
prioritizedRule?: boolean;
reset?: boolean;
rule: string;
severity?: string;
- softwareQualityImpact?: Record<SoftwareQuality, SoftwareImpactSeverity>;
}
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<Props>) {
rule: rule.key,
severity: !isMQRMode ? severity : undefined,
prioritizedRule,
- softwareQualityImpact: isMQRMode
+ impacts: isMQRMode
? (Object.fromEntries(impacts) as Record<SoftwareQuality, SoftwareImpactSeverity>)
: undefined,
};