ui: fix double metric selection in list
This commit is contained in:
parent
96a70f5d41
commit
ce0921bb15
3 changed files with 2 additions and 3 deletions
|
|
@ -117,8 +117,6 @@ const ListView: React.FC<Props> = ({
|
||||||
if (disableSelection) {
|
if (disableSelection) {
|
||||||
const path = withSiteId(`/metrics/${metric.metricId}`, siteId);
|
const path = withSiteId(`/metrics/${metric.metricId}`, siteId);
|
||||||
history.push(path);
|
history.push(path);
|
||||||
} else {
|
|
||||||
toggleSelection?.(metric.metricId);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ function MetricsList({
|
||||||
}, [selectedMetrics, onSelectionChange]);
|
}, [selectedMetrics, onSelectionChange]);
|
||||||
|
|
||||||
const toggleMetricSelection = (id: any) => {
|
const toggleMetricSelection = (id: any) => {
|
||||||
|
console.log(id)
|
||||||
if (Array.isArray(id)) {
|
if (Array.isArray(id)) {
|
||||||
setSelectedMetrics(id);
|
setSelectedMetrics(id);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ export default class DashboardStore {
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
const response = await dashboardService.addWidget(dashboard, metricIds);
|
await dashboardService.addWidget(dashboard, metricIds);
|
||||||
toast.success('Card added to dashboard.');
|
toast.success('Card added to dashboard.');
|
||||||
} catch {
|
} catch {
|
||||||
toast.error('Card could not be added.');
|
toast.error('Card could not be added.');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue