Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
jami-jams
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-jams
Commits
2bcc453c
Commit
2bcc453c
authored
4 years ago
by
Larbi Gharib
Browse files
Options
Downloads
Patches
Plain Diff
Fix revoke button
Change-Id: I9534062f7677eb22a70e7c10b0525246433f95af
parent
2e9ff45b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
jams-react-client/src/views/UserProfile/DisplayUserProfile.js
+28
-19
28 additions, 19 deletions
...-react-client/src/views/UserProfile/DisplayUserProfile.js
with
28 additions
and
19 deletions
jams-react-client/src/views/UserProfile/DisplayUserProfile.js
+
28
−
19
View file @
2bcc453c
...
...
@@ -148,7 +148,7 @@ export default function DisplayUserProfile(props) {
const
classes
=
useStyles
();
const
[
user
,
setUser
]
=
React
.
useState
([]);
const
[
userStatus
,
setUserStatus
]
=
React
.
useState
(
false
);
const
[
revoked
,
setRevoked
]
=
React
.
useState
(
false
);
const
[
open
,
setOpen
]
=
React
.
useState
(
false
);
const
[
revokedUser
,
setRevokedUser
]
=
React
.
useState
(
""
);
const
[
changePasswordOpen
,
setChangePasswordOpen
]
=
React
.
useState
(
false
);
...
...
@@ -165,7 +165,7 @@ export default function DisplayUserProfile(props) {
const
result
=
JSON
.
parse
(
response
.
data
.
replace
(
/
\s
+/g
,
"
"
).
trim
()
);
set
UserStatus
(
result
.
revoked
);
set
Revoked
(
result
.
revoked
);
})
.
catch
((
error
)
=>
{
console
.
log
(
error
);
...
...
@@ -176,7 +176,7 @@ export default function DisplayUserProfile(props) {
const
result
=
JSON
.
parse
(
response
.
data
.
replace
(
/
\s
+/g
,
"
"
).
trim
()
);
set
UserStatus
(
result
.
revoked
);
set
Revoked
(
result
.
revoked
);
})
.
catch
((
error
)
=>
{
console
.
log
(
error
);
...
...
@@ -200,7 +200,7 @@ export default function DisplayUserProfile(props) {
},
[]);
const
getUserStatus
=
()
=>
{
if
(
userStatus
===
false
)
{
if
(
revoked
===
false
)
{
return
(
<
Chip
style
=
{{
flex
:
1
}}
...
...
@@ -231,7 +231,7 @@ export default function DisplayUserProfile(props) {
configApiCall
(
api_path_delete_admin_user_revoke
,
"
DELETE
"
,
data
,
null
)
)
.
then
(()
=>
{
set
UserStatus
(
true
);
set
Revoked
(
true
);
})
.
catch
((
error
)
=>
{
console
.
log
(
...
...
@@ -305,11 +305,29 @@ export default function DisplayUserProfile(props) {
<
/CardAvatar
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
>
<
div
style
=
{{
display
:
"
flex
"
,
justifyContent
:
"
space-between
"
,
}}
>
<
div
>
<
h3
className
=
{
classes
.
cardTitle
}
>
{
user
.
username
?
user
.
username
:
"
no username
"
}
<
/h3
>
{
getUserStatus
()}
<
/div
>
<
div
>
{
auth
.
hasAdminScope
()
&&
revoked
===
false
&&
(
<
Button
color
=
"
info
"
onClick
=
{()
=>
handleClickOpen
(
user
.
username
)}
>
<
DeleteIcon
fontSize
=
"
small
"
/>
Revoke
user
<
/Button
>
)}
<
/div
>
<
/div
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
>
<
List
dense
=
{
false
}
>
...
...
@@ -444,15 +462,6 @@ export default function DisplayUserProfile(props) {
<
VpnKeyIcon
/>
Change
password
<
/Button
>
)}
{
auth
.
hasAdminScope
()
&&
(
userStatus
===
"
Active
"
||
userStatus
===
""
)
&&
(
<
Button
color
=
"
info
"
onClick
=
{()
=>
handleClickOpen
(
user
.
username
)}
>
<
DeleteIcon
fontSize
=
"
small
"
/>
Revoke
user
<
/Button
>
)}
<
/CardFooter
>
<
/Card
>
<
/Grid
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment