mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
* adding streamlined metric editing * addressing lint issues on new metrics control * enabling druid
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import MetricOption from '../../components/MetricOption';
|
|
import ColumnOption from '../../components/ColumnOption';
|
|
import AggregateOption from './AggregateOption';
|
|
import columnType from '../propTypes/columnType';
|
|
import savedMetricType from '../propTypes/savedMetricType';
|
|
import aggregateOptionType from '../propTypes/aggregateOptionType';
|
|
|
|
const propTypes = {
|
|
option: PropTypes.oneOfType([
|
|
columnType,
|
|
savedMetricType,
|
|
aggregateOptionType,
|
|
]).isRequired,
|
|
};
|
|
|
|
export default function MetricDefinitionOption({ option }) {
|
|
if (option.metric_name) {
|
|
return (
|
|
<MetricOption metric={option} showType />
|
|
);
|
|
} else if (option.column_name) {
|
|
return (
|
|
<ColumnOption column={option} showType />
|
|
);
|
|
} else if (option.aggregate_name) {
|
|
return (
|
|
<AggregateOption aggregate={option} showType />
|
|
);
|
|
}
|
|
notify.error('You must supply either a saved metric, column or aggregate to MetricDefinitionOption');
|
|
return null;
|
|
}
|
|
MetricDefinitionOption.propTypes = propTypes;
|