fix name in routes (#446)

This commit is contained in:
Fine0830 2025-02-13 18:06:56 +08:00 committed by GitHub
parent 9318d32b0b
commit 2246a9a045
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 12 deletions

View File

@ -50,7 +50,7 @@ limitations under the License. -->
</el-menu-item> </el-menu-item>
</el-menu-item-group> </el-menu-item-group>
</el-sub-menu> </el-sub-menu>
<el-menu-item :index="String(menu.name)" @click="changePage(menu)" v-else> <el-menu-item :index="String(menu.name)" v-else>
<el-icon class="menu-icons" :style="{ marginRight: '12px' }" @mouseover="setCollapse"> <el-icon class="menu-icons" :style="{ marginRight: '12px' }" @mouseover="setCollapse">
<router-link class="items menu-title" :to="menu.children[0].path"> <router-link class="items menu-title" :to="menu.children[0].path">
<Icon size="lg" :iconName="menu.meta.icon" /> <Icon size="lg" :iconName="menu.meta.icon" />
@ -83,7 +83,6 @@ limitations under the License. -->
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const router = useRouter(); const router = useRouter();
const name = ref<string>(String(router.currentRoute.value.name)); const name = ref<string>(String(router.currentRoute.value.name));
const theme = ["VirtualMachine", "Kubernetes"].includes(name.value || "") ? ref("light") : ref("black");
const routes = ref<RouteRecordRaw[] | any>( const routes = ref<RouteRecordRaw[] | any>(
(router.options.routes || []).filter((d: any) => d.meta && d.meta.activate), (router.options.routes || []).filter((d: any) => d.meta && d.meta.activate),
); );
@ -100,9 +99,7 @@ limitations under the License. -->
if (route.name === "ViewWidget") { if (route.name === "ViewWidget") {
showMenu.value = false; showMenu.value = false;
} }
const changePage = (menu: RouteRecordRaw) => {
theme.value = ["VirtualMachine", "Kubernetes"].includes(String(menu.name)) ? "light" : "black";
};
const filterMenus = (menus: Recordable[]) => { const filterMenus = (menus: Recordable[]) => {
return menus.filter((d) => d.meta && !d.meta.notShow && d.meta.activate); return menus.filter((d) => d.meta && !d.meta.notShow && d.meta.activate);
}; };

View File

@ -33,7 +33,7 @@ export const routesAlarm: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/alerting", path: "/alerting",
name: "Alarm", name: "ViewAlarm",
component: Alarm, component: Alarm,
}, },
], ],

View File

@ -100,7 +100,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
path: "", path: "",
redirect: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name", redirect: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name",
component: Edit, component: Edit,
name: "ViewServiceRelation", name: "ServiceRelations",
meta: { meta: {
notShow: true, notShow: true,
}, },
@ -121,7 +121,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
path: "", path: "",
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:name", redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:name",
component: Edit, component: Edit,
name: "ViewPod", name: "Pods",
meta: { meta: {
notShow: true, notShow: true,
}, },
@ -142,7 +142,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
path: "", path: "",
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name", redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name",
component: Edit, component: Edit,
name: "ViewProcess", name: "Processes",
meta: { meta: {
notShow: true, notShow: true,
}, },
@ -163,7 +163,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
path: "", path: "",
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name", redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name",
component: Edit, component: Edit,
name: "PodRelation", name: "PodRelations",
meta: { meta: {
notShow: true, notShow: true,
}, },
@ -185,7 +185,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
redirect: redirect:
"/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name", "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name",
component: Edit, component: Edit,
name: "ProcessRelation", name: "ProcessRelations",
meta: { meta: {
notShow: true, notShow: true,
}, },

View File

@ -33,7 +33,7 @@ export const routesSettings: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/settings", path: "/settings",
name: "Settings", name: "ViewSettings",
component: Settings, component: Settings,
}, },
], ],