]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "SONAR-23076 Hide blocker and info filters"
authorViktor Vorona <viktor.vorona@sonarsource.com>
Mon, 30 Sep 2024 11:19:14 +0000 (13:19 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 3 Oct 2024 20:02:51 +0000 (20:02 +0000)
This reverts commit ceaa390b984e73215b176535f39e662613918e37.

server/sonar-web/src/main/js/components/facets/SeverityFacet.tsx

index c162b1eb62a8ddede3000c2019d573bebfd445e0..3f7cae9eca6c7b77ee4a74ffa750b87453243ca1 100644 (file)
@@ -25,7 +25,6 @@ import { useIntl } from 'react-intl';
 import { IMPACT_SEVERITIES } from '../../helpers/constants';
 import { DocLink } from '../../helpers/doc-links';
 import { translate } from '../../helpers/l10n';
-import { SoftwareImpactSeverity } from '../../types/clean-code-taxonomy';
 import DocumentationLink from '../common/DocumentationLink';
 import SoftwareImpactSeverityIcon from '../icon-mappers/SoftwareImpactSeverityIcon';
 import Facet, { BasicProps } from './Facet';
@@ -47,45 +46,10 @@ export default function SeverityFacet(props: Readonly<BasicProps>) {
     [],
   );
 
-  const isNotBlockerOrInfo = (severity: string) =>
-    severity !== SoftwareImpactSeverity.Blocker && severity !== SoftwareImpactSeverity.Info;
-
   return (
     <Facet
       {...props}
-      stats={Object.fromEntries(
-        Object.entries(props.stats ?? {})
-          .filter(([key]) => isNotBlockerOrInfo(key))
-          .map(([key, value]) => {
-            switch (key) {
-              case SoftwareImpactSeverity.Low:
-                return [key, value + (props.stats?.[SoftwareImpactSeverity.Info] ?? 0)];
-              case SoftwareImpactSeverity.High:
-                return [key, value + (props.stats?.[SoftwareImpactSeverity.Blocker] ?? 0)];
-              default:
-                return [key, value];
-            }
-          }),
-      )}
-      onChange={(values) => {
-        props.onChange({
-          ...values,
-          impactSeverities: (values.impactSeverities as string[] | undefined)
-            ?.map((s) => {
-              switch (s) {
-                case SoftwareImpactSeverity.Low:
-                  return [SoftwareImpactSeverity.Info, SoftwareImpactSeverity.Low];
-                case SoftwareImpactSeverity.High:
-                  return [SoftwareImpactSeverity.Blocker, SoftwareImpactSeverity.High];
-                default:
-                  return s;
-              }
-            })
-            .flat(),
-        });
-      }}
-      values={props.values.filter(isNotBlockerOrInfo)}
-      options={IMPACT_SEVERITIES.filter(isNotBlockerOrInfo)}
+      options={IMPACT_SEVERITIES}
       property="impactSeverities"
       renderName={renderName}
       renderTextName={renderTextName}