diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-10 15:51:33 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-13 14:34:17 +0200 |
commit | faaee054e871a3aac2167063e411d1373956e082 (patch) | |
tree | 9744f17cb226a5e2dbe21cedc8e73d7d93802160 /server | |
parent | 8746fbda0290c691705208caad6a7c2590191673 (diff) | |
download | sonarqube-faaee054e871a3aac2167063e411d1373956e082.tar.gz sonarqube-faaee054e871a3aac2167063e411d1373956e082.zip |
SONAR-9403 Add information message when selecting a metric to build a custom graph
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js | 15 |
1 files changed, 11 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 ( <Modal isOpen={true} @@ -115,11 +115,18 @@ export default class AddGraphMetric extends React.PureComponent { clearable={false} noResultsText={translate('no_results')} onChange={this.handleChange} - options={this.getMetricsOptions()} + options={this.getMetricsOptions(metricType)} placeholder="" searchable={true} value={this.state.selectedMetric} /> + {metricType != null && + <span className="note"> + {translateWithParameters( + 'project_activity.graphs.custom.type_x_message', + translate('metric.type', metricType) + )} + </span>} </div> </div> <footer className="modal-foot"> |