diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts
index 0e362ffe..01f6add6 100644
--- a/src/store/modules/dashboard.ts
+++ b/src/store/modules/dashboard.ts
@@ -16,11 +16,11 @@
*/
import { defineStore } from "pinia";
import { store } from "@/store";
-import { GridItemData } from "@/types/dashboard";
+import { LayoutConfig } from "@/types/dashboard";
interface DashboardState {
showConfig: boolean;
- layout: GridItemData[];
+ layout: LayoutConfig[];
}
export const dashboardStore = defineStore({
@@ -30,25 +30,25 @@ export const dashboardStore = defineStore({
showConfig: false,
}),
actions: {
- setLayout(data: GridItemData[]) {
+ setLayout(data: LayoutConfig[]) {
this.layout = data;
},
addWidget() {
- const newWidget: GridItemData = {
+ const newWidget: LayoutConfig = {
x: 0,
y: 0,
- w: 12,
+ w: 24,
h: 12,
i: String(this.layout.length),
};
- this.layout = this.layout.map((d: GridItemData) => {
+ this.layout = this.layout.map((d: LayoutConfig) => {
d.y = d.y + newWidget.h;
return d;
});
this.layout.push(newWidget);
},
- removeWidget(item: GridItemData) {
- this.layout = this.layout.filter((d: GridItemData) => d.i !== item.i);
+ removeWidget(item: LayoutConfig) {
+ this.layout = this.layout.filter((d: LayoutConfig) => d.i !== item.i);
},
setConfigPanel(show: boolean) {
this.showConfig = show;
diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts
index 7a51c495..22007423 100644
--- a/src/types/dashboard.ts
+++ b/src/types/dashboard.ts
@@ -1,3 +1,5 @@
+import { string } from "vue-types";
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,11 +16,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export interface GridItemData {
+export interface LayoutConfig {
x: number;
- y: number;
+ y?: number;
w: number;
h: number;
i: string;
- static?: boolean;
+ widget?: WidgetConfig;
+ graph?: GraphConfig;
+}
+
+export interface WidgetConfig {
+ title: string;
+ Metrics: string[];
+ unit: string;
+ tips: string;
+ sortOrder: string;
+}
+
+export interface GraphConfig {
+ type: string;
}
diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue
index fd8da6ea..afe6c2bb 100644
--- a/src/views/dashboard/Edit.vue
+++ b/src/views/dashboard/Edit.vue
@@ -38,29 +38,27 @@ limitations under the License. -->
diff --git a/src/views/dashboard/panel/Widget.vue b/src/views/dashboard/panel/Widget.vue
index f1fe184a..82201551 100644
--- a/src/views/dashboard/panel/Widget.vue
+++ b/src/views/dashboard/panel/Widget.vue
@@ -32,11 +32,11 @@ limitations under the License. -->