aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
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/sonar-web/src/main
parent508bdf5808b401dd0745c0b01c4a8c5ad87bb307 (diff)
downloadsonarqube-cf3c5203c08b21b12108b917a1725a7829d63109.tar.gz
sonarqube-cf3c5203c08b21b12108b917a1725a7829d63109.zip
SONAR-22049 Align RatingLabel type
Diffstat (limited to 'server/sonar-web/src/main')
-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
9 files changed, 23 insertions, 26 deletions
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} />;