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",
|
editTab: "Enable editing tab names",
|
||||||
label: "Service Name",
|
label: "Service Name",
|
||||||
id: "Service ID",
|
id: "Service ID",
|
||||||
setRoot: "Set this to root",
|
setRoot: "Set Normal to Root",
|
||||||
setNormal: "Set this to normal",
|
setNormal: "Set Root to Normal",
|
||||||
export: "Export Dashboard Templates",
|
export: "Export Dashboard Templates",
|
||||||
import: "Import Dashboard Templates",
|
import: "Import Dashboard Templates",
|
||||||
yes: "Yes",
|
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;
|
layer: string;
|
||||||
isRoot: boolean;
|
isRoot: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
|
topLevel: boolean;
|
||||||
};
|
};
|
||||||
export interface LayoutConfig {
|
export interface LayoutConfig {
|
||||||
x: number;
|
x: number;
|
||||||
|
@ -191,6 +191,7 @@ limitations under the License. -->
|
|||||||
layer: layer,
|
layer: layer,
|
||||||
entity: entity,
|
entity: entity,
|
||||||
isRoot: false,
|
isRoot: false,
|
||||||
|
topLevel: false,
|
||||||
};
|
};
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
p.id = item.id;
|
p.id = item.id;
|
||||||
@ -382,8 +383,69 @@ limitations under the License. -->
|
|||||||
searchDashboards(1);
|
searchDashboards(1);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
function handleTopLevel(row: any) {
|
async function handleTopLevel(row: DashboardItem) {
|
||||||
console.log(row);
|
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) {
|
function handleRename(row: DashboardItem) {
|
||||||
ElMessageBox.prompt("Please input dashboard name", "Edit", {
|
ElMessageBox.prompt("Please input dashboard name", "Edit", {
|
||||||
|
Loading…
Reference in New Issue
Block a user