From 4c49a8b91fbeb26d6a18314b0d67905a9f296859 Mon Sep 17 00:00:00 2001
From: labbomb <739955946@qq.com>
Date: Wed, 22 Dec 2021 10:33:12 +0800
Subject: [PATCH] [Feature][UI Next]: Rearrange the routing and format the code
(#7533)
* fix: Rearrange the routing and format the code
* To fix the problem
To fix the problem
---
.../layouts/basic/components/header/index.tsx | 34 ++--
.../layouts/basic/components/logo/index.tsx | 20 +-
.../layouts/basic/components/sider/index.tsx | 30 ++-
.../src/layouts/basic/index.tsx | 158 +++++++--------
.../src/layouts/content/Content.tsx | 12 +-
dolphinscheduler-ui-next/src/router/index.ts | 24 +--
.../src/router/modules/datasource.ts | 41 ++++
.../src/router/modules/monitor.ts | 49 +++++
.../src/router/modules/projects.ts | 49 +++++
.../src/router/modules/resources.ts | 49 +++++
.../src/router/modules/security.ts | 49 +++++
dolphinscheduler-ui-next/src/router/routes.ts | 191 +++---------------
dolphinscheduler-ui-next/src/utils/index.ts | 2 +-
13 files changed, 404 insertions(+), 304 deletions(-)
create mode 100644 dolphinscheduler-ui-next/src/router/modules/datasource.ts
create mode 100644 dolphinscheduler-ui-next/src/router/modules/monitor.ts
create mode 100644 dolphinscheduler-ui-next/src/router/modules/projects.ts
create mode 100644 dolphinscheduler-ui-next/src/router/modules/resources.ts
create mode 100644 dolphinscheduler-ui-next/src/router/modules/security.ts
diff --git a/dolphinscheduler-ui-next/src/layouts/basic/components/header/index.tsx b/dolphinscheduler-ui-next/src/layouts/basic/components/header/index.tsx
index 5d076eb01f..2938ee1065 100644
--- a/dolphinscheduler-ui-next/src/layouts/basic/components/header/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/basic/components/header/index.tsx
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-import { defineComponent, ref } from "vue";
+import { defineComponent, ref } from 'vue'
-import styles from "./index.module.scss";
-import { NDropdown, NIcon, NLayoutHeader, NMenu } from "naive-ui";
-import { Logo } from "@/layouts/basic/components/logo";
-import { IosArrowDown } from "@vicons/ionicons4";
-import { UserAlt } from "@vicons/fa";
+import styles from './index.module.scss'
+import { NDropdown, NIcon, NLayoutHeader, NMenu } from 'naive-ui'
+import Logo from '@/layouts/basic/components/logo'
+import { IosArrowDown } from '@vicons/ionicons4'
+import { UserAlt } from '@vicons/fa'
const Header = defineComponent({
- name: "Header",
+ name: 'Header',
props: {
inverted: {
type: Boolean,
@@ -50,26 +50,26 @@ const Header = defineComponent({
},
},
setup(props, context) {
- const currentMenuRef = ref({});
+ const currentMenuRef = ref({})
const handleMenuClick = (key, data) => {
- currentMenuRef.value = data;
- context.emit("menuClick", data);
- };
+ currentMenuRef.value = data
+ context.emit('menuClick', data)
+ }
- return { handleMenuClick };
+ return { handleMenuClick }
},
render() {
return (
- );
+ )
},
-});
+})
-export { Header };
+export { Header }
diff --git a/dolphinscheduler-ui-next/src/layouts/basic/components/logo/index.tsx b/dolphinscheduler-ui-next/src/layouts/basic/components/logo/index.tsx
index bac1fae62e..459bf3cf86 100644
--- a/dolphinscheduler-ui-next/src/layouts/basic/components/logo/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/basic/components/logo/index.tsx
@@ -15,24 +15,20 @@
* limitations under the License.
*/
-import { defineComponent, ref } from "vue";
+import { defineComponent } from 'vue'
-import styles from "./index.module.scss";
+import styles from './index.module.scss'
const Logo = defineComponent({
- name: "Logo",
- setup() {
- const invertedRef = ref(true);
-
- return { invertedRef };
- },
+ name: 'Logo',
+ setup() {},
render() {
return (
-
+
- );
+ )
},
-});
+})
-export { Logo };
+export default Logo
diff --git a/dolphinscheduler-ui-next/src/layouts/basic/components/sider/index.tsx b/dolphinscheduler-ui-next/src/layouts/basic/components/sider/index.tsx
index 93dd0a6d0a..b2666ac417 100644
--- a/dolphinscheduler-ui-next/src/layouts/basic/components/sider/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/basic/components/sider/index.tsx
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-import { defineComponent, ref } from "vue";
-import { NLayoutSider, NMenu } from "naive-ui";
+import { defineComponent, ref } from 'vue'
+import { NLayoutSider, NMenu } from 'naive-ui'
const Sider = defineComponent({
- name: "Sider",
+ name: 'Sider',
props: {
visible: {
type: Boolean,
@@ -41,20 +41,21 @@ const Sider = defineComponent({
},
},
setup(props) {
- const currentMenuRef = ref({});
+ const currentMenuRef = ref({})
const handleMenuClick = (key, data) => {
- currentMenuRef.value = data;
- };
+ currentMenuRef.value = data
+ }
- return { handleMenuClick };
+ return { handleMenuClick }
},
render() {
- if (this.visible) {
- return (
+ return
+ this.visible ?
+ (
- );
- } else {
- return "";
- }
+ ) : ''
},
-});
+})
-export { Sider };
+export { Sider }
diff --git a/dolphinscheduler-ui-next/src/layouts/basic/index.tsx b/dolphinscheduler-ui-next/src/layouts/basic/index.tsx
index 444835dab7..09820e0b47 100644
--- a/dolphinscheduler-ui-next/src/layouts/basic/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/basic/index.tsx
@@ -15,186 +15,186 @@
* limitations under the License.
*/
-import { h, defineComponent, ref } from "vue";
-import styles from "./index.module.scss";
-import { useI18n } from "vue-i18n";
+import { h, defineComponent, ref } from 'vue'
+import styles from './index.module.scss'
+import { useI18n } from 'vue-i18n'
import {
PersonCircleOutline,
LogOutOutline,
FileTrayFullOutline,
Server,
SettingsOutline,
-} from "@vicons/ionicons5";
+} from '@vicons/ionicons5'
import {
HomeOutlined,
FolderOutlined,
SafetyCertificateOutlined,
UserOutlined,
-} from "@vicons/antd";
-import { Database, Notes, Users } from "@vicons/tabler";
-import { MonitorFilled, AcUnitOutlined } from "@vicons/material";
-import { Flow } from "@vicons/carbon";
-import { Header } from "./components/header";
-import { Sider } from "./components/sider";
-import { NLayout, NLayoutContent, NIcon } from "naive-ui";
+} from '@vicons/antd'
+import { Database, Notes, Users } from '@vicons/tabler'
+import { MonitorFilled, AcUnitOutlined } from '@vicons/material'
+import { Flow } from '@vicons/carbon'
+import { Header } from './components/header'
+import { Sider } from './components/sider'
+import { NLayout, NLayoutContent, NIcon } from 'naive-ui'
function renderIcon(icon) {
- return () => h(NIcon, null, { default: () => h(icon) });
+ return () => h(NIcon, null, { default: () => h(icon) })
}
const switchLanguageOptions = [
{
- label: "English",
- key: "en",
+ label: 'English',
+ key: 'en',
},
{
- label: "中文",
- key: "zh",
+ label: '中文',
+ key: 'zh',
},
-];
+]
const profileOptions = [
{
- label: "用户信息",
- key: "profile",
+ label: '用户信息',
+ key: 'profile',
icon: renderIcon(PersonCircleOutline),
},
{
- label: "退出登录",
- key: "logout",
+ label: '退出登录',
+ key: 'logout',
icon: renderIcon(LogOutOutline),
},
-];
+]
const menuOptions = [
{
- label: "首页",
- key: "home",
+ label: '首页',
+ key: 'home',
icon: renderIcon(HomeOutlined),
},
{
- label: "项目管理",
- key: "project",
+ label: '项目管理',
+ key: 'project',
icon: renderIcon(Notes),
children: [
{
- label: "项目",
- key: "projects-list",
+ label: '项目',
+ key: 'projects-list',
icon: renderIcon(Notes),
},
{
- label: "工作流监控",
- key: "projects-index",
+ label: '工作流监控',
+ key: 'projects-index',
icon: renderIcon(Flow),
},
],
},
{
- label: "资源中心",
- key: "resources",
+ label: '资源中心',
+ key: 'resources',
icon: renderIcon(FolderOutlined),
children: [
{
- label: "文件管理",
- key: "file",
+ label: '文件管理',
+ key: 'file',
icon: renderIcon(FileTrayFullOutline),
},
{
- label: "创建资源",
- key: "resource-file-create",
+ label: '创建资源',
+ key: 'resource-file-create',
icon: renderIcon(AcUnitOutlined),
},
],
},
{
- label: "数据源中心",
- key: "datasource",
+ label: '数据源中心',
+ key: 'datasource',
icon: renderIcon(Database),
children: [
{
- label: "数据源中心",
- key: "datasource-list",
+ label: '数据源中心',
+ key: 'datasource-list',
icon: renderIcon(Database),
},
],
},
{
- label: "监控中心",
- key: "monitor",
+ label: '监控中心',
+ key: 'monitor',
icon: renderIcon(MonitorFilled),
children: [
{
- key: "servers-master",
- title: "服务管理-Master",
+ key: 'servers-master',
+ title: '服务管理-Master',
icon: renderIcon(Server),
},
{
- key: "servers-worker",
- title: "服务管理-Worker",
+ key: 'servers-worker',
+ title: '服务管理-Worker',
icon: renderIcon(SettingsOutline),
},
],
},
{
- label: "安全中心",
- key: "security",
+ label: '安全中心',
+ key: 'security',
icon: renderIcon(SafetyCertificateOutlined),
children: [
{
- key: "tenement-manage",
- label: "租户管理",
+ key: 'tenement-manage',
+ label: '租户管理',
icon: renderIcon(UserOutlined),
},
{
- key: "users-manage",
- label: "用户管理",
+ key: 'users-manage',
+ label: '用户管理',
icon: renderIcon(Users),
},
],
},
-];
+]
const basic = defineComponent({
- name: "basic",
+ name: 'basic',
setup() {
- const invertedRef = ref(true);
- const hasSiderRef = ref(false);
- const defaultMenuKeyRef = ref("home");
- const currentMenuRef = ref({});
- const topMenuOptionsRef = ref([]);
- const sideMenuOptionsRef = ref([]);
+ const invertedRef = ref(true)
+ const hasSiderRef = ref(false)
+ const defaultMenuKeyRef = ref('home')
+ const currentMenuRef = ref({})
+ const topMenuOptionsRef = ref([])
+ const sideMenuOptionsRef = ref([])
const handleTopMenuClick = (data) => {
- currentMenuRef.value = data;
- generateMenus();
- };
+ currentMenuRef.value = data
+ generateMenus()
+ }
const handleSideMenuClick = (key, data) => {
- console.log(data);
- };
+ console.log(data)
+ }
const generateMenus = () => {
- topMenuOptionsRef.value = [];
- sideMenuOptionsRef.value = [];
- hasSiderRef.value = false;
+ topMenuOptionsRef.value = []
+ sideMenuOptionsRef.value = []
+ hasSiderRef.value = false
menuOptions.forEach((option) => {
topMenuOptionsRef.value.push({
label: option.label,
key: option.key,
icon: option.icon,
- });
+ })
if (
currentMenuRef.value.key === option.key ||
defaultMenuKeyRef.value === option.key
) {
- if (option.hasOwnProperty("children") && option.children) {
- sideMenuOptionsRef.value = option.children;
- hasSiderRef.value = true;
+ if (option.hasOwnProperty('children') && option.children) {
+ sideMenuOptionsRef.value = option.children
+ hasSiderRef.value = true
}
}
- });
- };
- generateMenus();
+ })
+ }
+ generateMenus()
return {
topMenuOptionsRef,
sideMenuOptionsRef,
@@ -203,7 +203,7 @@ const basic = defineComponent({
defaultMenuKeyRef,
handleTopMenuClick,
handleSideMenuClick,
- };
+ }
},
render() {
return (
@@ -227,8 +227,8 @@ const basic = defineComponent({
- );
+ )
},
-});
+})
-export default basic;
+export default basic
diff --git a/dolphinscheduler-ui-next/src/layouts/content/Content.tsx b/dolphinscheduler-ui-next/src/layouts/content/Content.tsx
index b1daebc9f4..8211f18719 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/Content.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/Content.tsx
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-import { defineComponent } from "vue";
-import { NLayout, NLayoutContent } from "naive-ui";
+import { defineComponent } from 'vue'
+import { NLayout, NLayoutContent } from 'naive-ui'
const Content = defineComponent({
- name: "Content",
+ name: 'Content',
render() {
return (
@@ -27,8 +27,8 @@ const Content = defineComponent({
- );
+ )
},
-});
+})
-export default Content;
+export default Content
diff --git a/dolphinscheduler-ui-next/src/router/index.ts b/dolphinscheduler-ui-next/src/router/index.ts
index 7aa6948ac2..ed70ba8957 100644
--- a/dolphinscheduler-ui-next/src/router/index.ts
+++ b/dolphinscheduler-ui-next/src/router/index.ts
@@ -20,17 +20,17 @@ import {
createWebHistory,
NavigationGuardNext,
RouteLocationNormalized,
-} from "vue-router";
-import routes from "./routes";
+} from 'vue-router'
+import routes from './routes'
// NProgress
-import NProgress from "nprogress";
-import "nprogress/nprogress.css";
+import NProgress from 'nprogress'
+import 'nprogress/nprogress.css'
const router = createRouter({
history: createWebHistory(),
routes,
-});
+})
/**
* Routing to intercept
@@ -41,14 +41,14 @@ router.beforeEach(
from: RouteLocationNormalized,
next: NavigationGuardNext
) => {
- NProgress.start();
- next();
- NProgress.done();
+ NProgress.start()
+ next()
+ NProgress.done()
}
-);
+)
router.afterEach(() => {
- NProgress.done();
-});
+ NProgress.done()
+})
-export default router;
+export default router
diff --git a/dolphinscheduler-ui-next/src/router/modules/datasource.ts b/dolphinscheduler-ui-next/src/router/modules/datasource.ts
new file mode 100644
index 0000000000..df73f76ec1
--- /dev/null
+++ b/dolphinscheduler-ui-next/src/router/modules/datasource.ts
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Component } from 'vue'
+import utils from '@/utils'
+
+// All TSX files under the views folder automatically generate mapping relationship
+const modules = import.meta.glob('/src/views/**/**.tsx')
+const components: { [key: string]: Component } = utils.mapping(modules)
+
+export default {
+ path: '/datasource',
+ name: 'datasource',
+ redirect: { name: 'datasource-list' },
+ meta: { title: '数据源中心' },
+ component: () => import('@/layouts/basic'),
+ children: [
+ {
+ path: '/datasource/list',
+ name: 'datasource-list',
+ component: components['home'],
+ meta: {
+ title: '数据源中心'
+ }
+ }
+ ]
+}
diff --git a/dolphinscheduler-ui-next/src/router/modules/monitor.ts b/dolphinscheduler-ui-next/src/router/modules/monitor.ts
new file mode 100644
index 0000000000..43d4dbd858
--- /dev/null
+++ b/dolphinscheduler-ui-next/src/router/modules/monitor.ts
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Component } from 'vue'
+import utils from '@/utils'
+
+// All TSX files under the views folder automatically generate mapping relationship
+const modules = import.meta.glob('/src/views/**/**.tsx')
+const components: { [key: string]: Component } = utils.mapping(modules)
+
+export default {
+ path: '/monitor',
+ name: 'monitor',
+ meta: { title: 'monitor' },
+ redirect: { name: 'servers-master' },
+ component: () => import('@/layouts/basic'),
+ children: [
+ {
+ path: '/monitor/servers/master',
+ name: 'servers-master',
+ component: components['home'],
+ meta: {
+ title: '服务管理-Master',
+ },
+ },
+ {
+ path: '/monitor/servers/worker',
+ name: 'servers-worker',
+ component: components['home'],
+ meta: {
+ title: '服务管理-Worker'
+ }
+ }
+ ]
+}
diff --git a/dolphinscheduler-ui-next/src/router/modules/projects.ts b/dolphinscheduler-ui-next/src/router/modules/projects.ts
new file mode 100644
index 0000000000..b5d3f7c9fc
--- /dev/null
+++ b/dolphinscheduler-ui-next/src/router/modules/projects.ts
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Component } from 'vue'
+import utils from '@/utils'
+
+// All TSX files under the views folder automatically generate mapping relationship
+const modules = import.meta.glob('/src/views/**/**.tsx')
+const components: { [key: string]: Component } = utils.mapping(modules)
+
+export default {
+ path: '/projects',
+ name: 'projects',
+ redirect: { name: 'projects-list' },
+ meta: { title: '项目管理' },
+ component: () => import('@/layouts/basic'),
+ children: [
+ {
+ path: '/projects/list',
+ name: 'projects-list',
+ component: components['home'],
+ meta: {
+ title: '项目',
+ },
+ },
+ {
+ path: '/projects/:projectCode/index',
+ name: 'projects-index',
+ component: components['home'],
+ meta: {
+ title: '工作流监控'
+ }
+ }
+ ]
+}
diff --git a/dolphinscheduler-ui-next/src/router/modules/resources.ts b/dolphinscheduler-ui-next/src/router/modules/resources.ts
new file mode 100644
index 0000000000..dbd27e5a70
--- /dev/null
+++ b/dolphinscheduler-ui-next/src/router/modules/resources.ts
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Component } from 'vue'
+import utils from '@/utils'
+
+// All TSX files under the views folder automatically generate mapping relationship
+const modules = import.meta.glob('/src/views/**/**.tsx')
+const components: { [key: string]: Component } = utils.mapping(modules)
+
+export default {
+ path: '/resource',
+ name: 'resource',
+ redirect: { name: 'file' },
+ meta: { title: '资源中心' },
+ component: () => import('@/layouts/basic'),
+ children: [
+ {
+ path: '/resource/file',
+ name: 'file',
+ component: components['home'],
+ meta: {
+ title: '文件管理',
+ },
+ },
+ {
+ path: '/resource/file/create',
+ name: 'resource-file-create',
+ component: components['home'],
+ meta: {
+ title: '创建资源'
+ }
+ }
+ ]
+}
diff --git a/dolphinscheduler-ui-next/src/router/modules/security.ts b/dolphinscheduler-ui-next/src/router/modules/security.ts
new file mode 100644
index 0000000000..dfacd25816
--- /dev/null
+++ b/dolphinscheduler-ui-next/src/router/modules/security.ts
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Component } from 'vue'
+import utils from '@/utils'
+
+// All TSX files under the views folder automatically generate mapping relationship
+const modules = import.meta.glob('/src/views/**/**.tsx')
+const components: { [key: string]: Component } = utils.mapping(modules)
+
+export default {
+ path: '/security',
+ name: 'security',
+ meta: { title: '安全中心' },
+ redirect: { name: 'tenement-manage' },
+ component: () => import('@/layouts/basic'),
+ children: [
+ {
+ path: '/security/tenant',
+ name: 'tenement-manage',
+ component: components['home'],
+ meta: {
+ title: '租户管理',
+ },
+ },
+ {
+ path: '/security/users',
+ name: 'users-manage',
+ component: components['home'],
+ meta: {
+ title: '用户管理'
+ }
+ }
+ ]
+}
diff --git a/dolphinscheduler-ui-next/src/router/routes.ts b/dolphinscheduler-ui-next/src/router/routes.ts
index a92bb4d2d6..0e6a343229 100644
--- a/dolphinscheduler-ui-next/src/router/routes.ts
+++ b/dolphinscheduler-ui-next/src/router/routes.ts
@@ -15,189 +15,58 @@
* limitations under the License.
*/
-import type { RouteRecordRaw } from "vue-router";
-import type { Component } from "vue";
-import utils from "@/utils";
-import { useI18n } from "vue-i18n";
+import type { RouteRecordRaw } from 'vue-router'
+import type { Component } from 'vue'
+import utils from '@/utils'
+import projectsPage from './modules/projects'
+import resourcesPage from './modules/resources'
+import datasourcePage from './modules/datasource'
+import monitorPage from './modules/monitor'
+import securityPage from './modules/security'
// All TSX files under the views folder automatically generate mapping relationship
-const modules = import.meta.glob("/src/views/**/**.tsx");
-const components: { [key: string]: Component } = utils.mapping(modules);
+const modules = import.meta.glob('/src/views/**/**.tsx')
+const components: { [key: string]: Component } = utils.mapping(modules)
/**
* Basic page
*/
const basePage: RouteRecordRaw[] = [
{
- path: "/",
- redirect: { name: "home" },
- meta: { title: "首页" },
- component: () => import("@/layouts/basic"),
+ path: '/',
+ redirect: { name: 'home' },
+ meta: { title: '首页' },
+ component: () => import('@/layouts/basic'),
children: [
{
- path: "/home",
- name: "home",
- component: components["home"],
+ path: '/home',
+ name: 'home',
+ component: components['home'],
meta: {
- title: "首页",
+ title: '首页',
},
},
],
},
-];
-
-const projectsPage = [
- {
- path: "/projects",
- name: "projects",
- redirect: { name: "projects-list" },
- meta: { title: "项目管理" },
- component: () => import("@/layouts/basic"),
- children: [
- {
- path: "/projects/list",
- name: "projects-list",
- component: components["home"],
- meta: {
- title: "项目",
- },
- },
- {
- path: "/projects/:projectCode/index",
- name: "projects-index",
- component: components["home"],
- meta: {
- title: "工作流监控",
- },
- },
- ],
- },
-];
-
-const resourcesPage = [
- {
- path: "/resource",
- name: "resource",
- redirect: { name: "file" },
- meta: { title: "资源中心" },
- component: () => import("@/layouts/basic"),
- children: [
- {
- path: "/resource/file",
- name: "file",
- component: components["home"],
- meta: {
- title: "文件管理",
- },
- },
- {
- path: "/resource/file/create",
- name: "resource-file-create",
- component: components["home"],
- meta: {
- title: "创建资源",
- },
- },
- ],
- },
-];
-
-const datasourcePage = [
- {
- path: "/datasource",
- name: "datasource",
- redirect: { name: "datasource-list" },
- meta: { title: "数据源中心" },
- component: () => import("@/layouts/basic"),
- children: [
- {
- path: "/datasource/list",
- name: "datasource-list",
- component: components["home"],
- meta: {
- title: "数据源中心",
- },
- },
- ],
- },
-];
-
-const monitorPage = [
- {
- path: "/monitor",
- name: "monitor",
- meta: { title: "monitor" },
- redirect: { name: "servers-master" },
- component: () => import("@/layouts/basic"),
- children: [
- {
- path: "/monitor/servers/master",
- name: "servers-master",
- component: components["home"],
- meta: {
- title: "服务管理-Master",
- },
- },
- {
- path: "/monitor/servers/worker",
- name: "servers-worker",
- component: components["home"],
- meta: {
- title: "服务管理-Worker",
- },
- },
- ],
- },
-];
-
-const securityPage: RouteRecordRaw[] = [
- {
- path: "/security",
- name: "security",
- meta: { title: "安全中心" },
- redirect: { name: "tenement-manage" },
- component: () => import("@/layouts/basicLayout"),
- children: [
- {
- path: "/security/tenant",
- name: "tenement-manage",
- component: components["home"],
- meta: {
- title: "租户管理",
- },
- },
- {
- path: "/security/users",
- name: "users-manage",
- component: components["home"],
- meta: {
- title: "用户管理",
- },
- },
- ],
- },
-];
+ projectsPage,
+ resourcesPage,
+ datasourcePage,
+ monitorPage,
+ securityPage,
+]
/**
* Login page
*/
const loginPage: RouteRecordRaw[] = [
{
- path: "/login",
- name: "login",
- component: components["login"],
+ path: '/login',
+ name: 'login',
+ component: components['login'],
},
-];
+]
-const routes: RouteRecordRaw[] = [
- ...basePage,
- ...loginPage,
- ...projectsPage,
- ...resourcesPage,
- ...datasourcePage,
- ...monitorPage,
- ...securityPage,
-];
+const routes: RouteRecordRaw[] = [...basePage, ...loginPage]
// 重新组织后导出
-export default routes;
+export default routes
diff --git a/dolphinscheduler-ui-next/src/utils/index.ts b/dolphinscheduler-ui-next/src/utils/index.ts
index 5d3b52e091..29211b9c3b 100644
--- a/dolphinscheduler-ui-next/src/utils/index.ts
+++ b/dolphinscheduler-ui-next/src/utils/index.ts
@@ -18,7 +18,7 @@
import mapping from './mapping'
const utils = {
- mapping
+ mapping,
}
export default utils