mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-10-14 20:01:28 +00:00
fix: calculate widget index and init metrics config (#41)
This commit is contained in:
@@ -76,9 +76,10 @@ export const dashboardStore = defineStore({
|
||||
this.currentDashboard = item;
|
||||
},
|
||||
addControl(type: string) {
|
||||
const arr = this.layout.map((d: any) => Number(d.i));
|
||||
const newItem: LayoutConfig = {
|
||||
...NewControl,
|
||||
i: String(this.layout.length),
|
||||
i: String(Math.max(...arr) + 1),
|
||||
type,
|
||||
metricTypes: [""],
|
||||
metrics: [""],
|
||||
@@ -146,9 +147,10 @@ export const dashboardStore = defineStore({
|
||||
}
|
||||
const tabIndex = this.layout[idx].activedTabIndex || 0;
|
||||
const { children } = this.layout[idx].children[tabIndex];
|
||||
const arr = children.map((d: any) => Number(d.i));
|
||||
const newItem: LayoutConfig = {
|
||||
...NewControl,
|
||||
i: String(children.length),
|
||||
i: String(Math.max(...arr) + 1),
|
||||
type,
|
||||
metricTypes: [""],
|
||||
metrics: [""],
|
||||
|
Reference in New Issue
Block a user