From faaee054e871a3aac2167063e411d1373956e082 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Mon, 10 Jul 2017 15:51:33 +0200 Subject: [PATCH] SONAR-9403 Add information message when selecting a metric to build a custom graph --- .../components/forms/AddGraphMetric.js | 15 +++++++++++---- .../main/resources/org/sonar/l10n/core.properties | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js index 8d8b861fd24..847a41ff8ee 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js @@ -22,7 +22,7 @@ import React from 'react'; import Modal from 'react-modal'; import Select from 'react-select'; import { isDiffMetric } from '../../../../helpers/measures'; -import { translate } from '../../../../helpers/l10n'; +import { translate, translateWithParameters } from '../../../../helpers/l10n'; import type { Metric } from '../../types'; type Props = { @@ -52,8 +52,7 @@ export default class AddGraphMetric extends React.PureComponent { } }; - getMetricsOptions = () => { - const selectedType = this.getMetricsType(); + getMetricsOptions = (selectedType: ?string) => { return this.props.metrics .filter(metric => { if (metric.hidden || isDiffMetric(metric.key)) { @@ -95,6 +94,7 @@ export default class AddGraphMetric extends React.PureComponent { }; renderModal() { + const metricType = this.getMetricsType(); return ( + {metricType != null && + + {translateWithParameters( + 'project_activity.graphs.custom.type_x_message', + translate('metric.type', metricType) + )} + }