diff options
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r-- | server/sonar-web/src/main/js/components/measure/Measure.tsx | 6 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/measure/utils.ts | 21 |
2 files changed, 7 insertions, 20 deletions
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 7836b86e1d6..200035f8016 100644 --- a/server/sonar-web/src/main/js/components/measure/Measure.tsx +++ b/server/sonar-web/src/main/js/components/measure/Measure.tsx @@ -21,8 +21,8 @@ import * as React from 'react'; import Rating from '../ui/Rating'; import Level from '../ui/Level'; import Tooltips from '../controls/Tooltip'; -import { formatMeasure, isDiffMetric } from '../../helpers/measures'; -import { formatLeak, getRatingTooltip, MeasureEnhanced } from './utils'; +import { formatMeasure, isDiffMetric, MeasureEnhanced } from '../../helpers/measures'; +import { formatLeak, getRatingTooltip } from './utils'; interface Props { className?: string; @@ -35,7 +35,7 @@ export default function Measure({ className, decimals, measure }: Props) { return <span>{'–'}</span>; } - const metric = measure.metric; + const { metric } = measure; const value = isDiffMetric(metric.key) ? measure.leak : measure.value; if (value === undefined) { diff --git a/server/sonar-web/src/main/js/components/measure/utils.ts b/server/sonar-web/src/main/js/components/measure/utils.ts index a526a8443c4..8e932892152 100644 --- a/server/sonar-web/src/main/js/components/measure/utils.ts +++ b/server/sonar-web/src/main/js/components/measure/utils.ts @@ -21,33 +21,20 @@ import { formatMeasure, formatMeasureVariation, getRatingTooltip as nextGetRatingTooltip, - isDiffMetric + isDiffMetric, + Measure, + MeasureEnhanced } from '../../helpers/measures'; import { Metric } from '../../app/types'; const KNOWN_RATINGS = ['sqale_rating', 'reliability_rating', 'security_rating']; -export interface MeasureIntern { - value?: string; - periods?: Array<{ index: number; value: string }>; -} - -export interface Measure extends MeasureIntern { - metric: string; -} - -export interface MeasureEnhanced extends MeasureIntern { - metric: { key: string; type: string }; - leak?: string | undefined | undefined; -} - export function enhanceMeasure( measure: Measure, metrics: { [key: string]: Metric } ): MeasureEnhanced { return { - value: measure.value, - periods: measure.periods, + ...measure, metric: metrics[measure.metric], leak: getLeakValue(measure) }; |