From d8df70ad110f859985fafb225416dd6eddfb2fd0 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 2 Dec 2024 15:51:25 +0800 Subject: [PATCH] fix(dashboard): type errors --- .../model/datasources/mm-info/metric-detail.utils.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dashboard/src/dashboard-editor/model/datasources/mm-info/metric-detail.utils.ts b/dashboard/src/dashboard-editor/model/datasources/mm-info/metric-detail.utils.ts index 6ddecd619..9f9a7605e 100644 --- a/dashboard/src/dashboard-editor/model/datasources/mm-info/metric-detail.utils.ts +++ b/dashboard/src/dashboard-editor/model/datasources/mm-info/metric-detail.utils.ts @@ -1,20 +1,20 @@ import _ from 'lodash'; import { CombinedMetricCol, + DerivedMetric, DimensionColDataType, DimensionInfo, MetricDetail, MetricSourceCol, } from './metric-detail.types'; -const isDerivedMetric = (data: MetricDetail) => 'cols' in data; - export function parseData(data: MetricDetail) { - if (isDerivedMetric(data)) { + if ('cols' in data) { + const { cols } = data as DerivedMetric; return { - filters: data.cols.filter((c) => c.type === 'filter').map((c) => c.metricSourceCol), - groupBys: data.cols.filter((c) => c.type === 'group_by').map((c) => c.metricSourceCol), - trendingDateCol: data.cols.find((c) => c.type === 'trending_date_col')?.metricSourceCol ?? null, + filters: cols.filter((c) => c.type === 'filter').map((c) => c.metricSourceCol), + groupBys: cols.filter((c) => c.type === 'group_by').map((c) => c.metricSourceCol), + trendingDateCol: cols.find((c) => c.type === 'trending_date_col')?.metricSourceCol ?? null, }; }