mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-12 15:52:57 +00:00
feat: update
This commit is contained in:
parent
d6462b6b37
commit
cba01c0b60
@ -94,8 +94,8 @@ const msg = {
|
||||
editTab: "Enable editing tab names",
|
||||
label: "Service Name",
|
||||
id: "Service ID",
|
||||
setRoot: "Set this to root",
|
||||
setNormal: "Set this to normal",
|
||||
setRoot: "Set Normal to Root",
|
||||
setNormal: "Set Root to Normal",
|
||||
export: "Export Dashboard Templates",
|
||||
import: "Import Dashboard Templates",
|
||||
yes: "Yes",
|
||||
|
1
src/types/dashboard.d.ts
vendored
1
src/types/dashboard.d.ts
vendored
@ -21,6 +21,7 @@ export type DashboardItem = {
|
||||
layer: string;
|
||||
isRoot: boolean;
|
||||
name: string;
|
||||
topLevel: boolean;
|
||||
};
|
||||
export interface LayoutConfig {
|
||||
x: number;
|
||||
|
@ -191,6 +191,7 @@ limitations under the License. -->
|
||||
layer: layer,
|
||||
entity: entity,
|
||||
isRoot: false,
|
||||
topLevel: false,
|
||||
};
|
||||
if (index > -1) {
|
||||
p.id = item.id;
|
||||
@ -382,8 +383,69 @@ limitations under the License. -->
|
||||
searchDashboards(1);
|
||||
loading.value = false;
|
||||
}
|
||||
function handleTopLevel(row: any) {
|
||||
console.log(row);
|
||||
async function handleTopLevel(row: DashboardItem) {
|
||||
const items: DashboardItem[] = [];
|
||||
loading.value = true;
|
||||
for (const d of dashboardStore.dashboards) {
|
||||
if (d.id === row.id) {
|
||||
d.isRoot = row.topLevel;
|
||||
const key = [d.layer, d.entity, d.name].join("_");
|
||||
const layout = sessionStorage.getItem(key) || "{}";
|
||||
const c = {
|
||||
...JSON.parse(layout).configuration,
|
||||
...d,
|
||||
};
|
||||
delete c.id;
|
||||
|
||||
const setting = {
|
||||
id: d.id,
|
||||
configuration: JSON.stringify(c),
|
||||
};
|
||||
const res = await dashboardStore.updateDashboard(setting);
|
||||
if (res.data.changeTemplate.id) {
|
||||
sessionStorage.setItem(
|
||||
key,
|
||||
JSON.stringify({
|
||||
id: d.id,
|
||||
configuration: c,
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
d.layer === row.layer &&
|
||||
[EntityType[0].value].includes(d.entity) &&
|
||||
row.topLevel === false &&
|
||||
d.topLevel === true
|
||||
) {
|
||||
d.topLevel = false;
|
||||
const key = [d.layer, d.entity, d.name].join("_");
|
||||
const layout = sessionStorage.getItem(key) || "{}";
|
||||
const c = {
|
||||
...JSON.parse(layout).configuration,
|
||||
...d,
|
||||
};
|
||||
const setting = {
|
||||
id: d.id,
|
||||
configuration: JSON.stringify(c),
|
||||
};
|
||||
const res = await dashboardStore.updateDashboard(setting);
|
||||
if (res.data.changeTemplate.id) {
|
||||
sessionStorage.setItem(
|
||||
key,
|
||||
JSON.stringify({
|
||||
id: d.id,
|
||||
configuration: c,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
items.push(d);
|
||||
}
|
||||
dashboardStore.resetDashboards(items);
|
||||
searchDashboards(1);
|
||||
loading.value = false;
|
||||
}
|
||||
function handleRename(row: DashboardItem) {
|
||||
ElMessageBox.prompt("Please input dashboard name", "Edit", {
|
||||
|
Loading…
Reference in New Issue
Block a user