mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-20 14:37:34 +00:00
update root entity
This commit is contained in:
parent
c64ded8078
commit
1f014f330b
@ -24,3 +24,18 @@ export const Languages = [
|
|||||||
{ label: "English", value: "en" },
|
{ label: "English", value: "en" },
|
||||||
{ label: "Chinese", value: "zh" },
|
{ label: "Chinese", value: "zh" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const RoutesMap: { [key: string]: string } = {
|
||||||
|
GeneralServices: "GENERAL",
|
||||||
|
Database: "VIRTUAL_DATABASE",
|
||||||
|
MeshServices: "MESH",
|
||||||
|
ControlPanel: "MESH_CP",
|
||||||
|
DataPanel: "MESH_DP",
|
||||||
|
Linux: "OS_LINUX",
|
||||||
|
SkyWalkingServer: "SO11Y_OAP",
|
||||||
|
Satellite: "SO11Y_SATELLITE",
|
||||||
|
Functions: "FAAS",
|
||||||
|
Browser: "BROWSER",
|
||||||
|
KubernetesCluster: "K8S",
|
||||||
|
KubernetesService: "K8S_SERVICE",
|
||||||
|
};
|
||||||
|
@ -27,47 +27,34 @@ import { useDashboardStore } from "@/store/modules/dashboard";
|
|||||||
import Dashboard from "./dashboard/Edit.vue";
|
import Dashboard from "./dashboard/Edit.vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
import { RoutesMap } from "@/constants/data";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const appStore = useAppStoreWithOut();
|
const appStore = useAppStoreWithOut();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const routesMap: { [key: string]: string } = {
|
|
||||||
GeneralServices: "GENERAL",
|
|
||||||
Database: "VIRTUAL_DATABASE",
|
|
||||||
MeshServices: "MESH",
|
|
||||||
ControlPanel: "MESH_CP",
|
|
||||||
DataPanel: "MESH_DP",
|
|
||||||
Linux: "OS_LINUX",
|
|
||||||
SkyWalkingServer: "SO11Y_OAP",
|
|
||||||
Satellite: "SO11Y_SATELLITE",
|
|
||||||
Functions: "FAAS",
|
|
||||||
Browser: "BROWSER",
|
|
||||||
KubernetesCluster: "K8S",
|
|
||||||
KubernetesService: "K8S_SERVICE",
|
|
||||||
};
|
|
||||||
const layer = ref<string>("GENERAL");
|
const layer = ref<string>("GENERAL");
|
||||||
|
|
||||||
getDashboard();
|
getDashboard();
|
||||||
|
|
||||||
async function getDashboard() {
|
async function getDashboard() {
|
||||||
layer.value = routesMap[String(route.name)];
|
layer.value = RoutesMap[String(route.name)];
|
||||||
dashboardStore.setLayer(layer.value);
|
dashboardStore.setLayer(layer.value);
|
||||||
dashboardStore.setEntity(EntityType[1].value);
|
|
||||||
dashboardStore.setMode(false);
|
dashboardStore.setMode(false);
|
||||||
await dashboardStore.setDashboards();
|
await dashboardStore.setDashboards();
|
||||||
const index = dashboardStore.dashboards.findIndex(
|
const item = dashboardStore.dashboards.find(
|
||||||
(d: { name: string; isRoot: boolean; layer: string; entity: string }) =>
|
(d: { name: string; isRoot: boolean; layer: string; entity: string }) =>
|
||||||
d.layer === dashboardStore.layerId &&
|
d.layer === dashboardStore.layerId &&
|
||||||
d.entity === EntityType[1].value &&
|
[EntityType[0].value, EntityType[1].value].includes(d.entity) &&
|
||||||
d.isRoot
|
d.isRoot
|
||||||
);
|
);
|
||||||
if (index < 0) {
|
if (!item) {
|
||||||
appStore.setPageTitle(dashboardStore.layer);
|
appStore.setPageTitle(dashboardStore.layer);
|
||||||
dashboardStore.setCurrentDashboard(null);
|
dashboardStore.setCurrentDashboard(null);
|
||||||
|
dashboardStore.setEntity(EntityType[1].value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item = dashboardStore.dashboards[index];
|
dashboardStore.setEntity(item.entity);
|
||||||
dashboardStore.setCurrentDashboard(item);
|
dashboardStore.setCurrentDashboard(item);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -86,7 +86,11 @@ limitations under the License. -->
|
|||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
title="Are you sure to set this?"
|
title="Are you sure to set this?"
|
||||||
@confirm="setRoot(scope.row)"
|
@confirm="setRoot(scope.row)"
|
||||||
v-if="scope.row.entity === EntityType[1].value"
|
v-if="
|
||||||
|
[EntityType[0].value, EntityType[1].value].includes(
|
||||||
|
scope.row.entity
|
||||||
|
)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button size="small" style="width: 120px" type="danger">
|
<el-button size="small" style="width: 120px" type="danger">
|
||||||
@ -269,7 +273,7 @@ async function setRoot(row: DashboardItem) {
|
|||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
d.layer === row.layer &&
|
d.layer === row.layer &&
|
||||||
d.entity === row.entity &&
|
[EntityType[0].value, EntityType[1].value].includes(d.entity) &&
|
||||||
row.isRoot === false &&
|
row.isRoot === false &&
|
||||||
d.isRoot === true
|
d.isRoot === true
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user