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 = {
}
};
- getMetricsOptions = () => {
- const selectedType = this.getMetricsType();
+ getMetricsOptions = (selectedType: ?string) => {
return this.props.metrics
.filter(metric => {
if (metric.hidden || isDiffMetric(metric.key)) {
};
renderModal() {
+ const metricType = this.getMetricsType();
return (
<Modal
isOpen={true}
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">
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