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) {
|
if (this.currentDashboard.id) {
|
||||||
res = await this.updateDashboard({
|
res = await this.updateDashboard({
|
||||||
setting: {
|
id: this.currentDashboard.id,
|
||||||
id: this.currentDashboard.id,
|
configuration: JSON.stringify(c),
|
||||||
configuration: JSON.stringify(c),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
json = res.data.changeTemplate;
|
json = res.data.changeTemplate;
|
||||||
} else {
|
} else {
|
||||||
@ -387,18 +385,26 @@ export const dashboardStore = defineStore({
|
|||||||
ElMessage.error(json.message);
|
ElMessage.error(json.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ElMessage.success("Saved successfully");
|
if (!this.currentDashboard.id) {
|
||||||
|
ElMessage.success("Saved successfully");
|
||||||
this.dashboards.push({
|
}
|
||||||
...this.currentDashboard,
|
|
||||||
id: json.id,
|
|
||||||
});
|
|
||||||
const key = [
|
const key = [
|
||||||
this.currentDashboard.layer,
|
this.currentDashboard.layer,
|
||||||
this.currentDashboard.entity,
|
this.currentDashboard.entity,
|
||||||
this.currentDashboard.name.split(" ").join("-"),
|
this.currentDashboard.name.split(" ").join("-"),
|
||||||
].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 };
|
const l = { id: json.id, configuration: c };
|
||||||
|
|
||||||
sessionStorage.setItem(key, JSON.stringify(l));
|
sessionStorage.setItem(key, JSON.stringify(l));
|
||||||
sessionStorage.setItem("dashboards", JSON.stringify(this.dashboards));
|
sessionStorage.setItem("dashboards", JSON.stringify(this.dashboards));
|
||||||
},
|
},
|
||||||
|
@ -62,14 +62,16 @@ async function setTemplate() {
|
|||||||
sessionStorage.getItem(layoutKey) || "{}"
|
sessionStorage.getItem(layoutKey) || "{}"
|
||||||
);
|
);
|
||||||
const layout: any = c.configuration || {};
|
const layout: any = c.configuration || {};
|
||||||
|
|
||||||
dashboardStore.setLayout(layout.children || []);
|
dashboardStore.setLayout(layout.children || []);
|
||||||
appStore.setPageTitle(layout.name);
|
appStore.setPageTitle(layout.name);
|
||||||
|
|
||||||
if (!dashboardStore.currentDashboard) {
|
if (!dashboardStore.currentDashboard) {
|
||||||
dashboardStore.setCurrentDashboard({
|
dashboardStore.setCurrentDashboard({
|
||||||
layer: p.layerId,
|
layer: p.layerId,
|
||||||
entity: p.layerId,
|
entity: p.entity,
|
||||||
name: p.name,
|
name: p.name,
|
||||||
|
id: c.id,
|
||||||
|
isRoot: layout.isRoot,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,10 @@ function getOption() {
|
|||||||
name: i,
|
name: i,
|
||||||
type: "line",
|
type: "line",
|
||||||
symbol: "circle",
|
symbol: "circle",
|
||||||
barMaxWidth: 10,
|
symbolSize: 8,
|
||||||
|
showSymbol: props.config.showSymbol,
|
||||||
step: props.config.step,
|
step: props.config.step,
|
||||||
smooth: props.config.smooth,
|
smooth: props.config.smooth,
|
||||||
showSymbol: props.config.showSymbol,
|
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 1.5,
|
width: 1.5,
|
||||||
type: "solid",
|
type: "solid",
|
||||||
|
@ -319,7 +319,7 @@ function setTabControls(id: string) {
|
|||||||
dashboardStore.addTabControls("Topology");
|
dashboardStore.addTabControls("Topology");
|
||||||
break;
|
break;
|
||||||
case "apply":
|
case "apply":
|
||||||
dashboardStore.saveDashboard(params.name);
|
dashboardStore.saveDashboard();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ElMessage.info("Don't support this control");
|
ElMessage.info("Don't support this control");
|
||||||
@ -348,7 +348,7 @@ function setControls(id: string) {
|
|||||||
dashboardStore.addControl("Topology");
|
dashboardStore.addControl("Topology");
|
||||||
break;
|
break;
|
||||||
case "apply":
|
case "apply":
|
||||||
dashboardStore.saveDashboard(params.name);
|
dashboardStore.saveDashboard();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dashboardStore.addControl("Widget");
|
dashboardStore.addControl("Widget");
|
||||||
|
Loading…
Reference in New Issue
Block a user