Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
les
gancio
Commits
05d0032d
Verified
Commit
05d0032d
authored
May 19, 2021
by
les
Browse files
improve user admin management
parent
d0c24ccb
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/admin/Users.vue
View file @
05d0032d
...
...
@@ -33,6 +33,9 @@
:items='users'
:hide-default-footer='users.length<5'
:search='search')
template(v-slot:item.is_active='{item}')
v-icon(v-if='item.is_active' color='success') mdi-check
v-icon(v-else color='warning') mdi-close
template(v-slot:item.actions='{item}')
v-btn(text small @click='toggle(item)'
:color='item.is_active?"warning":"success"')
{{
item
.
is_active
?
$t
(
'
common.disable
'
):
$t
(
'
common.enable
'
)
}}
...
...
@@ -62,6 +65,7 @@ export default {
search
:
''
,
headers
:
[
{
value
:
'
email
'
,
text
:
'
Email
'
},
{
value
:
'
description
'
,
text
:
'
Description
'
},
{
value
:
'
is_active
'
,
text
:
'
Active
'
},
{
value
:
'
actions
'
,
text
:
'
Actions
'
,
align
:
'
right
'
}
]
...
...
@@ -70,13 +74,17 @@ export default {
computed
:
mapState
([
'
settings
'
]),
methods
:
{
async
deleteUser
(
user
)
{
const
ret
=
await
this
.
$root
.
$confirm
(
'
admin.delete_user_confirm
'
)
const
ret
=
await
this
.
$root
.
$confirm
(
'
admin.delete_user_confirm
'
,
{
user
:
user
.
email
}
)
if
(
!
ret
)
{
return
}
await
this
.
$axios
.
delete
(
`/user/
${
user
.
id
}
`
)
this
.
$root
.
$message
(
'
admin.user_remove_ok
'
)
this
.
users_
=
this
.
users_
.
filter
(
u
=>
u
.
id
!==
user
.
id
)
},
toggle
(
user
)
{
async
toggle
(
user
)
{
if
(
user
.
is_active
)
{
const
ret
=
await
this
.
$root
.
$confirm
(
'
admin.disable_user_confirm
'
,
{
user
:
user
.
email
})
if
(
!
ret
)
{
return
}
}
user
.
is_active
=
!
user
.
is_active
this
.
$axios
.
$put
(
'
/user
'
,
user
)
},
...
...
Write
Preview
Supports
Markdown
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