feat: update

This commit is contained in:
Fine 2024-01-03 19:01:36 +08:00
parent 1bfa30a54a
commit 881620ba81
2 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,7 @@ export type DashboardItem = {
layer: string; layer: string;
isRoot: boolean; isRoot: boolean;
name: string; name: string;
topLevel: boolean; isDefault: boolean;
}; };
export interface LayoutConfig { export interface LayoutConfig {
x: number; x: number;

View File

@ -73,7 +73,7 @@ limitations under the License. -->
<span v-else> -- </span> <span v-else> -- </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="topLevel" label="Top Level" width="80"> <el-table-column prop="isDefault" label="Default Dashboard" width="80">
<template #default="scope"> <template #default="scope">
<el-popconfirm <el-popconfirm
:title="t('rootTitle')" :title="t('rootTitle')"
@ -82,7 +82,7 @@ limitations under the License. -->
> >
<template #reference> <template #reference>
<el-button size="small" style="width: 50px"> <el-button size="small" style="width: 50px">
{{ scope.row.topLevel ? "Disable" : "Enable" }} {{ scope.row.isDefault ? "Disable" : "Enable" }}
</el-button> </el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
@ -189,19 +189,19 @@ limitations under the License. -->
} }
loading.value = true; loading.value = true;
for (const item of arr) { for (const item of arr) {
const { layer, name, entity, isRoot, children, topLevel } = item.configuration; const { layer, name, entity, isRoot, children, isDefault } = item.configuration;
const index = dashboardStore.dashboards.findIndex((d: DashboardItem) => d.id === item.id); const index = dashboardStore.dashboards.findIndex((d: DashboardItem) => d.id === item.id);
const p: DashboardItem = { const p: DashboardItem = {
name: name.split(" ").join("-"), name: name.split(" ").join("-"),
layer: layer, layer: layer,
entity: entity, entity: entity,
isRoot: false, isRoot: false,
topLevel: false, isDefault: false,
}; };
if (index > -1) { if (index > -1) {
p.id = item.id; p.id = item.id;
p.isRoot = isRoot; p.isRoot = isRoot;
p.topLevel = topLevel; p.isDefault = isDefault;
} }
dashboardStore.setCurrentDashboard(p); dashboardStore.setCurrentDashboard(p);
dashboardStore.setLayout(children); dashboardStore.setLayout(children);
@ -394,7 +394,7 @@ limitations under the License. -->
loading.value = true; loading.value = true;
for (const d of dashboardStore.dashboards) { for (const d of dashboardStore.dashboards) {
if (d.id === row.id) { if (d.id === row.id) {
d.topLevel = !row.topLevel; d.isDefault = !row.isDefault;
const key = [d.layer, d.entity, d.name].join("_"); const key = [d.layer, d.entity, d.name].join("_");
const layout = sessionStorage.getItem(key) || "{}"; const layout = sessionStorage.getItem(key) || "{}";
const c = { const c = {
@ -418,8 +418,8 @@ limitations under the License. -->
); );
} }
} else { } else {
if (d.layer === row.layer && [EntityType[0].value].includes(d.entity) && !row.topLevel && d.topLevel) { if (d.layer === row.layer && [EntityType[0].value].includes(d.entity) && !row.isDefault && d.isDefault) {
d.topLevel = false; d.isDefault = false;
const key = [d.layer, d.entity, d.name].join("_"); const key = [d.layer, d.entity, d.name].join("_");
const layout = sessionStorage.getItem(key) || "{}"; const layout = sessionStorage.getItem(key) || "{}";
const c = { const c = {