feat(explore): UX improvements for drag'n'dropping time column (#15740)

This commit is contained in:
Kamil Gabryjelski
2021-07-18 19:52:34 +02:00
committed by GitHub
parent e9383e6d00
commit 4234031cba
6 changed files with 65 additions and 25 deletions

View File

@@ -157,11 +157,11 @@ export const DndMetricSelect = (props: any) => {
const canDrop = (item: DatasourcePanelDndItem) => {
const isMetricAlreadyInValues =
item.type === 'metric' ? value.includes(item.value.metric_name) : false;
return (props.multi || value.length === 0) && !isMetricAlreadyInValues;
return !isMetricAlreadyInValues;
};
const onNewMetric = (newMetric: Metric) => {
const newValue = [...value, newMetric];
const newValue = props.isMulti ? [...value, newMetric] : [newMetric];
setValue(newValue);
handleChange(newValue);
};