mirror of
https://github.com/apache/superset.git
synced 2026-04-25 02:55:07 +00:00
[Explore] Streamlined metric definitions for SQLA and Druid (#4663)
* adding streamlined metric editing * addressing lint issues on new metrics control * enabling druid
This commit is contained in:
committed by
Maxime Beauchemin
parent
7e1b6b7363
commit
68dec24542
@@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import AdhocMetricOption from './AdhocMetricOption';
|
||||
import AdhocMetric from '../AdhocMetric';
|
||||
import columnType from '../propTypes/columnType';
|
||||
import MetricOption from '../../components/MetricOption';
|
||||
import savedMetricType from '../propTypes/savedMetricType';
|
||||
import adhocMetricType from '../propTypes/adhocMetricType';
|
||||
|
||||
const propTypes = {
|
||||
option: PropTypes.oneOfType([
|
||||
savedMetricType,
|
||||
adhocMetricType,
|
||||
]).isRequired,
|
||||
onMetricEdit: PropTypes.func,
|
||||
columns: PropTypes.arrayOf(columnType),
|
||||
multi: PropTypes.bool,
|
||||
datasourceType: PropTypes.string,
|
||||
};
|
||||
|
||||
export default function MetricDefinitionValue({
|
||||
option,
|
||||
onMetricEdit,
|
||||
columns,
|
||||
multi,
|
||||
datasourceType,
|
||||
}) {
|
||||
if (option.metric_name) {
|
||||
return (
|
||||
<MetricOption metric={option} />
|
||||
);
|
||||
} else if (option instanceof AdhocMetric) {
|
||||
return (
|
||||
<AdhocMetricOption
|
||||
adhocMetric={option}
|
||||
onMetricEdit={onMetricEdit}
|
||||
columns={columns}
|
||||
multi={multi}
|
||||
datasourceType={datasourceType}
|
||||
/>
|
||||
);
|
||||
}
|
||||
notify.error('You must supply either a saved metric or adhoc metric to MetricDefinitionValue');
|
||||
return null;
|
||||
}
|
||||
MetricDefinitionValue.propTypes = propTypes;
|
||||
Reference in New Issue
Block a user