aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorstanislavh <stanislav.honcharov@sonarsource.com>2024-04-23 14:12:32 +0200
committerMatteo Mara <matteo.mara@sonarsource.com>2024-04-30 10:59:02 +0200
commitcf3c5203c08b21b12108b917a1725a7829d63109 (patch)
tree12c8ea6ee318f9643a67e0a71a946292afc2d79c /server
parent508bdf5808b401dd0745c0b01c4a8c5ad87bb307 (diff)
downloadsonarqube-cf3c5203c08b21b12108b917a1725a7829d63109.tar.gz
sonarqube-cf3c5203c08b21b12108b917a1725a7829d63109.zip
SONAR-22049 Align RatingLabel type
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/design-system/src/components/index.ts2
-rw-r--r--server/sonar-web/design-system/src/index.ts1
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/components/Card.tsx (renamed from server/sonar-web/design-system/src/components/Card.tsx)4
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/components/MetricsRatingBadge.tsx (renamed from server/sonar-web/design-system/src/components/MetricsRatingBadge.tsx)10
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/components/__tests__/Card-test.tsx (renamed from server/sonar-web/design-system/src/components/__tests__/Card-test.tsx)2
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/components/__tests__/MetricsRatingBadge-test.tsx (renamed from server/sonar-web/design-system/src/components/__tests__/MetricsRatingBadge-test.tsx)4
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/components/index.ts22
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/index.ts22
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/types/index.ts21
-rw-r--r--server/sonar-web/design-system/src/sonar-aligned/types/measures.ts29
-rw-r--r--server/sonar-web/design-system/src/types/measures.ts10
-rw-r--r--server/sonar-web/design-system/tsconfig.json3
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/SubnavigationMeasureValue.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/measure/Measure.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/measure/MeasureIndicator.tsx17
21 files changed, 130 insertions, 49 deletions
diff --git a/server/sonar-web/design-system/src/components/index.ts b/server/sonar-web/design-system/src/components/index.ts
index b5b2e73515a..ae2932330ec 100644
--- a/server/sonar-web/design-system/src/components/index.ts
+++ b/server/sonar-web/design-system/src/components/index.ts
@@ -25,7 +25,6 @@ export { BarChart } from './BarChart';
export * from './BorderlessAccordion';
export { Breadcrumbs } from './Breadcrumbs';
export * from './BubbleChart';
-export * from './Card';
export * from './CodeSnippet';
export * from './CodeSyntaxHighlighter';
export * from './ColorsLegend';
@@ -57,7 +56,6 @@ export * from './LocationMarker';
export * from './MainAppBar';
export * from './MainMenu';
export * from './MainMenuItem';
-export * from './MetricsRatingBadge';
export * from './MultiSelector';
export * from './NavBarTabs';
export * from './NewCodeLegend';
diff --git a/server/sonar-web/design-system/src/index.ts b/server/sonar-web/design-system/src/index.ts
index 992d51242bf..3bac299b5e3 100644
--- a/server/sonar-web/design-system/src/index.ts
+++ b/server/sonar-web/design-system/src/index.ts
@@ -19,5 +19,6 @@
*/
export * from './components';
export * from './helpers';
+export * from './sonar-aligned';
export * from './theme';
export * from './types';
diff --git a/server/sonar-web/design-system/src/components/Card.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/Card.tsx
index ef9c63f3c92..a8f7c8ce929 100644
--- a/server/sonar-web/design-system/src/components/Card.tsx
+++ b/server/sonar-web/design-system/src/sonar-aligned/components/Card.tsx
@@ -20,8 +20,8 @@
import styled from '@emotion/styled';
import * as React from 'react';
import tw from 'twin.macro';
-import { themeBorder, themeColor } from '../helpers/theme';
-import { BasicSeparator } from './Separator';
+import { BasicSeparator } from '../../components/Separator';
+import { themeBorder, themeColor } from '../../helpers/theme';
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
children: React.ReactNode;
diff --git a/server/sonar-web/design-system/src/components/MetricsRatingBadge.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/MetricsRatingBadge.tsx
index d82e9a86843..9bdae72f604 100644
--- a/server/sonar-web/design-system/src/components/MetricsRatingBadge.tsx
+++ b/server/sonar-web/design-system/src/sonar-aligned/components/MetricsRatingBadge.tsx
@@ -19,14 +19,14 @@
*/
import styled from '@emotion/styled';
import tw from 'twin.macro';
-import { getProp, themeColor, themeContrast } from '../helpers/theme';
-import { MetricsLabel } from '../types/measures';
+import { getProp, themeColor, themeContrast } from '../../helpers/theme';
+import { RatingLabel } from '../types/measures';
type sizeType = keyof typeof SIZE_MAPPING;
interface Props extends React.AriaAttributes {
className?: string;
- label: string;
- rating?: MetricsLabel;
+ label?: string;
+ rating?: RatingLabel;
size?: sizeType;
}
@@ -90,7 +90,7 @@ const getFontSize = (size: string) => {
}
};
-const MetricsRatingBadgeStyled = styled.div<{ rating: MetricsLabel; size: string }>`
+const MetricsRatingBadgeStyled = styled.div<{ rating: RatingLabel; size: string }>`
width: ${getProp('size')};
height: ${getProp('size')};
color: ${({ rating }) => themeContrast(`rating.${rating}`)};
diff --git a/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/Card-test.tsx
index f6d02f77f8d..817af9d4da6 100644
--- a/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx
+++ b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/Card-test.tsx
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
+import { render } from '../../../helpers/testUtils';
import { Card, GreyCard, LightGreyCard } from '../Card';
it('renders card correctly', () => {
diff --git a/server/sonar-web/design-system/src/components/__tests__/MetricsRatingBadge-test.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/MetricsRatingBadge-test.tsx
index 31e15fedbed..8342ab1ca6c 100644
--- a/server/sonar-web/design-system/src/components/__tests__/MetricsRatingBadge-test.tsx
+++ b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/MetricsRatingBadge-test.tsx
@@ -18,8 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
+import { render } from '../../../helpers/testUtils';
+import { FCProps } from '../../../types/misc';
import { MetricsRatingBadge } from '../MetricsRatingBadge';
diff --git a/server/sonar-web/design-system/src/sonar-aligned/components/index.ts b/server/sonar-web/design-system/src/sonar-aligned/components/index.ts
new file mode 100644
index 00000000000..4aff4e3e703
--- /dev/null
+++ b/server/sonar-web/design-system/src/sonar-aligned/components/index.ts
@@ -0,0 +1,22 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+export * from './Card';
+export * from './MetricsRatingBadge';
diff --git a/server/sonar-web/design-system/src/sonar-aligned/index.ts b/server/sonar-web/design-system/src/sonar-aligned/index.ts
new file mode 100644
index 00000000000..48fc39c2122
--- /dev/null
+++ b/server/sonar-web/design-system/src/sonar-aligned/index.ts
@@ -0,0 +1,22 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+export * from './components';
+export * from './types';
diff --git a/server/sonar-web/design-system/src/sonar-aligned/types/index.ts b/server/sonar-web/design-system/src/sonar-aligned/types/index.ts
new file mode 100644
index 00000000000..076ba52f860
--- /dev/null
+++ b/server/sonar-web/design-system/src/sonar-aligned/types/index.ts
@@ -0,0 +1,21 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+export * from './measures';
diff --git a/server/sonar-web/design-system/src/sonar-aligned/types/measures.ts b/server/sonar-web/design-system/src/sonar-aligned/types/measures.ts
new file mode 100644
index 00000000000..b7e402a65f7
--- /dev/null
+++ b/server/sonar-web/design-system/src/sonar-aligned/types/measures.ts
@@ -0,0 +1,29 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+export enum RatingEnum {
+ A = 'A',
+ B = 'B',
+ C = 'C',
+ D = 'D',
+ E = 'E',
+}
+
+export type RatingLabel = keyof typeof RatingEnum;
diff --git a/server/sonar-web/design-system/src/types/measures.ts b/server/sonar-web/design-system/src/types/measures.ts
index a118f888231..71ee1b988de 100644
--- a/server/sonar-web/design-system/src/types/measures.ts
+++ b/server/sonar-web/design-system/src/types/measures.ts
@@ -28,16 +28,6 @@ export enum DuplicationEnum {
export type DuplicationLabel = keyof typeof DuplicationEnum;
-export enum MetricsEnum {
- A = 'A',
- B = 'B',
- C = 'C',
- D = 'D',
- E = 'E',
-}
-
-export type MetricsLabel = keyof typeof MetricsEnum;
-
export enum SizeEnum {
XS = 'XS',
S = 'S',
diff --git a/server/sonar-web/design-system/tsconfig.json b/server/sonar-web/design-system/tsconfig.json
index 9563ae0ec9f..22b2e4e8bec 100644
--- a/server/sonar-web/design-system/tsconfig.json
+++ b/server/sonar-web/design-system/tsconfig.json
@@ -16,7 +16,8 @@
"~helpers/*": ["src/helpers/*"],
"~icons/*": ["src/icons/*"],
"~types/*": ["src/types/*"],
- "~utils/*": ["src/utils/*"]
+ "~utils/*": ["src/utils/*"],
+ "~sonar-aligned/*": ["src/sonar-aligned/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
index d3b36317eb3..b4b21a0fab7 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
@@ -19,11 +19,11 @@
*/
import {
ContentCell,
- MetricsEnum,
MetricsRatingBadge,
NumericalCell,
QualityGateIndicator,
RatingCell,
+ RatingEnum,
} from 'design-system';
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
@@ -96,7 +96,7 @@ export default function ComponentMeasure(props: Props) {
<RatingCell className="sw-whitespace-nowrap">
<MetricsRatingBadge
label={value ?? '—'}
- rating={formatMeasure(value, MetricType.Rating) as MetricsEnum}
+ rating={formatMeasure(value, MetricType.Rating) as RatingEnum}
/>
</RatingCell>
);
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
index a6790e2af7a..4fd76d7d88b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
@@ -19,7 +19,7 @@
*/
import { LinkStandalone } from '@sonarsource/echoes-react';
import classNames from 'classnames';
-import { MetricsLabel, MetricsRatingBadge } from 'design-system';
+import { MetricsRatingBadge, RatingLabel } from 'design-system';
import * as React from 'react';
import LanguageDistribution from '../../../components/charts/LanguageDistribution';
import Tooltip from '../../../components/controls/Tooltip';
@@ -78,7 +78,7 @@ export default function MeasureHeader(props: Readonly<Props>) {
)
: translate('metric.no_rating')
}
- rating={formatMeasure(measureValue, MetricType.Rating) as MetricsLabel}
+ rating={formatMeasure(measureValue, MetricType.Rating) as RatingLabel}
/>
}
/>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
index 56a1ac29744..e4354dbf8c9 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsLabel, MetricsRatingBadge, NumericalCell } from 'design-system';
+import { MetricsRatingBadge, NumericalCell, RatingLabel } from 'design-system';
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
import { translate, translateWithParameters } from '../../../helpers/l10n';
@@ -55,7 +55,7 @@ export default function MeasureCell({ component, measure, metric }: Props) {
)
: translate('metric.no_rating')
}
- rating={formatMeasure(value, MetricType.Rating) as MetricsLabel}
+ rating={formatMeasure(value, MetricType.Rating) as RatingLabel}
/>
}
/>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/SubnavigationMeasureValue.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/SubnavigationMeasureValue.tsx
index 7088bd7e639..ab344f0ff6b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/SubnavigationMeasureValue.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/SubnavigationMeasureValue.tsx
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsLabel, MetricsRatingBadge, Note } from 'design-system';
+import { MetricsRatingBadge, Note, RatingLabel } from 'design-system';
import React from 'react';
import Measure from '../../../components/measure/Measure';
import { translate, translateWithParameters } from '../../../helpers/l10n';
@@ -48,7 +48,7 @@ export default function SubnavigationMeasureValue({ measure }: Readonly<Props>)
? translateWithParameters('metric.has_rating_X', formatted)
: translate('metric.no_rating')
}
- rating={formatted as MetricsLabel}
+ rating={formatted as RatingLabel}
/>
}
metricKey={measure.metric.key}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
index 2f9afad7e32..352418538c0 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
@@ -20,10 +20,10 @@
import {
CoverageIndicator,
DuplicationsIndicator,
- MetricsLabel,
MetricsRatingBadge,
Note,
PageContentFontWrapper,
+ RatingLabel,
} from 'design-system';
import * as React from 'react';
import Measure from '../../../../components/measure/Measure';
@@ -178,7 +178,7 @@ function renderRatings(props: ProjectCardMeasuresProps) {
return (
<ProjectCardMeasure key={metricKey} metricKey={metricKey} label={iconLabel}>
- <MetricsRatingBadge label={metricKey} rating={value as MetricsLabel} />
+ <MetricsRatingBadge label={metricKey} rating={value as RatingLabel} />
<Measure
metricKey={metricKey}
metricType={metricType}
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx b/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx
index 99d0bf23586..6dac1d3015d 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsEnum, MetricsRatingBadge } from 'design-system';
+import { MetricsRatingBadge, RatingEnum } from 'design-system';
import * as React from 'react';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
@@ -77,6 +77,6 @@ function renderOption(option: number) {
const ratingFormatted = formatMeasure(option, MetricType.Rating);
return (
- <MetricsRatingBadge label={ratingFormatted} rating={ratingFormatted as MetricsEnum} size="xs" />
+ <MetricsRatingBadge label={ratingFormatted} rating={ratingFormatted as RatingEnum} size="xs" />
);
}
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx
index 1a99368fcee..9764cea8aa6 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsEnum, MetricsRatingBadge } from 'design-system';
+import { MetricsRatingBadge, RatingEnum } from 'design-system';
import * as React from 'react';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
@@ -84,7 +84,7 @@ function renderOption(option: number) {
<div className="sw-flex sw-items-center">
<MetricsRatingBadge
label={ratingFormatted}
- rating={ratingFormatted as MetricsEnum}
+ rating={ratingFormatted as RatingEnum}
size="xs"
/>
<span className="sw-ml-2">{labels[option]}</span>
diff --git a/server/sonar-web/src/main/js/components/measure/Measure.tsx b/server/sonar-web/src/main/js/components/measure/Measure.tsx
index c453e58d898..0e0f1f0e140 100644
--- a/server/sonar-web/src/main/js/components/measure/Measure.tsx
+++ b/server/sonar-web/src/main/js/components/measure/Measure.tsx
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsLabel, MetricsRatingBadge, QualityGateIndicator } from 'design-system';
+import { MetricsRatingBadge, QualityGateIndicator, RatingLabel } from 'design-system';
import * as React from 'react';
import Tooltip from '../../components/controls/Tooltip';
import { translate, translateWithParameters } from '../../helpers/l10n';
@@ -83,7 +83,7 @@ export default function Measure({
? translateWithParameters('metric.has_rating_X', formatMeasure(value, MetricType.Rating))
: translate('metric.no_rating')
}
- rating={formatMeasure(value, MetricType.Rating) as MetricsLabel}
+ rating={formatMeasure(value, MetricType.Rating) as RatingLabel}
/>
);
diff --git a/server/sonar-web/src/main/js/components/measure/MeasureIndicator.tsx b/server/sonar-web/src/main/js/components/measure/MeasureIndicator.tsx
index cb8bbe5b072..9889e139348 100644
--- a/server/sonar-web/src/main/js/components/measure/MeasureIndicator.tsx
+++ b/server/sonar-web/src/main/js/components/measure/MeasureIndicator.tsx
@@ -17,7 +17,12 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { CoverageIndicator, DuplicationsIndicator, MetricsRatingBadge } from 'design-system';
+import {
+ CoverageIndicator,
+ DuplicationsIndicator,
+ MetricsRatingBadge,
+ RatingEnum,
+} from 'design-system';
import * as React from 'react';
import { formatMeasure } from '../../helpers/measures';
import { MetricKey, MetricType } from '../../types/metrics';
@@ -33,14 +38,6 @@ interface Props {
value: string | undefined;
}
-enum MetricsEnum {
- A = 'A',
- B = 'B',
- C = 'C',
- D = 'D',
- E = 'E',
-}
-
export default function MeasureIndicator(props: Props) {
const { className, metricKey, metricType, value } = props;
@@ -66,7 +63,7 @@ export default function MeasureIndicator(props: Props) {
const ratingFormatted = formatMeasure(value, MetricType.Rating);
const ratingComponent = (
- <MetricsRatingBadge rating={ratingFormatted as MetricsEnum} label={ratingFormatted} />
+ <MetricsRatingBadge rating={ratingFormatted as RatingEnum} label={ratingFormatted} />
);
return <Measure {...props} ratingComponent={ratingComponent} />;