mirror of
https://github.com/apache/superset.git
synced 2026-04-26 03:24:53 +00:00
refactor(explore): convert ControlPanelsContainer to typescript (#13221)
This commit is contained in:
@@ -38,7 +38,6 @@ const propTypes = {
|
||||
savedMetricsOptions: PropTypes.arrayOf(savedMetricType),
|
||||
multi: PropTypes.bool,
|
||||
datasourceType: PropTypes.string,
|
||||
datasource: PropTypes.string,
|
||||
};
|
||||
|
||||
export default function MetricDefinitionValue({
|
||||
@@ -52,16 +51,15 @@ export default function MetricDefinitionValue({
|
||||
onMoveLabel,
|
||||
onDropLabel,
|
||||
index,
|
||||
datasource,
|
||||
}) {
|
||||
const getSavedMetricByName = metricName =>
|
||||
savedMetrics.find(metric => metric.metric_name === metricName);
|
||||
|
||||
let savedMetric;
|
||||
if (option.metric_name) {
|
||||
savedMetric = option;
|
||||
} else if (typeof option === 'string') {
|
||||
if (typeof option === 'string') {
|
||||
savedMetric = getSavedMetricByName(option);
|
||||
} else if (option.metric_name) {
|
||||
savedMetric = option;
|
||||
}
|
||||
|
||||
if (option instanceof AdhocMetric || savedMetric) {
|
||||
@@ -79,7 +77,6 @@ export default function MetricDefinitionValue({
|
||||
onDropLabel,
|
||||
index,
|
||||
savedMetric: savedMetric ?? {},
|
||||
datasource,
|
||||
};
|
||||
|
||||
return <AdhocMetricOption {...metricOptionProps} />;
|
||||
|
||||
Reference in New Issue
Block a user