]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21132 Do not show CCT fields in edit dialog
authorstanislavh <stanislav.honcharov@sonarsource.com>
Tue, 5 Dec 2023 10:07:07 +0000 (11:07 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 8 Dec 2023 20:03:05 +0000 (20:03 +0000)
Co-authored-by: Benjamin Raymond <31401273+7PH@users.noreply.github.com>
server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx

index de13a2478209e58fa229412fb000a9817ede55f9..dce99ab2ba7059f2ec7b9dfb51d4b8465907e434 100644 (file)
@@ -307,26 +307,30 @@ export default function CustomRuleFormModal(props: Readonly<Props>) {
 
           {NameField}
           {KeyField}
-
-          <div className="sw-flex sw-justify-between sw-gap-6">
-            <CleanCodeCategoryField
-              value={ccCategory}
-              disabled={submitting}
-              onChange={setCCCategory}
-            />
-            <CleanCodeAttributeField
-              value={ccAttribute}
-              category={ccCategory}
-              disabled={submitting}
-              onChange={setCCAtribute}
-            />
-          </div>
-          <SoftwareQualitiesFields
-            error={hasError}
-            value={impacts}
-            onChange={setImpacts}
-            disabled={submitting}
-          />
+          {/* do not allow to change CCT fields of existing rule */}
+          {!customRule && !reactivating && (
+            <>
+              <div className="sw-flex sw-justify-between sw-gap-6">
+                <CleanCodeCategoryField
+                  value={ccCategory}
+                  disabled={submitting}
+                  onChange={setCCCategory}
+                />
+                <CleanCodeAttributeField
+                  value={ccAttribute}
+                  category={ccCategory}
+                  disabled={submitting}
+                  onChange={setCCAtribute}
+                />
+              </div>
+              <SoftwareQualitiesFields
+                error={hasError}
+                value={impacts}
+                onChange={setImpacts}
+                disabled={submitting}
+              />
+            </>
+          )}
           {StatusField}
           {DescriptionField}
           {templateParams.map(renderParameterField)}