diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts index b3eeea4b..201d21d3 100644 --- a/src/hooks/useProcessor.ts +++ b/src/hooks/useProcessor.ts @@ -28,6 +28,9 @@ export function useQueryProcessor(config: any) { if (!(config.metrics && config.metrics[0])) { return; } + if (!(config.metricTypes && config.metricTypes[0])) { + return; + } const appStore = useAppStoreWithOut(); const dashboardStore = useDashboardStore(); const selectorStore = useSelectorStore(); @@ -221,6 +224,12 @@ export function useQueryPodsMetrics( config: { metrics: string[]; metricTypes: string[] }, scope: string ) { + if (!(config.metrics && config.metrics[0])) { + return; + } + if (!(config.metricTypes && config.metricTypes[0])) { + return; + } const appStore = useAppStoreWithOut(); const selectorStore = useSelectorStore(); const conditions: { [key: string]: unknown } = { diff --git a/src/store/data.ts b/src/store/data.ts index eba3c3bb..d6d3e01e 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -21,14 +21,6 @@ export const NewControl = { h: 12, i: "0", type: "Widget", - widget: { - title: "", - }, - graph: {}, - standard: {}, - metrics: [""], - metricTypes: [""], - metricConfig: [], }; export const TextConfig = { fontColor: "white", diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts index fc56a4d1..d06213be 100644 --- a/src/types/dashboard.ts +++ b/src/types/dashboard.ts @@ -28,13 +28,12 @@ export interface LayoutConfig { w: number; h: number; i: string; - widget: WidgetConfig; - graph: GraphConfig; - standard: StandardConfig; - metrics: string[]; + widget?: WidgetConfig; + graph?: GraphConfig; + metrics?: string[]; type: string; - metricTypes: string[]; - children?: any; + metricTypes?: string[]; + children?: { name: string; children: LayoutConfig[] }[]; activedTabIndex?: number; metricConfig?: MetricConfigOpt[]; } @@ -53,20 +52,6 @@ export interface WidgetConfig { tips?: string; } -export interface StandardConfig { - sortOrder?: string; - unit?: string; - labelsIndex?: string; - metricLabels?: string; - plus?: string; - minus?: string; - multiply?: string; - divide?: string; - milliseconds?: string; - seconds?: string; - maxItemNum?: number; -} - export type GraphConfig = | BarConfig | LineConfig diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 13239a6e..6e60c63c 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -16,20 +16,20 @@ limitations under the License. -->