aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/component-measures/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/component-measures/utils.ts')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
index e146258c985..ca845e698b2 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
@@ -21,7 +21,7 @@ import { groupBy, memoize, sortBy, toPairs } from 'lodash';
import { enhanceMeasure } from '../../components/measure/utils';
import { isBranch, isPullRequest } from '../../helpers/branch-like';
import { getLocalizedMetricName } from '../../helpers/l10n';
-import { getDisplayMetrics, isDiffMetric } from '../../helpers/measures';
+import { MEASURES_REDIRECTION, getDisplayMetrics, isDiffMetric } from '../../helpers/measures';
import {
cleanQuery,
parseAsOptionalBoolean,
@@ -231,7 +231,8 @@ export interface Query {
}
export const parseQuery = memoize((urlQuery: RawQuery): Query => {
- const metric = (parseAsString(urlQuery['metric']) || DEFAULT_METRIC) as MetricKey;
+ const parsedMetric = parseAsString<MetricKey>(urlQuery['metric']) || DEFAULT_METRIC;
+ const metric = MEASURES_REDIRECTION[parsedMetric] ?? parsedMetric;
return {
metric,
selected: parseAsString(urlQuery['selected']),