This commit is contained in:
Qiuxia Fan 2022-03-23 12:48:30 +08:00
parent abcd41e5d1
commit 92f142d9e1
4 changed files with 24 additions and 6 deletions

View File

@ -27,17 +27,24 @@ export const routesInfra: Array<RouteRecordRaw> = [
exact: true,
hasGroup: true,
},
redirect: "/infrastructure",
redirect: "/linux",
component: Layout,
children: [
{
path: "/infrastructure",
path: "/linux",
name: "Linux",
meta: {
title: "linux",
},
component: () => import("@/views/Layer.vue"),
// component: () => import("@/views/infrastructure/Infrastructure.vue"),
},
{
path: "/kubernetes",
name: "Kubernetes",
meta: {
title: "kubernetes",
},
component: () => import("@/views/Layer.vue"),
},
// {
// path: "/infrastructure/vm",

View File

@ -43,6 +43,7 @@ const routeNames = [
"Satellite",
"Functions",
"Browser",
"Kubernetes",
];
const layer = ref<string>("GENERAL");
@ -101,6 +102,9 @@ function setLayer(n: string) {
case routeNames[9]:
layer.value = "BROWSER";
break;
case routeNames[10]:
layer.value = "K8S";
break;
default:
layer.value = "GENERAL";
break;

View File

@ -55,6 +55,9 @@ async function setTemplate() {
await dashboardStore.setDashboards();
if (!p.entity) {
if (!dashboardStore.currentDashboard) {
return;
}
const { layer, entity, name } = dashboardStore.currentDashboard;
layoutKey.value = `${layer}_${entity}_${name}`;
}

View File

@ -119,7 +119,6 @@ import { ElMessage } from "element-plus";
import { Option } from "@/types/app";
import { useI18n } from "vue-i18n";
import { useThrottleFn } from "@vueuse/core";
import getDashboard from "@/hooks/useDashboardsSession";
const { t } = useI18n();
const dashboardStore = useDashboardStore();
@ -274,15 +273,20 @@ async function getServices() {
selectorStore.setCurrentDestService(
selectorStore.services.length ? selectorStore.services[1] : null
);
if (!selectorStore.currentService) {
return;
}
states.currentService = selectorStore.currentService.value;
states.currentDestService =
selectorStore.currentDestService && selectorStore.currentDestService.value;
const e = dashboardStore.entity.split("Relation")[0];
if (
[EntityType[2].value, EntityType[3].value].includes(dashboardStore.entity)
) {
fetchPods(e, selectorStore.currentService.id, true);
}
if (!selectorStore.currentDestService) {
return;
}
states.currentDestService = selectorStore.currentDestService.value;
if (
[EntityType[5].value, EntityType[6].value].includes(dashboardStore.entity)
) {