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, exact: true,
hasGroup: true, hasGroup: true,
}, },
redirect: "/infrastructure", redirect: "/linux",
component: Layout, component: Layout,
children: [ children: [
{ {
path: "/infrastructure", path: "/linux",
name: "Linux", name: "Linux",
meta: { meta: {
title: "linux", title: "linux",
}, },
component: () => import("@/views/Layer.vue"), 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", // path: "/infrastructure/vm",

View File

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

View File

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

View File

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