Browse Source

Adding Rights Management (#8368)

3.0.0/version-upgrade
labbomb 3 years ago committed by GitHub
parent
commit
cf5d253d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      dolphinscheduler-ui-next/src/layouts/content/index.tsx
  2. 21
      dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
  3. 14
      dolphinscheduler-ui-next/src/router/index.ts
  4. 6
      dolphinscheduler-ui-next/src/router/modules/data-quality.ts
  5. 3
      dolphinscheduler-ui-next/src/router/modules/datasource.ts
  6. 15
      dolphinscheduler-ui-next/src/router/modules/monitor.ts
  7. 36
      dolphinscheduler-ui-next/src/router/modules/projects.ts
  8. 33
      dolphinscheduler-ui-next/src/router/modules/resources.ts
  9. 24
      dolphinscheduler-ui-next/src/router/modules/security.ts
  10. 14
      dolphinscheduler-ui-next/src/router/routes.ts

18
dolphinscheduler-ui-next/src/layouts/content/index.tsx

@ -42,16 +42,8 @@ const Content = defineComponent({
} = useDataList()
const sideKeyRef = ref()
locale.value = localesStore.getLocales
onMounted(() => {
changeMenuOption(state)
changeHeaderMenuOptions(state)
getSideMenu(state)
changeUserDropdown(state)
})
watch(useI18n().locale, () => {
locale.value = localesStore.getLocales
changeMenuOption(state)
changeHeaderMenuOptions(state)
getSideMenu(state)
@ -71,12 +63,18 @@ const Content = defineComponent({
getSideMenu(state)
}
watch(useI18n().locale, () => {
changeMenuOption(state)
changeHeaderMenuOptions(state)
getSideMenu(state)
changeUserDropdown(state)
})
watch(
() => route.path,
() => {
if (route.path !== '/login') {
state.isShowSide = menuStore.getShowSideStatus
route.matched[1].path.includes(':projectCode')
if (route.matched[1].path === '/projects/:projectCode') {
changeMenuOption(state)
getSideMenu(state)

21
dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts

@ -48,10 +48,13 @@ import {
BarsOutlined
} from '@vicons/antd'
import { useMenuStore } from '@/store/menu/menu'
import { useUserStore } from '@/store/user/user'
import type { UserInfoRes } from '@/service/modules/users/types'
export function useDataList() {
const { t } = useI18n()
const menuStore = useMenuStore()
const userStore = useUserStore()
const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) })
@ -82,14 +85,12 @@ export function useDataList() {
{
label: t('menu.home'),
key: 'home',
icon: renderIcon(HomeOutlined),
isShowSide: false
icon: renderIcon(HomeOutlined)
},
{
label: t('menu.project'),
key: 'projects',
icon: renderIcon(ProfileOutlined),
isShowSide: false,
children: [
{
label: t('menu.project_overview'),
@ -136,7 +137,6 @@ export function useDataList() {
label: t('menu.resources'),
key: 'resource',
icon: renderIcon(FolderOutlined),
isShowSide: true,
children: [
{
label: t('menu.file_manage'),
@ -179,7 +179,6 @@ export function useDataList() {
label: t('menu.data_quality'),
key: 'data-quality',
icon: renderIcon(ContainerOutlined),
isShowSide: true,
children: [
{
label: t('menu.task_result'),
@ -197,14 +196,12 @@ export function useDataList() {
label: t('menu.datasource'),
key: 'datasource',
icon: renderIcon(DatabaseOutlined),
isShowSide: false,
children: []
},
{
label: t('menu.monitor'),
key: 'monitor',
icon: renderIcon(DesktopOutlined),
isShowSide: true,
children: [
{
label: t('menu.service_manage'),
@ -246,8 +243,8 @@ export function useDataList() {
label: t('menu.security'),
key: 'security',
icon: renderIcon(SafetyCertificateOutlined),
isShowSide: true,
children: [
children:
(userStore.getUserInfo as UserInfoRes).userType === 'ADMIN_USER' ? [
{
label: t('menu.tenant_manage'),
key: `/security/tenant-manage`,
@ -288,6 +285,12 @@ export function useDataList() {
key: `/security/token-manage`,
icon: renderIcon(SafetyOutlined)
}
] : [
{
label: t('menu.token_manage'),
key: `/security/token-manage`,
icon: renderIcon(SafetyOutlined)
}
]
}
]

14
dolphinscheduler-ui-next/src/router/index.ts

@ -24,6 +24,8 @@ import {
import routes from './routes'
import { useMenuStore } from '@/store/menu/menu'
import { useUserStore } from '@/store/user/user'
import type { UserInfoRes } from '@/service/modules/users/types'
// NProgress
import NProgress from 'nprogress'
@ -36,7 +38,8 @@ const router = createRouter({
interface metaData {
title?: string
showSide?: boolean
showSide?: boolean,
auth?: Array<string>
}
/**
@ -50,9 +53,16 @@ router.beforeEach(
) => {
NProgress.start()
const menuStore = useMenuStore()
const userStore = useUserStore()
const metaData: metaData = to.meta
menuStore.setShowSideStatus(metaData.showSide || false)
next()
if (metaData.auth?.includes('ADMIN_USER') && (userStore.getUserInfo as UserInfoRes).userType !== 'ADMIN_USER' && menuStore.getMenuKey === 'security') {
to.fullPath = '/security/token-manage'
next({name: 'token-manage'})
} else {
next()
}
NProgress.done()
}
)

6
dolphinscheduler-ui-next/src/router/modules/data-quality.ts

@ -35,7 +35,8 @@ export default {
component: components['data-quality-task-result'],
meta: {
title: '数据质量-task-result',
showSide: true
showSide: true,
auth: []
}
},
{
@ -44,7 +45,8 @@ export default {
component: components['data-quality-rule'],
meta: {
title: '数据质量-rule',
showSide: true
showSide: true,
auth: []
}
}
]

3
dolphinscheduler-ui-next/src/router/modules/datasource.ts

@ -34,7 +34,8 @@ export default {
component: components['datasource-list'],
meta: {
title: '数据源中心',
showSide: false
showSide: false,
auth: []
}
}
]

15
dolphinscheduler-ui-next/src/router/modules/monitor.ts

@ -35,7 +35,8 @@ export default {
component: components['monitor-servers-master'],
meta: {
title: '服务管理-Master',
showSide: true
showSide: true,
auth: []
}
},
{
@ -44,7 +45,8 @@ export default {
component: components['monitor-servers-worker'],
meta: {
title: '服务管理-Worker',
showSide: true
showSide: true,
auth: []
}
},
{
@ -53,7 +55,8 @@ export default {
component: components['monitor-servers-db'],
meta: {
title: '服务管理-DB',
showSide: true
showSide: true,
auth: []
}
},
{
@ -62,7 +65,8 @@ export default {
component: components['monitor-statistics-statistics'],
meta: {
title: '统计管理-Statistics',
showSide: true
showSide: true,
auth: []
}
},
{
@ -71,7 +75,8 @@ export default {
component: components['monitor-statistics-audit-log'],
meta: {
title: '审计日志-AuditLog',
showSide: true
showSide: true,
auth: []
}
}
]

36
dolphinscheduler-ui-next/src/router/modules/projects.ts

@ -26,8 +26,7 @@ export default {
path: '/projects',
name: 'projects',
meta: {
title: '项目管理',
showSide: false
title: '项目管理'
},
redirect: { name: 'projects-list' },
component: () => import('@/layouts/content'),
@ -38,7 +37,8 @@ export default {
component: components['projects-list'],
meta: {
title: '项目',
showSide: false
showSide: false,
auth: []
}
},
{
@ -47,7 +47,8 @@ export default {
component: components['projects-overview'],
meta: {
title: '项目概览',
showSide: true
showSide: true,
auth: []
}
},
{
@ -56,7 +57,8 @@ export default {
component: components['projects-workflow-relation'],
meta: {
title: '工作流关系',
showSide: true
showSide: true,
auth: []
}
},
{
@ -65,7 +67,8 @@ export default {
component: components['projects-workflow-definition'],
meta: {
title: '工作流定义',
showSide: true
showSide: true,
auth: []
}
},
{
@ -74,7 +77,8 @@ export default {
component: components['projects-workflow-definition-timing'],
meta: {
title: '定时管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -83,7 +87,8 @@ export default {
component: components['projects-workflow-definition-create'],
meta: {
title: '创建工作流定义',
showSide: true
showSide: true,
auth: []
}
},
{
@ -92,7 +97,8 @@ export default {
component: components['projects-workflow-definition-detail'],
meta: {
title: '工作流定义详情',
showSide: true
showSide: true,
auth: []
}
},
{
@ -101,7 +107,8 @@ export default {
component: components['projects-workflow-instance'],
meta: {
title: '工作流实例',
showSide: true
showSide: true,
auth: []
}
},
{
@ -110,7 +117,8 @@ export default {
component: components['projects-workflow-instance-detail'],
meta: {
title: '工作流实例详情',
showSide: true
showSide: true,
auth: []
}
},
{
@ -119,7 +127,8 @@ export default {
component: components['projects-task-definition'],
meta: {
title: '任务定义',
showSide: true
showSide: true,
auth: []
}
},
{
@ -128,7 +137,8 @@ export default {
component: components['projects-task-instance'],
meta: {
title: '任务实例',
showSide: true
showSide: true,
auth: []
}
}
]

33
dolphinscheduler-ui-next/src/router/modules/resources.ts

@ -35,7 +35,8 @@ export default {
component: components['resource-file'],
meta: {
title: '文件管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -44,7 +45,8 @@ export default {
component: components['resource-file-create'],
meta: {
title: '文件创建',
showSide: true
showSide: true,
auth: []
}
},
{
@ -53,7 +55,8 @@ export default {
component: components['resource-file-edit'],
meta: {
title: '文件编辑',
showSide: true
showSide: true,
auth: []
}
},
{
@ -62,7 +65,8 @@ export default {
component: components['resource-file'],
meta: {
title: '文件管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -71,7 +75,8 @@ export default {
component: components['resource-file-edit'],
meta: {
title: '文件详情',
showSide: true
showSide: true,
auth: []
}
},
{
@ -80,7 +85,8 @@ export default {
component: components['resource-file-create'],
meta: {
title: '文件创建',
showSide: true
showSide: true,
auth: []
}
},
{
@ -89,7 +95,8 @@ export default {
component: components['resource-udf-resource'],
meta: {
title: '资源管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -98,7 +105,8 @@ export default {
component: components['resource-udf-resource'],
meta: {
title: '资源管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -107,7 +115,8 @@ export default {
component: components['resource-udf-function'],
meta: {
title: '函数管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -116,7 +125,8 @@ export default {
component: components['resource-task-group-option'],
meta: {
title: '任务组配置',
showSide: true
showSide: true,
auth: []
}
},
{
@ -125,7 +135,8 @@ export default {
component: components['resource-task-group-queue'],
meta: {
title: '任务组队列',
showSide: true
showSide: true,
auth: []
}
}
]

24
dolphinscheduler-ui-next/src/router/modules/security.ts

@ -35,7 +35,8 @@ export default {
component: components['security-tenant-manage'],
meta: {
title: '租户管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
},
{
@ -44,7 +45,8 @@ export default {
component: components['security-user-manage'],
meta: {
title: '用户管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
},
{
@ -53,7 +55,8 @@ export default {
component: components['security-alarm-group-manage'],
meta: {
title: '告警组管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
},
{
@ -62,7 +65,8 @@ export default {
component: components['security-worker-group-manage'],
meta: {
title: 'Worker分组管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
},
{
@ -71,7 +75,8 @@ export default {
component: components['security-yarn-queue-manage'],
meta: {
title: 'Yarn队列管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
},
{
@ -80,7 +85,8 @@ export default {
component: components['security-environment-manage'],
meta: {
title: '环境管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
},
{
@ -89,7 +95,8 @@ export default {
component: components['security-token-manage'],
meta: {
title: '令牌管理管理',
showSide: true
showSide: true,
auth: []
}
},
{
@ -98,7 +105,8 @@ export default {
component: components['security-alarm-instance-manage'],
meta: {
title: '告警实例管理',
showSide: true
showSide: true,
auth: ['ADMIN_USER']
}
}
]

14
dolphinscheduler-ui-next/src/router/routes.ts

@ -44,7 +44,8 @@ const basePage: RouteRecordRaw[] = [
name: 'home',
component: components['home'],
meta: {
title: '首页'
title: '首页',
auth: []
}
},
{
@ -52,7 +53,8 @@ const basePage: RouteRecordRaw[] = [
name: 'password',
component: components['password'],
meta: {
title: '修改密码'
title: '修改密码',
auth: []
}
},
{
@ -60,7 +62,8 @@ const basePage: RouteRecordRaw[] = [
name: 'profile',
component: components['profile'],
meta: {
title: '用户信息'
title: '用户信息',
auth: []
}
}
]
@ -80,7 +83,10 @@ const loginPage: RouteRecordRaw[] = [
{
path: '/login',
name: 'login',
component: components['login']
component: components['login'],
meta: {
auth: []
}
}
]

Loading…
Cancel
Save