Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
2ae3943f
Unverified
Commit
2ae3943f
authored
Jan 22, 2024
by
yqwoe
Committed by
GitHub
Jan 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Fix some front-end issues (#3038)
parent
d3877d95
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
9 deletions
+86
-9
routes.ts
dinky-web/config/routes.ts
+7
-1
app.tsx
dinky-web/src/app.tsx
+4
-1
index.tsx
...src/pages/AuthCenter/Role/components/AssignMenu/index.tsx
+34
-6
index.tsx
.../pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
+1
-1
index.tsx
dinky-web/src/pages/Other/Redirect/index.tsx
+40
-0
No files found.
dinky-web/config/routes.ts
View file @
2ae3943f
...
@@ -42,7 +42,13 @@ export default [
...
@@ -42,7 +42,13 @@ export default [
},
},
{
{
path
:
'/'
,
path
:
'/'
,
redirect
:
'/datastudio'
redirect
:
'/redirect'
,
},
{
path
:
'/redirect'
,
component
:
'./Other/Redirect'
,
layout
:
false
,
hideInMenu
:
true
,
},
},
// {
// {
// path: '/home',
// path: '/home',
...
...
dinky-web/src/app.tsx
View file @
2ae3943f
...
@@ -37,6 +37,7 @@ import { FullScreenProvider } from './hooks/useEditor';
...
@@ -37,6 +37,7 @@ import { FullScreenProvider } from './hooks/useEditor';
import
{
errorConfig
}
from
'./requestErrorConfig'
;
import
{
errorConfig
}
from
'./requestErrorConfig'
;
import
{
getDataByParamsReturnResult
}
from
'./services/BusinessCrud'
;
import
{
getDataByParamsReturnResult
}
from
'./services/BusinessCrud'
;
import
{
API
}
from
'./services/data'
;
import
{
API
}
from
'./services/data'
;
import
Redirect
from
'./pages/Other/Redirect'
;
// const isDev = process.env.NODE_ENV === "development";
// const isDev = process.env.NODE_ENV === "development";
const
loginPath
=
API_CONSTANTS
.
LOGIN_PATH
;
const
loginPath
=
API_CONSTANTS
.
LOGIN_PATH
;
...
@@ -208,7 +209,7 @@ export const dva = {
...
@@ -208,7 +209,7 @@ export const dva = {
* 动态修改默认跳转路由
* 动态修改默认跳转路由
*/
*/
const
patch
=
(
oldRoutes
:
any
,
routes
:
SysMenu
[])
=>
{
const
patch
=
(
oldRoutes
:
any
,
routes
:
SysMenu
[])
=>
{
oldRoutes
[
1
].
routes
=
oldRoutes
[
1
]
.
routes
.
map
(
oldRoutes
[
1
].
routes
=
oldRoutes
[
1
]
?.
routes
?
.
map
(
(
route
:
{
routes
:
{
path
:
any
;
element
:
JSX
.
Element
}[];
path
:
string
})
=>
{
(
route
:
{
routes
:
{
path
:
any
;
element
:
JSX
.
Element
}[];
path
:
string
})
=>
{
if
(
route
.
routes
?.
length
)
{
if
(
route
.
routes
?.
length
)
{
const
redirect
=
routes
?.
filter
((
r
)
=>
r
.
path
.
startsWith
(
route
.
path
));
const
redirect
=
routes
?.
filter
((
r
)
=>
r
.
path
.
startsWith
(
route
.
path
));
...
@@ -230,7 +231,9 @@ const patch = (oldRoutes: any, routes: SysMenu[]) => {
...
@@ -230,7 +231,9 @@ const patch = (oldRoutes: any, routes: SysMenu[]) => {
*/
*/
export
function
patchClientRoutes
({
routes
}:
{
routes
:
SysMenu
[]
})
{
export
function
patchClientRoutes
({
routes
}:
{
routes
:
SysMenu
[]
})
{
// 根据 extraRoutes 对 routes 做一些修改
// 根据 extraRoutes 对 routes 做一些修改
if
(
extraRoutes
.
length
){
patch
(
routes
,
extraRoutes
);
patch
(
routes
,
extraRoutes
);
}
}
}
/***
/***
...
...
dinky-web/src/pages/AuthCenter/Role/components/AssignMenu/index.tsx
View file @
2ae3943f
...
@@ -116,6 +116,35 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -116,6 +116,35 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
setRoleAssignMenu
((
prevState
)
=>
({
...
prevState
,
selectValue
:
selectKeys
}));
setRoleAssignMenu
((
prevState
)
=>
({
...
prevState
,
selectValue
:
selectKeys
}));
};
};
const
treeData
=
buildMenuTree
(
sortTreeData
(
roleAssignMenu
.
menuTreeData
.
menus
),
roleAssignMenu
.
searchValue
);
const
treeToArray
=
(
list
,
newArr
=
[])
=>
{
list
.
forEach
((
item
)
=>
{
const
{
children
}
=
item
;
if
(
children
)
{
if
(
children
.
length
)
{
newArr
.
push
(
item
);
return
treeToArray
(
children
,
newArr
);
}
}
newArr
.
push
(
item
);
});
return
newArr
;
};
const
filterHalfKeys
:
any
=
useCallback
(
(
keys
)
=>
{
const
treeArray
=
treeToArray
(
treeData
);
return
keys
.
filter
((
key
)
=>
treeArray
.
some
((
tree
)
=>
tree
.
value
==
key
&&
!
tree
.
isLeaf
)
);
},
[
treeData
]
);
return
(
return
(
<
Drawer
<
Drawer
title=
{
l
(
'role.assignMenu'
,
''
,
{
roleName
:
values
.
roleName
})
}
title=
{
l
(
'role.assignMenu'
,
''
,
{
roleName
:
values
.
roleName
})
}
...
@@ -137,16 +166,15 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -137,16 +166,15 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
<
Spin
spinning=
{
roleAssignMenu
.
loading
}
>
<
Spin
spinning=
{
roleAssignMenu
.
loading
}
>
<
DirectoryTree
<
DirectoryTree
selectable
selectable
defaultCheckedKeys=
{
[...
roleAssignMenu
.
menuTreeData
.
selectedMenuIds
]
}
defaultCheckedKeys=
{
filterHalfKeys
(
roleAssignMenu
.
menuTreeData
.
selectedMenuIds
)
}
checkable
checkable
defaultExpandAll
defaultExpandAll
onCheck=
{
(
keys
)
=>
onCheck
(
keys
)
}
onCheck=
{
(
keys
,
e
)
=>
{
onCheck
(
keys
?.
concat
(
e
.
halfCheckedKeys
));
}
}
multiple=
{
true
}
multiple=
{
true
}
className=
{
'treeList'
}
className=
{
'treeList'
}
treeData=
{
buildMenuTree
(
treeData=
{
treeData
}
sortTreeData
(
roleAssignMenu
.
menuTreeData
.
menus
),
roleAssignMenu
.
searchValue
)
}
/>
/>
</
Spin
>
</
Spin
>
</>
</>
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
View file @
2ae3943f
...
@@ -159,7 +159,7 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
...
@@ -159,7 +159,7 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
selectedKeys=
{
selectKey
}
selectedKeys=
{
selectKey
}
onExpand=
{
onExpand
}
onExpand=
{
onExpand
}
treeData=
{
data
}
treeData=
{
data
}
autoExpandParent=
{
autoExpandParent
}
//
autoExpandParent=
{
autoExpandParent
}
/>
/>
)
:
(
)
:
(
<
Empty
<
Empty
...
...
dinky-web/src/pages/Other/Redirect/index.tsx
0 → 100644
View file @
2ae3943f
/*
*
* 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
{
SysMenu
}
from
'@/types/AuthCenter/data'
;
import
{
Navigate
,
useModel
}
from
'umi'
;
const
Redirect
=
()
=>
{
const
{
initialState
,
_
}
=
useModel
(
'@@initialState'
);
console
.
log
(
initialState
);
const
filterMenus
=
(
menus
:
SysMenu
[])
=>
{
return
menus
?.
filter
((
menu
)
=>
menu
.
type
!==
'F'
);
};
let
extraRoutes
=
filterMenus
(
initialState
?.
currentUser
?.
menuList
);
if
(
initialState
?.
currentUser
?.
user
?.
superAdminFlag
)
{
return
<
Navigate
to=
'/datastudio'
/>;
}
return
<
Navigate
to=
{
extraRoutes
[
0
]?.
path
}
/>;
};
export
default
Redirect
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment