diff options
author | Viktor Vorona <viktor.vorona@sonarsource.com> | 2024-04-23 16:41:37 +0200 |
---|---|---|
committer | Matteo Mara <matteo.mara@sonarsource.com> | 2024-04-30 10:59:03 +0200 |
commit | 57b2e33c8c321d3297631de46e1fda374e3b17d8 (patch) | |
tree | 35a0fea4ea65bf6099fabbac25b5bdc8f6a6789e /server/sonar-web/src/main/js/apps | |
parent | a5599ff112362c822a669d965c6a9fc85d633e37 (diff) | |
download | sonarqube-57b2e33c8c321d3297631de46e1fda374e3b17d8.tar.gz sonarqube-57b2e33c8c321d3297631de46e1fda374e3b17d8.zip |
SONAR-22049 Align formatMeasure
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
45 files changed, 62 insertions, 46 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx index ecb186bf184..1cbd7c8ca53 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx @@ -31,9 +31,9 @@ import MetaLink from '../../../components/common/MetaLink'; import Tooltip from '../../../components/controls/Tooltip'; import DateFromNow from '../../../components/intl/DateFromNow'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import { orderLinks } from '../../../helpers/projectLinks'; import { getProjectUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { MyProject, ProjectLink, Status } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingTime.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingTime.tsx index d52332bbc76..7b4fc52c0f1 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingTime.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingTime.tsx @@ -20,8 +20,8 @@ import { HelperHintIcon } from 'design-system'; import * as React from 'react'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import HelpTooltip from '../../../sonar-aligned/components/controls/HelpTooltip'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; // Do not display the pending time for values smaller than this threshold (in ms) const MIN_PENDING_TIME_THRESHOLD = 1000; 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 b4b21a0fab7..a4a3a41824a 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 @@ -35,9 +35,9 @@ import { import { translateWithParameters } from '../../../helpers/l10n'; import { areCCTMeasuresComputed as areCCTMeasuresComputedFn, - formatMeasure, isDiffMetric, } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { isApplication, isProject } from '../../../types/component'; import { MetricKey, MetricType } from '../../../types/metrics'; import { Metric, Status, ComponentMeasure as TypeComponentMeasure } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx index 8f1343a4efc..9137773c91e 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { Profile, bulkActivateRules, bulkDeactivateRules } from '../../../api/quality-profiles'; import withLanguagesContext from '../../../app/components/languages/withLanguagesContext'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Languages } from '../../../types/languages'; import { MetricType } from '../../../types/metrics'; import { Dict } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx index 485e8261e07..4156a90e8ab 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx @@ -23,7 +23,7 @@ import { orderBy, sortBy, without } from 'lodash'; import * as React from 'react'; import Tooltip from '../../../components/controls/Tooltip'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { Dict } from '../../../types/types'; import { FacetItemsList } from '../../issues/sidebar/FacetItemsList'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx index f723b214a48..dbfd31d4765 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx @@ -29,8 +29,8 @@ import withAvailableFeatures, { import Tooltip from '../../../components/controls/Tooltip'; import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import { getIssuesUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Feature } from '../../../types/features'; import { FacetName } from '../../../types/issues'; import { MetricType } from '../../../types/metrics'; 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 4fd76d7d88b..b772df0a850 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 @@ -25,8 +25,9 @@ import LanguageDistribution from '../../../components/charts/LanguageDistributio import Tooltip from '../../../components/controls/Tooltip'; import Measure from '../../../components/measure/Measure'; import { getLocalizedMetricName, translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric } from '../../../helpers/measures'; +import { isDiffMetric } from '../../../helpers/measures'; import { getMeasureHistoryUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { MetricKey, MetricType } from '../../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChartView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChartView.tsx index 28bee63698c..0dd396ef30d 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChartView.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChartView.tsx @@ -33,10 +33,11 @@ import { translate, translateWithParameters, } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric } from '../../../helpers/measures'; +import { isDiffMetric } from '../../../helpers/measures'; import { isDefined } from '../../../helpers/types'; import { getComponentDrilldownUrl } from '../../../helpers/urls'; import HelpTooltip from '../../../sonar-aligned/components/controls/HelpTooltip'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { isProject, isView } from '../../../types/component'; import { MetricKey } from '../../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ColorRatingsLegend.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ColorRatingsLegend.tsx index 7b521886e71..9eecb2e95ca 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ColorRatingsLegend.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ColorRatingsLegend.tsx @@ -20,7 +20,7 @@ import { ColorFilterOption, ColorsLegend } from 'design-system'; import * as React from 'react'; import { translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; export interface ColorRatingsLegendProps { diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx index 6db5c021d3a..d7370ee781f 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx @@ -24,7 +24,8 @@ import ListFooter from '../../../components/controls/ListFooter'; import { isInput, isShortcut } from '../../../helpers/keyboardEventHelpers'; import { KeyboardKeys } from '../../../helpers/keycodes'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric, isPeriodBestValue } from '../../../helpers/measures'; +import { isDiffMetric, isPeriodBestValue } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { MeasurePageView } from '../../../types/measures'; import { MetricType } from '../../../types/metrics'; 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 e4354dbf8c9..ff45c4a3d6d 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 @@ -21,7 +21,8 @@ import { MetricsRatingBadge, NumericalCell, RatingLabel } from 'design-system'; import * as React from 'react'; import Measure from '../../../components/measure/Measure'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure, getCCTMeasureValue, isDiffMetric } from '../../../helpers/measures'; +import { getCCTMeasureValue, isDiffMetric } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { ComponentMeasureEnhanced, MeasureEnhanced, Metric } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx index d26a3a160b7..b00b48be0c6 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx @@ -36,8 +36,9 @@ import ColorBoxLegend from '../../../components/charts/ColorBoxLegend'; import ColorGradientLegend from '../../../components/charts/ColorGradientLegend'; import { getComponentMeasureUniqueKey } from '../../../helpers/component'; import { getLocalizedMetricName, translate } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric } from '../../../helpers/measures'; +import { isDiffMetric } from '../../../helpers/measures'; import { isDefined } from '../../../helpers/types'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricKey, MetricType } from '../../../types/metrics'; import { ComponentMeasureEnhanced, ComponentMeasureIntern, Metric } from '../../../types/types'; import EmptyResult from './EmptyResult'; 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 ab344f0ff6b..0b9a0e545c8 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 @@ -21,7 +21,8 @@ import { MetricsRatingBadge, Note, RatingLabel } from 'design-system'; import React from 'react'; import Measure from '../../../components/measure/Measure'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric } from '../../../helpers/measures'; +import { isDiffMetric } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { MeasureEnhanced } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/issues/components/TotalEffort.tsx b/server/sonar-web/src/main/js/apps/issues/components/TotalEffort.tsx index 2b7fc276ccc..34fc771e667 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/TotalEffort.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/TotalEffort.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; export default function TotalEffort({ effort }: { effort: number }) { return ( diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx index 829e23792f4..edd5ace2cd7 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx @@ -27,7 +27,7 @@ import DateFromNow from '../../../components/intl/DateFromNow'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { parseDate } from '../../../helpers/dates'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { Component, Dict } from '../../../types/types'; import { Query } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacet.tsx index 4552da2afc0..36cf186598c 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacet.tsx @@ -23,9 +23,9 @@ import * as React from 'react'; import ListFooter from '../../../components/controls/ListFooter'; import Tooltip from '../../../components/controls/Tooltip'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import { queriesEqual } from '../../../helpers/query'; import { isDefined } from '../../../helpers/types'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { Dict, Paging, RawQuery } from '../../../types/types'; import { FacetItemsList } from './FacetItemsList'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacetFooter.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacetFooter.tsx index 635394cc2d8..14a054bf641 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacetFooter.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ListStyleFacetFooter.tsx @@ -21,7 +21,7 @@ import { useTheme } from '@emotion/react'; import { DiscreetLink, Theme, themeColor } from 'design-system'; import * as React from 'react'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; export interface Props { diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts index 67e936bce8b..1e0da76fa23 100644 --- a/server/sonar-web/src/main/js/apps/issues/utils.ts +++ b/server/sonar-web/src/main/js/apps/issues/utils.ts @@ -20,7 +20,6 @@ import { intersection, isArray, uniq } from 'lodash'; import { getUsers } from '../../api/users'; import { DEFAULT_ISSUES_QUERY } from '../../components/shared/utils'; -import { formatMeasure } from '../../helpers/measures'; import { cleanQuery, parseAsArray, @@ -35,6 +34,7 @@ import { } from '../../helpers/query'; import { get, save } from '../../helpers/storage'; import { isDefined } from '../../helpers/types'; +import { formatMeasure } from '../../sonar-aligned/helpers/measures'; import { CleanCodeAttributeCategory, SoftwareImpactSeverity, diff --git a/server/sonar-web/src/main/js/apps/overview/branches/AnalysisVariations.tsx b/server/sonar-web/src/main/js/apps/overview/branches/AnalysisVariations.tsx index d15d4413a7b..6a372a5c18f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/AnalysisVariations.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/AnalysisVariations.tsx @@ -21,7 +21,7 @@ import styled from '@emotion/styled'; import { TrendDirection, TrendIcon, TrendType, themeColor } from 'design-system'; import React from 'react'; import { FormattedMessage } from 'react-intl'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { AnalysisMeasuresVariations } from '../../../types/project-activity'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchMetaTopBar.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchMetaTopBar.tsx index ab91aa2661c..f3df27076ac 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/BranchMetaTopBar.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchMetaTopBar.tsx @@ -23,7 +23,8 @@ import { useIntl } from 'react-intl'; import { getCurrentPage } from '../../../app/components/nav/component/utils'; import ComponentReportActions from '../../../components/controls/ComponentReportActions'; import HomePageSelect from '../../../components/controls/HomePageSelect'; -import { findMeasure, formatMeasure } from '../../../helpers/measures'; +import { findMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Branch } from '../../../types/branch-like'; import { MetricKey, MetricType } from '../../../types/metrics'; import { Component, MeasureEnhanced } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx index 94aae3bb987..3bf4823d83f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx @@ -34,13 +34,14 @@ import React from 'react'; import { useIntl } from 'react-intl'; import { getLeakValue } from '../../../components/measure/utils'; import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils'; -import { findMeasure, formatMeasure, formatRating } from '../../../helpers/measures'; +import { findMeasure, formatRating } from '../../../helpers/measures'; import { CodeScope, getComponentIssuesUrl, getComponentSecurityHotspotsUrl, } from '../../../helpers/urls'; import { getBranchLikeQuery } from '../../../sonar-aligned/helpers/branch-like'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Branch } from '../../../types/branch-like'; import { isApplication } from '../../../types/component'; import { IssueStatus } from '../../../types/issues'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/OverallCodeMeasuresPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/OverallCodeMeasuresPanel.tsx index a594bfbf0ed..e803855e937 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/OverallCodeMeasuresPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/OverallCodeMeasuresPanel.tsx @@ -26,13 +26,14 @@ import { } from 'design-system'; import * as React from 'react'; import { useIntl } from 'react-intl'; -import { findMeasure, formatMeasure, formatRating } from '../../../helpers/measures'; +import { findMeasure, formatRating } from '../../../helpers/measures'; import { CodeScope, getComponentIssuesUrl, getComponentSecurityHotspotsUrl, } from '../../../helpers/urls'; import { getBranchLikeQuery } from '../../../sonar-aligned/helpers/branch-like'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Branch } from '../../../types/branch-like'; import { SoftwareQuality } from '../../../types/clean-code-taxonomy'; import { isApplication } from '../../../types/component'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx index d07769a9c80..182b19781c6 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx @@ -28,7 +28,7 @@ import { propsToIssueParams, } from '../../../components/shared/utils'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric, localizeMetric } from '../../../helpers/measures'; +import { isDiffMetric, localizeMetric } from '../../../helpers/measures'; import { getOperatorLabel } from '../../../helpers/qualityGates'; import { getComponentDrilldownUrl, @@ -36,6 +36,7 @@ import { getComponentSecurityHotspotsUrl, } from '../../../helpers/urls'; import { getBranchLikeQuery } from '../../../sonar-aligned/helpers/branch-like'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { IssueType } from '../../../types/issues'; import { MetricKey, MetricType } from '../../../types/metrics'; @@ -139,7 +140,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> { if (metric.type !== MetricType.Rating) { const actual = (condition.period ? measure.period?.value : measure.value) as string; const formattedValue = formatMeasure(actual, metric.type, { - decimal: 2, + decimals: 1, omitExtraDecimalZeros: metric.type === MetricType.Percent, }); return `${formattedValue} ${subText}`; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateSimplifiedCondition.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateSimplifiedCondition.tsx index 4c1b3e9ba6d..e31e94ea4ee 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateSimplifiedCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateSimplifiedCondition.tsx @@ -21,9 +21,10 @@ import { Highlight, LinkBox } from 'design-system'; import * as React from 'react'; import { propsToIssueParams } from '../../../components/shared/utils'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure, isDiffMetric, localizeMetric } from '../../../helpers/measures'; +import { isDiffMetric, localizeMetric } from '../../../helpers/measures'; import { getComponentIssuesUrl } from '../../../helpers/urls'; import { getBranchLikeQuery } from '../../../sonar-aligned/helpers/branch-like'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { MetricKey, MetricType } from '../../../types/metrics'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureBreakdownCard.tsx b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureBreakdownCard.tsx index 4e6799fd95d..0f3620e3d90 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureBreakdownCard.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureBreakdownCard.tsx @@ -23,8 +23,8 @@ import { DiscreetLinkBox, Tooltip, themeColor, themeContrast } from 'design-syst import * as React from 'react'; import { useIntl } from 'react-intl'; import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils'; -import { formatMeasure } from '../../../helpers/measures'; import { getComponentIssuesUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Branch } from '../../../types/branch-like'; import { SoftwareImpactSeverity, SoftwareQuality } from '../../../types/clean-code-taxonomy'; import { MetricType } from '../../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx index 0da8bccbde3..40814c2a15e 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx @@ -28,9 +28,9 @@ import { SOFTWARE_QUALITIES_METRIC_KEYS_MAP, getIssueTypeBySoftwareQuality, } from '../../../helpers/issues'; -import { formatMeasure } from '../../../helpers/measures'; import { isDefined } from '../../../helpers/types'; import { getComponentIssuesUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Branch } from '../../../types/branch-like'; import { SoftwareImpactMeasureData, diff --git a/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardNumber.tsx b/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardNumber.tsx index feea138e269..7d186fe1fd6 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardNumber.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardNumber.tsx @@ -21,7 +21,7 @@ import { LightLabel, TextError } from 'design-system'; import * as React from 'react'; import { useIntl } from 'react-intl'; import { To } from 'react-router-dom'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricKey, MetricType } from '../../../types/metrics'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; import { Status, getConditionRequiredLabel } from '../utils'; 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 8bdb401d6f4..4875e5a0788 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 @@ -30,8 +30,9 @@ import { FormattedMessage, useIntl } from 'react-intl'; import { To } from 'react-router-dom'; import { duplicationRatingConverter, getLeakValue } from '../../../components/measure/utils'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { findMeasure, formatMeasure, localizeMetric } from '../../../helpers/measures'; +import { findMeasure, localizeMetric } from '../../../helpers/measures'; import { getComponentDrilldownUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { MetricKey, MetricType } from '../../../types/metrics'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGateConditions.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGateConditions.tsx index 9fe6fc70bb2..f2586295e7e 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGateConditions.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGateConditions.tsx @@ -27,13 +27,14 @@ import { propsToIssueParams, } from '../../../components/shared/utils'; import { getLocalizedMetricName, translate } from '../../../helpers/l10n'; -import { formatMeasure, getShortType, isDiffMetric } from '../../../helpers/measures'; +import { getShortType, isDiffMetric } from '../../../helpers/measures'; import { getComponentDrilldownUrl, getComponentIssuesUrl, getComponentSecurityHotspotsUrl, } from '../../../helpers/urls'; import { getBranchLikeQuery } from '../../../sonar-aligned/helpers/branch-like'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { IssueType } from '../../../types/issues'; import { MetricType } from '../../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/IssueMeasuresCard.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/IssueMeasuresCard.tsx index aaed573861a..613c243c5d4 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/IssueMeasuresCard.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/IssueMeasuresCard.tsx @@ -35,9 +35,10 @@ import * as React from 'react'; import { useIntl } from 'react-intl'; import { getLeakValue } from '../../../components/measure/utils'; import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils'; -import { findMeasure, formatMeasure } from '../../../helpers/measures'; +import { findMeasure } from '../../../helpers/measures'; import { getComponentIssuesUrl } from '../../../helpers/urls'; import { getBranchLikeQuery } from '../../../sonar-aligned/helpers/branch-like'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { PullRequest } from '../../../types/branch-like'; import { MetricKey, MetricType } from '../../../types/metrics'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestMetaTopBar.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestMetaTopBar.tsx index 0ce4a8aae1f..aae9b023155 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestMetaTopBar.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestMetaTopBar.tsx @@ -22,7 +22,8 @@ import React from 'react'; import { useIntl } from 'react-intl'; import CurrentBranchLikeMergeInformation from '../../../app/components/nav/component/branch-like/CurrentBranchLikeMergeInformation'; import { getLeakValue } from '../../../components/measure/utils'; -import { findMeasure, formatMeasure } from '../../../helpers/measures'; +import { findMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { PullRequest } from '../../../types/branch-like'; import { MetricKey, MetricType } from '../../../types/metrics'; import { MeasureEnhanced } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/overview/utils.tsx b/server/sonar-web/src/main/js/apps/overview/utils.tsx index bcb1431ffab..eb0c2112807 100644 --- a/server/sonar-web/src/main/js/apps/overview/utils.tsx +++ b/server/sonar-web/src/main/js/apps/overview/utils.tsx @@ -22,8 +22,8 @@ import React from 'react'; import { IntlShape } from 'react-intl'; import { ISSUETYPE_METRIC_KEYS_MAP } from '../../helpers/issues'; import { translate } from '../../helpers/l10n'; -import { formatMeasure } from '../../helpers/measures'; import { parseAsString } from '../../helpers/query'; +import { formatMeasure } from '../../sonar-aligned/helpers/measures'; import { SoftwareQuality } from '../../types/clean-code-taxonomy'; import { IssueType } from '../../types/issues'; import { MetricKey, MetricType } from '../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx index 7ab9e1ecca2..566a9332e3f 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx @@ -21,7 +21,7 @@ import { Link, Spinner } from 'design-system'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; export interface LifetimeInformationRendererProps { branchAndPullRequestLifeTimeInDays?: string; diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaSize.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaSize.tsx index 7593c2a9b32..3172136ad9c 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaSize.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaSize.tsx @@ -20,8 +20,9 @@ import { DrilldownLink, Note, SizeIndicator, SubHeading } from 'design-system'; import * as React from 'react'; import { translate, translateWithParameters } from '../../../../helpers/l10n'; -import { formatMeasure, localizeMetric } from '../../../../helpers/measures'; +import { localizeMetric } from '../../../../helpers/measures'; import { getComponentDrilldownUrl } from '../../../../helpers/urls'; +import { formatMeasure } from '../../../../sonar-aligned/helpers/measures'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey, MetricType } from '../../../../types/metrics'; import { Component, Measure } from '../../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx index 1c254aec9c4..71896a62567 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx @@ -43,9 +43,9 @@ import DateFromNow from '../../../../components/intl/DateFromNow'; import DateTimeFormatter from '../../../../components/intl/DateTimeFormatter'; import Measure from '../../../../components/measure/Measure'; import { translate, translateWithParameters } from '../../../../helpers/l10n'; -import { formatMeasure } from '../../../../helpers/measures'; import { isDefined } from '../../../../helpers/types'; import { getProjectUrl } from '../../../../helpers/urls'; +import { formatMeasure } from '../../../../sonar-aligned/helpers/measures'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey, MetricType } from '../../../../types/metrics'; import { Status } from '../../../../types/types'; 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 6dac1d3015d..f33656bbd5f 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 @@ -20,7 +20,7 @@ import { MetricsRatingBadge, RatingEnum } from 'design-system'; import * as React from 'react'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { RawQuery } from '../../../types/types'; import { Facet } from '../types'; 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 9764cea8aa6..b84363490de 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 @@ -20,7 +20,7 @@ import { MetricsRatingBadge, RatingEnum } from 'design-system'; import * as React from 'react'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { Dict, RawQuery } from '../../../types/types'; import { Facet } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CaycCondition.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CaycCondition.tsx index 4d523433faa..ad7f681dfb3 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/CaycCondition.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/CaycCondition.tsx @@ -23,8 +23,8 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import withMetricsContext from '../../../app/components/metrics/withMetricsContext'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import DocHelpTooltip from '../../../sonar-aligned/components/controls/DocHelpTooltip'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricKey } from '../../../types/metrics'; import { Condition, Dict, Metric } from '../../../types/types'; import { getCaycConditionMetadata, getLocalizedMetricNameNoDiffMetric } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValue.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValue.tsx index 82d94ed1f16..703830027cc 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValue.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValue.tsx @@ -21,7 +21,7 @@ import styled from '@emotion/styled'; import classNames from 'classnames'; import { themeColor } from 'design-system'; import * as React from 'react'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { Condition, Metric } from '../../../types/types'; import { getCorrectCaycCondition } from '../utils'; import ConditionValueDescription from './ConditionValueDescription'; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValueDescription.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValueDescription.tsx index a93ee48e131..e03131227e3 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValueDescription.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionValueDescription.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { translate } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricKey } from '../../../types/metrics'; import { Condition, Metric } from '../../../types/types'; import { GreenColorText } from './ConditionValue'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRow.tsx index 8cc304097cd..c9a9bd316a5 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRow.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRow.tsx @@ -20,9 +20,9 @@ import { ContentCell, Link, Note, NumericalCell, TableRow } from 'design-system'; import * as React from 'react'; import { translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import { isDefined } from '../../../helpers/types'; import { getRulesUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { RulesFacetName } from '../../../types/rules'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx index 45e15ddabb8..5db04574648 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx @@ -24,8 +24,8 @@ import { useIntl } from 'react-intl'; import { listRules } from '../../../api/rules'; import { toShortISO8601String } from '../../../helpers/dates'; import { translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import { getRulesUrl } from '../../../helpers/urls'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { MetricType } from '../../../types/metrics'; import { Rule, RuleActivation } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx index 1ee9b32e651..7f081e17679 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx @@ -21,8 +21,8 @@ import { ButtonPrimary, ButtonSecondary, Checkbox, Modal, Note } from 'design-sy import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; import { save } from '../../../helpers/storage'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { HotspotStatusOption } from '../../../types/security-hotspots'; import { SHOW_STATUS_DIALOG_STORAGE_KEY } from '../constants'; diff --git a/server/sonar-web/src/main/js/apps/system/utils.ts b/server/sonar-web/src/main/js/apps/system/utils.ts index 350b250031b..5168c128f3b 100644 --- a/server/sonar-web/src/main/js/apps/system/utils.ts +++ b/server/sonar-web/src/main/js/apps/system/utils.ts @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { each, memoize, omit, omitBy, pickBy, sortBy } from 'lodash'; -import { formatMeasure } from '../../helpers/measures'; import { cleanQuery, parseAsArray, parseAsString, serializeStringArray } from '../../helpers/query'; +import { formatMeasure } from '../../sonar-aligned/helpers/measures'; import { RawQuery, SysInfoAppNode, diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx index cd77dae024b..5d03123739f 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx +++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx @@ -20,7 +20,7 @@ import { CodeSnippet, Spinner } from 'design-system'; import * as React from 'react'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { formatMeasure } from '../../../helpers/measures'; +import { formatMeasure } from '../../../sonar-aligned/helpers/measures'; import { WebhookDelivery } from '../../../types/webhook'; import { formatPayload } from '../utils'; |