</tr>
<tr>
<td>assertText</td>
- <td>id=measure-code_smells-leak</td>
- <td>*+0*</td>
+ <td>id=measure-new_code_smells-leak</td>
+ <td>*0*</td>
</tr>
<tr>
<td>click</td>
import Measure from './../components/Measure';
import LanguageDistribution from './../components/LanguageDistribution';
import { ComplexityDistribution } from '../../overview/components/complexity-distribution';
-import { formatLeak } from '../utils';
+import { isDiffMetric, formatLeak } from '../utils';
import { translateWithParameters } from '../../../helpers/l10n';
import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin';
export default function MeasureDetailsHeader ({ measure, metric, secondaryMeasure, leakPeriodLabel }) {
const leakPeriodTooltip = translateWithParameters('overview.leak_period_x', leakPeriodLabel);
- const displayLeak = measure.leak != null && metric.type !== 'RATING' && metric.type !== 'LEVEL';
-
return (
<header className="measure-details-header">
<h2 className="measure-details-metric">
<TooltipsContainer options={{ html: false }}>
<div className="measure-details-value">
- {measure.value != null && (
- <div className="measure-details-value-absolute">
- <Measure measure={measure} metric={metric}/>
- </div>
- )}
- {displayLeak && (
+ {isDiffMetric(metric) ? (
<div
className="measure-details-value-leak"
title={leakPeriodTooltip}
data-toggle="tooltip">
{formatLeak(measure.leak, metric)}
</div>
+ ) : (
+ <div className="measure-details-value-absolute">
+ <Measure measure={measure} metric={metric}/>
+ </div>
)}
{secondaryMeasure && secondaryMeasure.metric === 'ncloc_language_distribution' && (
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+
+import Measure from '../components/Measure';
+import { isDiffMetric } from '../utils';
+import { formatMeasure } from '../../../helpers/measures';
+
+const MeasureListValue = ({ measure }) => {
+ const { metric } = measure;
+
+ if (isDiffMetric(metric)) {
+ return (
+ <div id={`measure-${measure.metric.key}-leak`} className="domain-measures-value domain-measures-leak">
+ {formatMeasure(measure.leak, measure.metric.key)}
+ </div>
+ );
+ }
+
+ return (
+ <div id={`measure-${measure.metric.key}-value`} className="domain-measures-value">
+ <Measure measure={measure}/>
+ </div>
+ );
+};
+
+export default MeasureListValue;
import { Link } from 'react-router';
import classNames from 'classnames';
-import Measure from '../components/Measure';
-import { formatLeak } from '../utils';
+import MeasureListValue from './MeasureListValue';
const shouldPutSpace = (spaces, measure, index) => {
return index !== 0 && spaces.includes(measure.metric.key);
};
-const MeasuresList = ({ measures, hasLeak, component, spaces }) => {
+const MeasuresList = ({ measures, component, spaces }) => {
return (
<ul className="domain-measures">
{measures.map((measure, index) => (
{measure.metric.name}
</span>
</div>
- <div className="domain-measures-value">
- {measure.value != null && (
- <span id={`measure-${measure.metric.key}-value`}>
- <Measure measure={measure}/>
- </span>
- )}
- </div>
- {hasLeak && measure.leak != null && measure.metric.type !== 'RATING' && (
- <div className="domain-measures-value domain-measures-leak">
- <span id={`measure-${measure.metric.key}-leak`}>
- {formatLeak(measure.leak, measure.metric)}
- </span>
- </div>
- )}
+
+ <MeasureListValue measure={measure}/>
</Link>
</li>
))}