refactor: change router components (#349)

This commit is contained in:
Fine0830 2023-11-28 13:08:19 +08:00 committed by GitHub
parent 20e3ef12fe
commit a1c7a00a83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 32 deletions

View File

@ -16,6 +16,7 @@
*/ */
import type { RouteRecordRaw } from "vue-router"; import type { RouteRecordRaw } from "vue-router";
import Layout from "@/layout/Index.vue"; import Layout from "@/layout/Index.vue";
import Alarm from "@/views/Alarm.vue";
export const routesAlarm: Array<RouteRecordRaw> = [ export const routesAlarm: Array<RouteRecordRaw> = [
{ {
@ -33,7 +34,7 @@ export const routesAlarm: Array<RouteRecordRaw> = [
{ {
path: "/alerting", path: "/alerting",
name: "Alarm", name: "Alarm",
component: () => import("@/views/Alarm.vue"), component: Alarm,
}, },
], ],
}, },

View File

@ -16,6 +16,10 @@
*/ */
import type { RouteRecordRaw } from "vue-router"; import type { RouteRecordRaw } from "vue-router";
import Layout from "@/layout/Index.vue"; import Layout from "@/layout/Index.vue";
import List from "@/views/dashboard/List.vue";
import New from "@/views/dashboard/New.vue";
import Edit from "@/views/dashboard/Edit.vue";
import Widget from "@/views/dashboard/Widget.vue";
export const routesDashboard: Array<RouteRecordRaw> = [ export const routesDashboard: Array<RouteRecordRaw> = [
{ {
@ -32,7 +36,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/list", path: "/dashboard/list",
component: () => import("@/views/dashboard/List.vue"), component: List,
name: "List", name: "List",
meta: { meta: {
i18nKey: "dashboardList", i18nKey: "dashboardList",
@ -42,7 +46,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
}, },
{ {
path: "/dashboard/new", path: "/dashboard/new",
component: () => import("@/views/dashboard/New.vue"), component: New,
name: "New", name: "New",
meta: { meta: {
i18nKey: "dashboardNew", i18nKey: "dashboardNew",
@ -54,26 +58,26 @@ export const routesDashboard: Array<RouteRecordRaw> = [
path: "", path: "",
redirect: "/dashboard/:layerId/:entity/:name", redirect: "/dashboard/:layerId/:entity/:name",
name: "Create", name: "Create",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
meta: { meta: {
notShow: true, notShow: true,
}, },
children: [ children: [
{ {
path: "/dashboard/:layerId/:entity/:name", path: "/dashboard/:layerId/:entity/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "CreateChild", name: "CreateChild",
}, },
{ {
path: "/dashboard/:layerId/:entity/:name/tab/:activeTabIndex", path: "/dashboard/:layerId/:entity/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "CreateActiveTabIndex", name: "CreateActiveTabIndex",
}, },
], ],
}, },
{ {
path: "", path: "",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "View", name: "View",
redirect: "/dashboard/:layerId/:entity/:serviceId/:name", redirect: "/dashboard/:layerId/:entity/:serviceId/:name",
meta: { meta: {
@ -82,12 +86,12 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:name", path: "/dashboard/:layerId/:entity/:serviceId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewChild", name: "ViewChild",
}, },
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:name/tab/:activeTabIndex", path: "/dashboard/:layerId/:entity/:serviceId/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewActiveTabIndex", name: "ViewActiveTabIndex",
}, },
], ],
@ -95,7 +99,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: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewServiceRelation", name: "ViewServiceRelation",
meta: { meta: {
notShow: true, notShow: true,
@ -103,12 +107,12 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name", path: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewServiceRelation", name: "ViewServiceRelation",
}, },
{ {
path: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name/tab/:activeTabIndex", path: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewServiceRelationActiveTabIndex", name: "ViewServiceRelationActiveTabIndex",
}, },
], ],
@ -116,7 +120,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
{ {
path: "", path: "",
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:name", redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewPod", name: "ViewPod",
meta: { meta: {
notShow: true, notShow: true,
@ -124,12 +128,12 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewPod", name: "ViewPod",
}, },
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name/tab/:activeTabIndex", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewPodActiveTabIndex", name: "ViewPodActiveTabIndex",
}, },
], ],
@ -137,7 +141,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: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewProcess", name: "ViewProcess",
meta: { meta: {
notShow: true, notShow: true,
@ -145,12 +149,12 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewProcess", name: "ViewProcess",
}, },
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name/tab/:activeTabIndex", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewProcessActiveTabIndex", name: "ViewProcessActiveTabIndex",
}, },
], ],
@ -158,7 +162,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: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "PodRelation", name: "PodRelation",
meta: { meta: {
notShow: true, notShow: true,
@ -166,12 +170,12 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewPodRelation", name: "ViewPodRelation",
}, },
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name/tab/:activeTabIndex", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewPodRelationActiveTabIndex", name: "ViewPodRelationActiveTabIndex",
}, },
], ],
@ -180,7 +184,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
path: "", path: "",
redirect: redirect:
"/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name", "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ProcessRelation", name: "ProcessRelation",
meta: { meta: {
notShow: true, notShow: true,
@ -188,17 +192,17 @@ export const routesDashboard: Array<RouteRecordRaw> = [
children: [ children: [
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewProcessRelation", name: "ViewProcessRelation",
}, },
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name/tab/:activeTabIndex", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name/tab/:activeTabIndex",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewProcessRelationActiveTabIndex", name: "ViewProcessRelationActiveTabIndex",
}, },
{ {
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name/duration/:duration", path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name/duration/:duration",
component: () => import("@/views/dashboard/Edit.vue"), component: Edit,
name: "ViewProcessRelationDuration", name: "ViewProcessRelationDuration",
}, },
], ],
@ -206,14 +210,14 @@ export const routesDashboard: Array<RouteRecordRaw> = [
{ {
path: "", path: "",
name: "Widget", name: "Widget",
component: () => import("@/views/dashboard/Widget.vue"), component: Widget,
meta: { meta: {
notShow: true, notShow: true,
}, },
children: [ children: [
{ {
path: "/page/:layer/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:config/:duration?", path: "/page/:layer/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:config/:duration?",
component: () => import("@/views/dashboard/Widget.vue"), component: Widget,
name: "ViewWidget", name: "ViewWidget",
}, },
], ],

View File

@ -17,6 +17,7 @@
import Layout from "@/layout/Index.vue"; import Layout from "@/layout/Index.vue";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import type { MenuOptions } from "@/types/app"; import type { MenuOptions } from "@/types/app";
import Layer from "@/views/Layer.vue";
function layerDashboards() { function layerDashboards() {
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
@ -47,13 +48,13 @@ function layerDashboards() {
descKey: child.descKey, descKey: child.descKey,
i18nKey: child.i18nKey, i18nKey: child.i18nKey,
}, },
component: () => import("@/views/Layer.vue"), component: Layer,
}; };
route.children.push(d); route.children.push(d);
const tab = { const tab = {
name: `${child.name}ActiveTabIndex`, name: `${child.name}ActiveTabIndex`,
path: `/${child.path}/tab/:activeTabIndex`, path: `/${child.path}/tab/:activeTabIndex`,
component: () => import("@/views/Layer.vue"), component: Layer,
meta: { meta: {
notShow: true, notShow: true,
layer: child.layer, layer: child.layer,
@ -74,7 +75,7 @@ function layerDashboards() {
descKey: item.descKey, descKey: item.descKey,
i18nKey: item.i18nKey, i18nKey: item.i18nKey,
}, },
component: () => import("@/views/Layer.vue"), component: Layer,
}, },
]; ];
} }

