aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanislavh <stanislav.honcharov@sonarsource.com>2024-11-15 12:02:37 +0100
committersonartech <sonartech@sonarsource.com>2024-11-15 20:02:42 +0000
commit010d132cdfe0a6bb0669d9e37e3a66b27e0cc17f (patch)
tree6613d127e2d546aeaad6a942f27aca2a844a0870
parent00e684bad92f33d8f46334887ddc61f1c2f6c4c3 (diff)
downloadsonarqube-010d132cdfe0a6bb0669d9e37e3a66b27e0cc17f.tar.gz
sonarqube-010d132cdfe0a6bb0669d9e37e3a66b27e0cc17f.zip
SONAR-23582 Do not show severity recommendation on rule update
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx6
2 files changed, 4 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
index 12e43b222e8..4841c3ae8f5 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
@@ -340,7 +340,7 @@ export default function CustomRuleFormModal(props: Readonly<Props>) {
isDisabled={submitting}
onChange={(value) => setStandardSeverity(value)}
severity={standardSeverity}
- recommendedSeverity={templateRule.severity ?? customRule?.severity}
+ recommendedSeverity={customRule?.severity ? undefined : templateRule.severity}
/>
</FormField>
),
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx
index 358c5e1ddbc..cc0969a699b 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx
@@ -19,7 +19,7 @@
*/
import { HelperText, Select } from '@sonarsource/echoes-react';
-import { isEmpty } from 'lodash';
+import { isEmpty, isUndefined } from 'lodash';
import { FormattedMessage, useIntl } from 'react-intl';
import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon';
import { SEVERITIES } from '../../../helpers/constants';
@@ -30,7 +30,7 @@ export interface SeveritySelectProps {
impactSeverity?: boolean;
isDisabled: boolean;
onChange: (value: string) => void;
- recommendedSeverity: string;
+ recommendedSeverity?: string;
severity: string;
}
@@ -70,7 +70,7 @@ export function SeveritySelect(props: SeveritySelectProps) {
value={severity}
valueIcon={<SoftwareImpactSeverityIcon severity={severity} aria-hidden />}
/>
- {severity !== recommendedSeverity && (
+ {severity !== recommendedSeverity && !isUndefined(recommendedSeverity) && (
<HelperText className="sw-mt-2">
<FormattedMessage
id="coding_rules.custom_severity.not_recommended"