import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
import { MetricKey } from '~sonar-aligned/types/metrics';
+import { SOFTWARE_QUALITY_RATING_METRICS } from '../../../helpers/constants';
import {
getLocalizedMetricDomain,
getLocalizedMetricName,
</div>
{bubbleMetrics.colors && (
<ColorRatingsLegend
+ isLegacy={
+ isLegacy ||
+ bubbleMetrics.colors.every(
+ (m) => !SOFTWARE_QUALITY_RATING_METRICS.includes(m.key as MetricKey),
+ )
+ }
className="sw-mt-2"
filters={ratingFilters}
onRatingClick={handleRatingFilterClick}
import { formatMeasure } from '~sonar-aligned/helpers/measures';
import { MetricType } from '~sonar-aligned/types/metrics';
import { translateWithParameters } from '../../../helpers/l10n';
-import { useIsLegacyCCTMode } from '../../../queries/settings';
export interface ColorRatingsLegendProps {
className?: string;
filters: { [rating: number]: boolean };
+ isLegacy?: boolean;
onRatingClick: (selection: number) => void;
}
export default function ColorRatingsLegend(props: ColorRatingsLegendProps) {
- const { data: isLegacy } = useIsLegacyCCTMode();
+ const { className, filters, isLegacy } = props;
const theme = useTheme();
const RATINGS = isLegacy ? [1, 2, 3, 4, 5] : [1, 2, 3, 4];
- const { className, filters } = props;
-
const ratingsColors = RATINGS.map((rating: BubbleColorVal) => {
const formattedMeasure = formatMeasure(rating, MetricType.Rating);
return {
}
export function areCCTMeasuresComputed(measures?: Measure[] | MeasureEnhanced[]) {
+ if (!measures || measures.length === 0) {
+ return true;
+ }
return CCT_SOFTWARE_QUALITY_METRICS.every((metric) =>
measures?.find((measure) =>
isMeasureEnhanced(measure) ? measure.metric.key === metric : measure.metric === metric,