Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Sean King
admin-fe
Commits
a90cdd1c
Commit
a90cdd1c
authored
6 years ago
by
Maxim Filippov
Browse files
Options
Downloads
Patches
Plain Diff
Toggle user activation
parent
a9847bc5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/users.js
+8
-1
8 additions, 1 deletion
src/api/users.js
src/store/modules/users.js
+14
-2
14 additions, 2 deletions
src/store/modules/users.js
src/views/users/index.vue
+15
-7
15 additions, 7 deletions
src/views/users/index.vue
with
37 additions
and
10 deletions
src/api/users.js
+
8
−
1
View file @
a90cdd1c
...
...
@@ -7,4 +7,11 @@ export async function fetchUsers() {
})
}
export
default
{
fetchUsers
}
export
async
function
toggleUserActivation
(
nickname
)
{
return
await
request
({
url
:
`/api/pleroma/admin/users/
${
nickname
}
/toggle_activation`
,
method
:
'
patch
'
})
}
export
default
{
fetchUsers
,
toggleUserActivation
}
This diff is collapsed.
Click to expand it.
src/store/modules/users.js
+
14
−
2
View file @
a90cdd1c
import
{
fetchUsers
}
from
'
@/api/users
'
import
{
fetchUsers
,
toggleUserActivation
}
from
'
@/api/users
'
const
user
=
{
state
:
{
...
...
@@ -7,10 +7,17 @@ const user = {
},
mutations
:
{
SET_USERS
:
(
state
,
users
)
=>
{
state
.
fetchedUsers
=
users
state
.
fetchedUsers
=
users
.
sort
((
a
,
b
)
=>
a
.
id
.
localeCompare
(
b
.
id
))
},
SET_LOADING
:
(
state
,
status
)
=>
{
state
.
loading
=
status
},
SWAP_USER
:
(
state
,
user
)
=>
{
const
usersWithoutSwapped
=
state
.
fetchedUsers
.
filter
((
u
)
=>
{
return
u
.
id
!==
user
.
id
})
state
.
fetchedUsers
=
[...
usersWithoutSwapped
,
user
].
sort
((
a
,
b
)
=>
a
.
id
.
localeCompare
(
b
.
id
))
}
},
actions
:
{
...
...
@@ -19,6 +26,11 @@ const user = {
commit
(
'
SET_USERS
'
,
response
.
data
)
commit
(
'
SET_LOADING
'
,
false
)
},
async
ToggleUserActivation
({
commit
},
nickname
)
{
const
response
=
await
toggleUserActivation
(
nickname
)
commit
(
'
SWAP_USER
'
,
response
.
data
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/views/users/index.vue
+
15
−
7
View file @
a90cdd1c
...
...
@@ -10,14 +10,22 @@
label=
"ID"
width=
"100"
/>
<el-table-column
prop=
"
full
name"
prop=
"
nick
name"
label=
"Name"
/>
<el-table-column
label=
"Status"
>
<template
slot-scope=
"scope"
>
<el-tag
:type=
"scope.row.deactivated ? 'danger' : 'success'"
>
{{
scope
.
row
.
deactivated
?
'
deactivated
'
:
'
active
'
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
fixed=
"right"
label=
"
Opera
tions"
width=
"120
"
>
<template
>
<el-button
type=
"text"
size=
"small"
@
click=
"handle
Revoke"
>
Disable user
</el-button>
label=
"
Ac
tions"
>
<
template
slot-scope=
"scope
"
>
<el-button
v-if=
"scope.row.deactivated"
type=
"text"
size=
"small"
@
click=
"handleDeactivate(scope.row)"
>
Activate
</el-button
>
<el-button
v-else
type=
"text"
size=
"small"
@
click=
"handle
Deactivate(scope.row)"
>
Deactivate
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -40,8 +48,8 @@ export default {
this
.
$store
.
dispatch
(
'
FetchUsers
'
)
},
methods
:
{
handle
Revoke
(
)
{
handle
Deactivate
({
nickname
}
)
{
this
.
$store
.
dispatch
(
'
ToggleUserActivation
'
,
nickname
)
}
}
}
...
...
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