aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.js15
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
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 (
<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">
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 78886e2d67b..70928d87746 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1292,6 +1292,7 @@ project_activity.graphs.custom.add=Add metric
project_activity.graphs.custom.add_metric=Add a metric
project_activity.graphs.custom.no_history=There is no historical data to show, please add more metrics to your graph.
project_activity.graphs.custom.search=Search for a metric by name
+project_activity.graphs.custom.type_x_message=Only "{0}" metrics are available with your current selection.
project_activity.custom_metric.covered_lines=Covered Lines