View File

@ -16,6 +16,7 @@
*/ */
import type { RouteRecordRaw } from "vue-router"; import type { RouteRecordRaw } from "vue-router";
import Layout from "@/layout/Index.vue"; import Layout from "@/layout/Index.vue";
import Marketplace from "@/views/Marketplace.vue";
export const routesMarketplace: Array<RouteRecordRaw> = [ export const routesMarketplace: Array<RouteRecordRaw> = [
{ {
@ -33,7 +34,7 @@ export const routesMarketplace: Array<RouteRecordRaw> = [
{ {
path: "/marketplace", path: "/marketplace",
name: "MenusManagement", name: "MenusManagement",
component: () => import("@/views/Marketplace.vue"), component: Marketplace,
}, },
], ],
}, },

View File

@ -16,6 +16,7 @@
*/ */
import type { RouteRecordRaw } from "vue-router"; import type { RouteRecordRaw } from "vue-router";
import Layout from "@/layout/Index.vue"; import Layout from "@/layout/Index.vue";
import Settings from "@/views/Settings.vue";
export const routesSettings: Array<RouteRecordRaw> = [ export const routesSettings: Array<RouteRecordRaw> = [
{ {
@ -33,7 +34,7 @@ export const routesSettings: Array<RouteRecordRaw> = [
{ {
path: "/settings", path: "/settings",
name: "Settings", name: "Settings",
component: () => import("@/views/Settings.vue"), component: Settings,
}, },
], ],
}, },