import BubblePopup from '../../../components/common/BubblePopup';
import FormattedDate from '../../../components/ui/FormattedDate';
import PreviewGraphTooltipsContent from './PreviewGraphTooltipsContent';
+import { getLocalizedMetricName } from '../../../helpers/l10n';
import type { Metric } from '../types';
import type { Serie } from '../../../components/charts/AdvancedTimeline';
<PreviewGraphTooltipsContent
key={serie.name}
serie={serie}
- translatedName={metric && metric.custom ? metric.name : serie.translatedName}
+ translatedName={metric ? getLocalizedMetricName(metric) : serie.translatedName}
value={this.props.formatValue(point.y)}
/>
);
const SERIES_OVERVIEW = [
{
name: 'code_smells',
- translatedName: 'Code Smells',
style: 1,
data: [
{
},
{
name: 'bugs',
- translatedName: 'Bugs',
style: 0,
data: [
{
},
{
name: 'vulnerabilities',
- translatedName: 'Vulnerabilities',
style: 2,
data: [
{
];
const METRICS = [
+ { key: 'code_smells', name: 'Code Smells', type: 'INT' },
{ key: 'bugs', name: 'Bugs', type: 'INT' },
{ key: 'vulnerabilities', name: 'Vulnerabilities', type: 'INT', custom: true }
];
],
"name": "code_smells",
"style": 1,
- "translatedName": "Code Smells",
}
}
translatedName="Code Smells"
],
"name": "bugs",
"style": 0,
- "translatedName": "Bugs",
}
}
translatedName="Bugs"
],
"name": "vulnerabilities",
"style": 2,
- "translatedName": "Vulnerabilities",
}
}
translatedName="Vulnerabilities"
import GraphsLegendItem from './GraphsLegendItem';
import Tooltip from '../../../components/controls/Tooltip';
import { hasDataValues } from '../utils';
-import { translate } from '../../../helpers/l10n';
+import { getLocalizedMetricName, translate } from '../../../helpers/l10n';
import type { Metric } from '../types';
+import type { Serie } from '../../../components/charts/AdvancedTimeline';
type Props = {
metrics: Array<Metric>,
removeMetric: string => void,
- series: Array<{ name: string, translatedName: string, style: string }>
+ series: Array<Serie & { translatedName: string }>
};
export default function GraphsLegendCustom({ metrics, removeMetric, series }: Props) {
const legendItem = (
<GraphsLegendItem
metric={serie.name}
- name={metric && metric.custom ? metric.name : serie.translatedName}
+ name={metric ? getLocalizedMetricName(metric) : serie.translatedName}
showWarning={!hasData}
style={serie.style}
removeMetric={removeMetric}
import GraphsTooltipsContentCoverage from './GraphsTooltipsContentCoverage';
import GraphsTooltipsContentDuplication from './GraphsTooltipsContentDuplication';
import GraphsTooltipsContentOverview from './GraphsTooltipsContentOverview';
+import { getLocalizedMetricName } from '../../../helpers/l10n';
import type { Event, MeasureHistory, Metric } from '../types';
import type { Serie } from '../../../components/charts/AdvancedTimeline';
<GraphsTooltipsContent
key={serie.name}
serie={serie}
- translatedName={metric && metric.custom ? metric.name : serie.translatedName}
+ translatedName={
+ metric ? getLocalizedMetricName(metric) : serie.translatedName
+ }
value={this.props.formatValue(point.y)}
/>
);
ignoreHistory ? Promise.resolve() : this.fetchMeasuresHistory(graphMetrics)
]).then(response => {
if (this.mounted) {
- setTimeout(() => {
- const newState = {
- analyses: response[0].analyses,
- analysesLoading: true,
- loading: false,
- metrics: response[1],
- paging: response[0].paging
- };
- if (ignoreHistory) {
- this.setState(newState);
- } else {
+ const newState = {
+ analyses: response[0].analyses,
+ analysesLoading: true,
+ loading: false,
+ metrics: response[1],
+ paging: response[0].paging
+ };
+ if (ignoreHistory) {
+ this.setState(newState);
+ } else {
+ this.setState({
+ ...newState,
+ graphLoading: false,
+ measuresHistory: response[2]
+ });
+ }
+
+ this.loadAllActivities(query.project).then(({ analyses, paging }) => {
+ if (this.mounted) {
this.setState({
- ...newState,
- graphLoading: false,
- measuresHistory: response[2]
+ analyses,
+ analysesLoading: false,
+ paging
});
}
-
- this.loadAllActivities(query.project).then(({ analyses, paging }) => {
- if (this.mounted) {
- this.setState({
- analyses,
- analysesLoading: false,
- paging
- });
- }
- });
- }, 1000);
+ });
}
});
}
"translatedName": "metric.bugs.name",
}
}
- translatedName="metric.bugs.name"
+ translatedName="Bugs"
value="Formated.0"
/>
<GraphsTooltipsContent
import Select from 'react-select';
import Tooltip from '../../../../components/controls/Tooltip';
import { isDiffMetric } from '../../../../helpers/measures';
-import { translate, translateWithParameters } from '../../../../helpers/l10n';
+import {
+ getLocalizedMetricName,
+ translate,
+ translateWithParameters
+} from '../../../../helpers/l10n';
import type { Metric } from '../../types';
type Props = {
})
.map((metric: Metric) => ({
value: metric.key,
- label: metric.custom ? metric.name : translate('metric', metric.key, 'name')
+ label: getLocalizedMetricName(metric)
}));
};