Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
521d1ab0
Commit
521d1ab0
authored
Dec 12, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据sysadmin显示更多
parent
3e33d278
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
5 deletions
+45
-5
App.js
src/App.js
+16
-2
user.js
src/model/user.js
+4
-0
user.js
src/service/user.js
+5
-0
index.js
src/util/index.js
+14
-0
AssetDirectory.jsx
src/view/Manage/AssetManage/Component/AssetDirectory.jsx
+6
-3
No files found.
src/App.js
View file @
521d1ab0
...
...
@@ -8,6 +8,7 @@ import { $hostParams, ContextPath } from './util';
import
loadable
from
"./util/loadable"
;
import
{
AssetMountReference
}
from
'./util/constant'
;
import
{
dispatch
}
from
'./model'
;
export
const
AppContext
=
React
.
createContext
();
...
...
@@ -36,13 +37,16 @@ export class App extends React.Component {
super
();
this
.
state
=
{
hostParams
:
null
hostParams
:
null
,
dataRoles
:
[]
};
}
componentDidMount
()
{
this
.
setState
({
hostParams
:
this
.
props
?.
data
});
this
.
getDataRoles
();
this
.
$$hostParams
=
$hostParams
.
subscribe
({
next
:
(
v
)
=>
{
if
(
v
)
{
...
...
@@ -57,9 +61,18 @@ export class App extends React.Component {
this
.
$$hostParams
?.
unsubscribe
();
}
getDataRoles
=
()
=>
{
dispatch
({
type
:
'user.getDataRoles'
,
callback
:
data
=>
{
this
.
setState
({
dataRoles
:
data
||
[]
})
}
})
}
render
()
{
const
{
setGlobalState
,
onGlobalStateChange
}
=
this
.
props
;
const
{
hostParams
}
=
this
.
state
;
const
{
hostParams
,
dataRoles
}
=
this
.
state
;
let
message
=
''
,
id
=
''
,
terms
=
[];
if
(
hostParams
)
{
...
...
@@ -158,6 +171,7 @@ export class App extends React.Component {
<
AppContext
.
Provider
value
=
{{
env
:
hostParams
?.
env
,
user
:
hostParams
?.
user
,
dataRoles
:
dataRoles
,
setGlobalState
,
onGlobalStateChange
}}
>
...
...
src/model/user.js
View file @
521d1ab0
...
...
@@ -15,3 +15,6 @@ export function* signout() {
export
function
*
getDomains
()
{
return
yield
call
(
service
.
getDomains
);
}
export
function
*
getDataRoles
()
{
return
yield
call
(
service
.
getDataRoles
);
}
\ No newline at end of file
src/service/user.js
View file @
521d1ab0
...
...
@@ -21,4 +21,8 @@ export function queryUserSystem(payload) {
export
function
getDomains
()
{
return
GetJSON
(
"/authservice/domains"
);
}
export
function
getDataRoles
()
{
return
GetJSON
(
"/authservice/dataRoles"
);
}
\ No newline at end of file
src/util/index.js
View file @
521d1ab0
...
...
@@ -398,3 +398,16 @@ export function getDataModelerRole(user) {
return
DataModelerRoleAdmin
;
}
export
function
isSystemAdmin
(
dataRoles
)
{
let
flag
=
false
;
if
(
dataRoles
?.
length
>
0
)
{
dataRoles
?.
forEach
(
item
=>
{
if
(
item
.
name
===
'sysadmin'
)
{
flag
=
true
;
}
})
}
return
flag
;
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetDirectory.jsx
View file @
521d1ab0
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useContext
}
from
'react'
;
import
{
Spin
,
Tooltip
,
Typography
,
Dropdown
,
Menu
}
from
'antd'
;
import
LocalStorage
from
'local-storage'
;
...
...
@@ -7,10 +7,11 @@ import { AssetBrowseReference, AssetManageReference, ResourceBrowseReference } f
import
ImportElement
from
'./ImportElement'
;
import
AttributeRelationModal
from
"./AttributeRelationModal"
;
import
FilterElementModal
from
'./FilterElementModal'
;
import
{
showNotifaction
}
from
'../../../../util'
;
import
{
showNotifaction
,
isSystemAdmin
}
from
'../../../../util'
;
import
{
MoreSvg
}
from
'./AssetSvg'
;
import
Separate
from
'./Separate'
;
import
record
from
'../Assets/record.png'
;
import
{
AppContext
}
from
'../../../../App'
;
import
'./AssetDirectory.less'
;
...
...
@@ -25,6 +26,8 @@ const AssetDirectory = (props) => {
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
const
[
resourceState
,
setResourceState
]
=
useState
(
null
);
const
app
=
useContext
(
AppContext
);
useEffect
(()
=>
{
const
storageChange
=
(
e
)
=>
{
...
...
@@ -264,7 +267,7 @@ const AssetDirectory = (props) => {
</
div
>
{
(
reference
===
AssetManageReference
)
&&
<
Dropdown
overlay=
{
elementManageMenu
}
placement=
"bottomCenter"
>
(
reference
===
AssetManageReference
)
&&
isSystemAdmin
(
app
?.
dataRoles
)
&&
<
Dropdown
overlay=
{
elementManageMenu
}
placement=
"bottomCenter"
>
<
div
className=
'flex more-container'
style=
{
{
...
...
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