aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorLucas <97296331+lucas-paulger-sonarsource@users.noreply.github.com>2024-12-10 11:38:07 +0200
committerSteve Marion <steve.marion@sonarsource.com>2024-12-18 11:13:21 +0100
commitbd488052eb3e86a10cdc9c4c10f2ec51d6a97856 (patch)
tree883d47c98af64b625d2855e62c3a79162f285e00 /server
parentf4be4615fd322f4c29cda845934fe8e43fea0c64 (diff)
downloadsonarqube-bd488052eb3e86a10cdc9c4c10f2ec51d6a97856.tar.gz
sonarqube-bd488052eb3e86a10cdc9c4c10f2ec51d6a97856.zip
SONAR-21038 Indicate not computed metrics correctly
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx64
1 files changed, 34 insertions, 30 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx b/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx
index 62b3dd41e5c..bdad50531c8 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx
@@ -18,16 +18,15 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react';
+import { LinkHighlight, LinkStandalone, Text } from '@sonarsource/echoes-react';
import classNames from 'classnames';
import * as React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { To } from 'react-router-dom';
-import { CoverageIndicator, DuplicationsIndicator, LightLabel, TextError } from '~design-system';
+import { CoverageIndicator, DuplicationsIndicator } from '~design-system';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
import { duplicationRatingConverter, getLeakValue } from '../../../components/measure/utils';
-import { translate, translateWithParameters } from '../../../helpers/l10n';
import { findMeasure, localizeMetric } from '../../../helpers/measures';
import { isDefined } from '../../../helpers/types';
import { getComponentDrilldownUrl } from '../../../helpers/urls';
@@ -113,12 +112,11 @@ export default function MeasuresCardPercent(
{shouldRenderRequiredLabel && (
<span className="sw-typo-sm sw-mt-3">
{conditionFailed ? (
- <TextError
- className="sw-font-regular sw-inline"
- text={getConditionRequiredLabel(condition, intl, true)}
- />
+ <Text colorOverride="echoes-color-text-danger" className="sw-font-regular sw-inline">
+ {getConditionRequiredLabel(condition, intl, true)}
+ </Text>
) : (
- <LightLabel>{getConditionRequiredLabel(condition, intl)}</LightLabel>
+ <Text isSubdued>{getConditionRequiredLabel(condition, intl)}</Text>
)}
</span>
)}
@@ -128,28 +126,34 @@ export default function MeasuresCardPercent(
'sw-mt-3': !shouldRenderRequiredLabel,
})}
>
- <LightLabel className="sw-flex sw-gap-1">
- <FormattedMessage
- defaultMessage={translate(linesLabel)}
- id={linesLabel}
- values={{
- link: (
- <LinkStandalone
- highlight={LinkHighlight.Default}
- aria-label={translateWithParameters(
- 'overview.see_more_details_on_x_y',
- isDefined(linesValue) ? `${formattedMeasure} (${linesValue})` : '0',
- localizeMetric(linesMetric),
- )}
- className="sw-typo-semibold sw--mt-[3px]"
- to={linesUrl}
- >
- {formattedMeasure}
- </LinkStandalone>
- ),
- }}
- />
- </LightLabel>
+ <Text isSubdued className="sw-flex sw-gap-1">
+ {isDefined(value) ? (
+ <FormattedMessage
+ defaultMessage={intl.formatMessage({ id: linesLabel }, { link: '' })}
+ id={linesLabel}
+ values={{
+ link: (
+ <LinkStandalone
+ highlight={LinkHighlight.Default}
+ aria-label={intl.formatMessage(
+ { id: 'overview.see_more_details_on_x_y' },
+ {
+ 0: isDefined(linesValue) ? `${formattedMeasure} (${linesValue})` : '0',
+ 1: localizeMetric(linesMetric),
+ },
+ )}
+ className="sw-typo-semibold"
+ to={linesUrl}
+ >
+ {formattedMeasure}
+ </LinkStandalone>
+ ),
+ }}
+ />
+ ) : (
+ intl.formatMessage({ id: 'overview.metric_not_computed' })
+ )}
+ </Text>
</div>
{overallConditionMetric && isPullRequest(branchLike) && (
<AfterMergeNote measures={measures} overallMetric={overallConditionMetric} />