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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Pleroma
admin-fe
Commits
7e3f385b
Commit
7e3f385b
authored
6 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Update state structure and ToggleUsersFilter action
parent
093fd94b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!11
Add ability to read reports
,
!10
Add more users filters
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/store/modules/users.js
+20
-8
20 additions, 8 deletions
src/store/modules/users.js
with
20 additions
and
8 deletions
src/store/modules/users.js
+
20
−
8
View file @
7e3f385b
...
...
@@ -7,7 +7,12 @@ const users = {
searchQuery
:
''
,
totalUsersCount
:
0
,
currentPage
:
1
,
showLocalUsersOnly
:
false
filters
:
{
showLocalUsersOnly
:
false
,
showExternalUsersOnly
:
false
,
showActiveUsersOnly
:
false
,
showDeactivatedUsersOnly
:
false
}
},
mutations
:
{
SET_USERS
:
(
state
,
users
)
=>
{
...
...
@@ -37,13 +42,13 @@ const users = {
SET_SEARCH_QUERY
:
(
state
,
query
)
=>
{
state
.
searchQuery
=
query
},
SET_
LOCAL_
USERS_FILTER
:
(
state
,
value
)
=>
{
state
.
showLocalUsersOnly
=
value
SET_USERS_FILTER
:
(
state
,
filters
)
=>
{
state
.
filters
=
filters
}
},
actions
:
{
async
FetchUsers
({
commit
,
state
,
getters
},
{
page
})
{
const
response
=
await
fetchUsers
(
state
.
showLocalUsersOnly
,
getters
.
authHost
,
getters
.
token
,
page
)
const
response
=
await
fetchUsers
(
state
.
filters
.
showLocalUsersOnly
,
getters
.
authHost
,
getters
.
token
,
page
)
commit
(
'
SET_LOADING
'
,
true
)
...
...
@@ -62,14 +67,21 @@ const users = {
commit
(
'
SET_LOADING
'
,
true
)
commit
(
'
SET_SEARCH_QUERY
'
,
query
)
const
response
=
await
searchUsers
(
query
,
state
.
showLocalUsersOnly
,
getters
.
authHost
,
getters
.
token
,
page
)
const
response
=
await
searchUsers
(
query
,
state
.
filters
.
showLocalUsersOnly
,
getters
.
authHost
,
getters
.
token
,
page
)
loadUsers
(
commit
,
page
,
response
.
data
)
}
},
async
ToggleLocalUsersFilter
({
commit
,
dispatch
,
state
},
value
)
{
commit
(
'
SET_LOCAL_USERS_FILTER
'
,
value
)
dispatch
(
'
SearchUsers
'
,
{
query
:
state
.
searchQuery
,
page
:
1
})
async
ToggleUsersFilter
({
commit
,
dispatch
,
state
},
filters
)
{
const
newFilters
=
Object
.
keys
(
state
.
filters
).
reduce
((
acc
,
filter
)
=>
{
if
(
filters
.
includes
(
filter
))
{
return
{
...
acc
,
[
filter
]:
true
}
}
else
{
return
{
...
acc
,
[
filter
]:
false
}
}
},
{})
commit
(
'
SET_USERS_FILTER
'
,
newFilters
)
// dispatch('SearchUsers', { query: state.searchQuery, page: 1 })
},
async
ToggleRight
({
commit
,
getters
},
{
user
,
right
})
{
user
.
roles
[
right
]
...
...
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