Files
superset2/superset/assets/javascripts/components/MetricOption.jsx
Maxime Beauchemin 16141ecb94 [explore] improve metric(s) and groupby(s) controls (#2921)
* [explore] improve metric(s) and groupby(s) controls

- surface verbose_name, description & expression in controls
- [table viz] surface verbose name in table header

* Fixing tests

* Addressing comments

* Fixing tests (once more)
2017-06-09 11:29:55 -07:00

33 lines
842 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import InfoTooltipWithTrigger from './InfoTooltipWithTrigger';
const propTypes = {
metric: PropTypes.object.isRequired,
};
export default function MetricOption({ metric }) {
return (
<div>
<span className="m-r-5 option-label">
{metric.verbose_name || metric.metric_name}
</span>
{metric.description &&
<InfoTooltipWithTrigger
className="m-r-5 text-muted"
icon="info"
tooltip={metric.description}
label={`descr-${metric.metric_name}`}
/>
}
<InfoTooltipWithTrigger
className="m-r-5 text-muted"
icon="question-circle-o"
tooltip={metric.expression}
label={`expr-${metric.metric_name}`}
/>
</div>);
}
MetricOption.propTypes = propTypes;