From 92f142d9e16463901a57b135c37fda84c049cf25 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 23 Mar 2022 12:48:30 +0800 Subject: [PATCH] add k8s --- src/router/infrastructure.ts | 13 ++++++++++--- src/views/Layer.vue | 4 ++++ src/views/dashboard/Edit.vue | 3 +++ src/views/dashboard/panel/Tool.vue | 10 +++++++--- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/router/infrastructure.ts b/src/router/infrastructure.ts index 2450e82a..8a2783c7 100644 --- a/src/router/infrastructure.ts +++ b/src/router/infrastructure.ts @@ -27,17 +27,24 @@ export const routesInfra: Array = [ 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", diff --git a/src/views/Layer.vue b/src/views/Layer.vue index 347f858c..2a4b7823 100644 --- a/src/views/Layer.vue +++ b/src/views/Layer.vue @@ -43,6 +43,7 @@ const routeNames = [ "Satellite", "Functions", "Browser", + "Kubernetes", ]; const layer = ref("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; diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index f884980e..595a089f 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -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}`; } diff --git a/src/views/dashboard/panel/Tool.vue b/src/views/dashboard/panel/Tool.vue index 82d38a8d..6faf62e0 100644 --- a/src/views/dashboard/panel/Tool.vue +++ b/src/views/dashboard/panel/Tool.vue @@ -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) ) {