mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-16 18:45:23 +00:00
fix save config
This commit is contained in:
parent
d01631ef04
commit
5c73b067f4
@ -355,10 +355,8 @@ export const dashboardStore = defineStore({
|
||||
|
||||
if (this.currentDashboard.id) {
|
||||
res = await this.updateDashboard({
|
||||
setting: {
|
||||
id: this.currentDashboard.id,
|
||||
configuration: JSON.stringify(c),
|
||||
},
|
||||
id: this.currentDashboard.id,
|
||||
configuration: JSON.stringify(c),
|
||||
});
|
||||
json = res.data.changeTemplate;
|
||||
} else {
|
||||
@ -387,18 +385,26 @@ export const dashboardStore = defineStore({
|
||||
ElMessage.error(json.message);
|
||||
return;
|
||||
}
|
||||
ElMessage.success("Saved successfully");
|
||||
|
||||
this.dashboards.push({
|
||||
...this.currentDashboard,
|
||||
id: json.id,
|
||||
});
|
||||
if (!this.currentDashboard.id) {
|
||||
ElMessage.success("Saved successfully");
|
||||
}
|
||||
const key = [
|
||||
this.currentDashboard.layer,
|
||||
this.currentDashboard.entity,
|
||||
this.currentDashboard.name.split(" ").join("-"),
|
||||
].join("_");
|
||||
if (this.currentDashboard.id) {
|
||||
sessionStorage.removeItem(key);
|
||||
this.dashboards = this.dashboards.filter(
|
||||
(d: DashboardItem) => d.id !== this.currentDashboard.id
|
||||
);
|
||||
}
|
||||
this.dashboards.push({
|
||||
...this.currentDashboard,
|
||||
id: json.id,
|
||||
});
|
||||
const l = { id: json.id, configuration: c };
|
||||
|
||||
sessionStorage.setItem(key, JSON.stringify(l));
|
||||
sessionStorage.setItem("dashboards", JSON.stringify(this.dashboards));
|
||||
},
|
||||
|
@ -62,14 +62,16 @@ async function setTemplate() {
|
||||
sessionStorage.getItem(layoutKey) || "{}"
|
||||
);
|
||||
const layout: any = c.configuration || {};
|
||||
|
||||
dashboardStore.setLayout(layout.children || []);
|
||||
appStore.setPageTitle(layout.name);
|
||||
|
||||
if (!dashboardStore.currentDashboard) {
|
||||
dashboardStore.setCurrentDashboard({
|
||||
layer: p.layerId,
|
||||
entity: p.layerId,
|
||||
entity: p.entity,
|
||||
name: p.name,
|
||||
id: c.id,
|
||||
isRoot: layout.isRoot,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -79,10 +79,10 @@ function getOption() {
|
||||
name: i,
|
||||
type: "line",
|
||||
symbol: "circle",
|
||||
barMaxWidth: 10,
|
||||
symbolSize: 8,
|
||||
showSymbol: props.config.showSymbol,
|
||||
step: props.config.step,
|
||||
smooth: props.config.smooth,
|
||||
showSymbol: props.config.showSymbol,
|
||||
lineStyle: {
|
||||
width: 1.5,
|
||||
type: "solid",
|
||||
|
@ -319,7 +319,7 @@ function setTabControls(id: string) {
|
||||
dashboardStore.addTabControls("Topology");
|
||||
break;
|
||||
case "apply":
|
||||
dashboardStore.saveDashboard(params.name);
|
||||
dashboardStore.saveDashboard();
|
||||
break;
|
||||
default:
|
||||
ElMessage.info("Don't support this control");
|
||||
@ -348,7 +348,7 @@ function setControls(id: string) {
|
||||
dashboardStore.addControl("Topology");
|
||||
break;
|
||||
case "apply":
|
||||
dashboardStore.saveDashboard(params.name);
|
||||
dashboardStore.saveDashboard();
|
||||
break;
|
||||
default:
|
||||
dashboardStore.addControl("Widget");
|
||||
|
Loading…
Reference in New Issue
Block a user