mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-10-15 12:49:17 +00:00
feat: add config panel
This commit is contained in:
@@ -19,6 +19,7 @@ import { store } from "@/store";
|
||||
import { GridItemData } from "@/types/dashboard";
|
||||
|
||||
interface DashboardState {
|
||||
showConfig: boolean;
|
||||
layout: GridItemData[];
|
||||
}
|
||||
|
||||
@@ -26,6 +27,7 @@ export const dashboardStore = defineStore({
|
||||
id: "dashboard",
|
||||
state: (): DashboardState => ({
|
||||
layout: [],
|
||||
showConfig: false,
|
||||
}),
|
||||
actions: {
|
||||
setLayout(data: GridItemData[]) {
|
||||
@@ -36,11 +38,11 @@ export const dashboardStore = defineStore({
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: 12,
|
||||
h: 3,
|
||||
h: 12,
|
||||
i: String(this.layout.length),
|
||||
};
|
||||
this.layout = this.layout.map((d: GridItemData) => {
|
||||
d.y = d.y + 3;
|
||||
d.y = d.y + newWidget.h;
|
||||
return d;
|
||||
});
|
||||
this.layout.push(newWidget);
|
||||
@@ -48,6 +50,9 @@ export const dashboardStore = defineStore({
|
||||
removeWidget(item: GridItemData) {
|
||||
this.layout = this.layout.filter((d: GridItemData) => d.i !== item.i);
|
||||
},
|
||||
setConfigPanel(show: boolean) {
|
||||
this.showConfig = show;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user