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

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

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

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

@ -24,6 +24,8 @@ import {
import routes from './routes' import routes from './routes'
import { useMenuStore } from '@/store/menu/menu' import { useMenuStore } from '@/store/menu/menu'
import { useUserStore } from '@/store/user/user'
import type { UserInfoRes } from '@/service/modules/users/types'
// NProgress // NProgress
import NProgress from 'nprogress' import NProgress from 'nprogress'
@ -36,7 +38,8 @@ const router = createRouter({
interface metaData { interface metaData {
title?: string title?: string
showSide?: boolean showSide?: boolean,
auth?: Array<string>
} }
/** /**
@ -50,9 +53,16 @@ router.beforeEach(
) => { ) => {
NProgress.start() NProgress.start()
const menuStore = useMenuStore() const menuStore = useMenuStore()
const userStore = useUserStore()
const metaData: metaData = to.meta const metaData: metaData = to.meta
menuStore.setShowSideStatus(metaData.showSide || false) menuStore.setShowSideStatus(metaData.showSide || false)
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() next()
}
NProgress.done() NProgress.done()
} }
) )

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

@ -35,7 +35,8 @@ export default {
component: components['data-quality-task-result'], component: components['data-quality-task-result'],
meta: { meta: {
title: '数据质量-task-result', title: '数据质量-task-result',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -44,7 +45,8 @@ export default {
component: components['data-quality-rule'], component: components['data-quality-rule'],
meta: { meta: {
title: '数据质量-rule', 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'], component: components['datasource-list'],
meta: { meta: {
title: '数据源中心', 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'], component: components['monitor-servers-master'],
meta: { meta: {
title: '服务管理-Master', title: '服务管理-Master',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -44,7 +45,8 @@ export default {
component: components['monitor-servers-worker'], component: components['monitor-servers-worker'],
meta: { meta: {
title: '服务管理-Worker', title: '服务管理-Worker',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -53,7 +55,8 @@ export default {
component: components['monitor-servers-db'], component: components['monitor-servers-db'],
meta: { meta: {
title: '服务管理-DB', title: '服务管理-DB',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -62,7 +65,8 @@ export default {
component: components['monitor-statistics-statistics'], component: components['monitor-statistics-statistics'],
meta: { meta: {
title: '统计管理-Statistics', title: '统计管理-Statistics',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -71,7 +75,8 @@ export default {
component: components['monitor-statistics-audit-log'], component: components['monitor-statistics-audit-log'],
meta: { meta: {
title: '审计日志-AuditLog', title: '审计日志-AuditLog',
showSide: true showSide: true,
auth: []
} }
} }
] ]

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

@ -26,8 +26,7 @@ export default {
path: '/projects', path: '/projects',
name: 'projects', name: 'projects',
meta: { meta: {
title: '项目管理', title: '项目管理'
showSide: false
}, },
redirect: { name: 'projects-list' }, redirect: { name: 'projects-list' },
component: () => import('@/layouts/content'), component: () => import('@/layouts/content'),
@ -38,7 +37,8 @@ export default {
component: components['projects-list'], component: components['projects-list'],
meta: { meta: {
title: '项目', title: '项目',
showSide: false showSide: false,
auth: []
} }
}, },
{ {
@ -47,7 +47,8 @@ export default {
component: components['projects-overview'], component: components['projects-overview'],
meta: { meta: {
title: '项目概览', title: '项目概览',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -56,7 +57,8 @@ export default {
component: components['projects-workflow-relation'], component: components['projects-workflow-relation'],
meta: { meta: {
title: '工作流关系', title: '工作流关系',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -65,7 +67,8 @@ export default {
component: components['projects-workflow-definition'], component: components['projects-workflow-definition'],
meta: { meta: {
title: '工作流定义', title: '工作流定义',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -74,7 +77,8 @@ export default {
component: components['projects-workflow-definition-timing'], component: components['projects-workflow-definition-timing'],
meta: { meta: {
title: '定时管理', title: '定时管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -83,7 +87,8 @@ export default {
component: components['projects-workflow-definition-create'], component: components['projects-workflow-definition-create'],
meta: { meta: {
title: '创建工作流定义', title: '创建工作流定义',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -92,7 +97,8 @@ export default {
component: components['projects-workflow-definition-detail'], component: components['projects-workflow-definition-detail'],
meta: { meta: {
title: '工作流定义详情', title: '工作流定义详情',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -101,7 +107,8 @@ export default {
component: components['projects-workflow-instance'], component: components['projects-workflow-instance'],
meta: { meta: {
title: '工作流实例', title: '工作流实例',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -110,7 +117,8 @@ export default {
component: components['projects-workflow-instance-detail'], component: components['projects-workflow-instance-detail'],
meta: { meta: {
title: '工作流实例详情', title: '工作流实例详情',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -119,7 +127,8 @@ export default {
component: components['projects-task-definition'], component: components['projects-task-definition'],
meta: { meta: {
title: '任务定义', title: '任务定义',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -128,7 +137,8 @@ export default {
component: components['projects-task-instance'], component: components['projects-task-instance'],
meta: { meta: {
title: '任务实例', 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'], component: components['resource-file'],
meta: { meta: {
title: '文件管理', title: '文件管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -44,7 +45,8 @@ export default {
component: components['resource-file-create'], component: components['resource-file-create'],
meta: { meta: {
title: '文件创建', title: '文件创建',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -53,7 +55,8 @@ export default {
component: components['resource-file-edit'], component: components['resource-file-edit'],
meta: { meta: {
title: '文件编辑', title: '文件编辑',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -62,7 +65,8 @@ export default {
component: components['resource-file'], component: components['resource-file'],
meta: { meta: {
title: '文件管理', title: '文件管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -71,7 +75,8 @@ export default {
component: components['resource-file-edit'], component: components['resource-file-edit'],
meta: { meta: {
title: '文件详情', title: '文件详情',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -80,7 +85,8 @@ export default {
component: components['resource-file-create'], component: components['resource-file-create'],
meta: { meta: {
title: '文件创建', title: '文件创建',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -89,7 +95,8 @@ export default {
component: components['resource-udf-resource'], component: components['resource-udf-resource'],
meta: { meta: {
title: '资源管理', title: '资源管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -98,7 +105,8 @@ export default {
component: components['resource-udf-resource'], component: components['resource-udf-resource'],
meta: { meta: {
title: '资源管理', title: '资源管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -107,7 +115,8 @@ export default {
component: components['resource-udf-function'], component: components['resource-udf-function'],
meta: { meta: {
title: '函数管理', title: '函数管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -116,7 +125,8 @@ export default {
component: components['resource-task-group-option'], component: components['resource-task-group-option'],
meta: { meta: {
title: '任务组配置', title: '任务组配置',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -125,7 +135,8 @@ export default {
component: components['resource-task-group-queue'], component: components['resource-task-group-queue'],
meta: { meta: {
title: '任务组队列', 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'], component: components['security-tenant-manage'],
meta: { meta: {
title: '租户管理', title: '租户管理',
showSide: true showSide: true,
auth: ['ADMIN_USER']
} }
}, },
{ {
@ -44,7 +45,8 @@ export default {
component: components['security-user-manage'], component: components['security-user-manage'],
meta: { meta: {
title: '用户管理', title: '用户管理',
showSide: true showSide: true,
auth: ['ADMIN_USER']
} }
}, },
{ {
@ -53,7 +55,8 @@ export default {
component: components['security-alarm-group-manage'], component: components['security-alarm-group-manage'],
meta: { meta: {
title: '告警组管理', title: '告警组管理',
showSide: true showSide: true,
auth: ['ADMIN_USER']
} }
}, },
{ {
@ -62,7 +65,8 @@ export default {
component: components['security-worker-group-manage'], component: components['security-worker-group-manage'],
meta: { meta: {
title: 'Worker分组管理', title: 'Worker分组管理',
showSide: true showSide: true,
auth: ['ADMIN_USER']
} }
}, },
{ {
@ -71,7 +75,8 @@ export default {
component: components['security-yarn-queue-manage'], component: components['security-yarn-queue-manage'],
meta: { meta: {
title: 'Yarn队列管理', title: 'Yarn队列管理',
showSide: true showSide: true,
auth: ['ADMIN_USER']
} }
}, },
{ {
@ -80,7 +85,8 @@ export default {
component: components['security-environment-manage'], component: components['security-environment-manage'],
meta: { meta: {
title: '环境管理', title: '环境管理',
showSide: true showSide: true,
auth: ['ADMIN_USER']
} }
}, },
{ {
@ -89,7 +95,8 @@ export default {
component: components['security-token-manage'], component: components['security-token-manage'],
meta: { meta: {
title: '令牌管理管理', title: '令牌管理管理',
showSide: true showSide: true,
auth: []
} }
}, },
{ {
@ -98,7 +105,8 @@ export default {
component: components['security-alarm-instance-manage'], component: components['security-alarm-instance-manage'],
meta: { meta: {
title: '告警实例管理', 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', name: 'home',
component: components['home'], component: components['home'],
meta: { meta: {
title: '首页' title: '首页',
auth: []
} }
}, },
{ {
@ -52,7 +53,8 @@ const basePage: RouteRecordRaw[] = [
name: 'password', name: 'password',
component: components['password'], component: components['password'],
meta: { meta: {
title: '修改密码' title: '修改密码',
auth: []
} }
}, },
{ {
@ -60,7 +62,8 @@ const basePage: RouteRecordRaw[] = [
name: 'profile', name: 'profile',
component: components['profile'], component: components['profile'],
meta: { meta: {
title: '用户信息' title: '用户信息',
auth: []
} }
} }
] ]
@ -80,7 +83,10 @@ const loginPage: RouteRecordRaw[] = [
{ {
path: '/login', path: '/login',
name: 'login', name: 'login',
component: components['login'] component: components['login'],
meta: {
auth: []
}
} }
] ]

Loading…
Cancel
Save