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
7652bfcd
Commit
7652bfcd
authored
6 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Implemented local users filtration in fetch and search requests
parent
de13254f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/users.js
+4
-11
4 additions, 11 deletions
src/api/users.js
src/store/modules/users.js
+7
-13
7 additions, 13 deletions
src/store/modules/users.js
with
11 additions
and
24 deletions
src/api/users.js
+
4
−
11
View file @
7652bfcd
import
request
from
'
@/utils/request
'
export
async
function
fetchUsers
(
page
=
1
)
{
export
async
function
fetchUsers
(
page
=
1
,
showLocalUsers
)
{
return
await
request
({
url
:
`/api/pleroma/admin/users?page=
${
page
}
`
,
url
:
`/api/pleroma/admin/users?page=
${
page
}
&local_only=
${
showLocalUsers
}
`
,
method
:
'
get
'
})
}
...
...
@@ -14,16 +14,9 @@ export async function toggleUserActivation(nickname) {
})
}
export
async
function
searchUsers
(
query
,
page
=
1
)
{
export
async
function
searchUsers
(
query
,
page
=
1
,
showLocalUsers
)
{
return
await
request
({
url
:
`/api/pleroma/admin/users?query=
${
query
}
&page=
${
page
}
`
,
method
:
'
get
'
})
}
export
async
function
fetchLocalUsers
(
page
=
1
)
{
return
await
request
({
url
:
`/api/pleroma/admin/users?page=
${
page
}
&local_only=true`
,
url
:
`/api/pleroma/admin/users?query=
${
query
}
&page=
${
page
}
&local_only=
${
showLocalUsers
}
`
,
method
:
'
get
'
})
}
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/users.js
+
7
−
13
View file @
7652bfcd
import
{
fetchUsers
,
toggleUserActivation
,
searchUsers
,
fetchLocalUsers
}
from
'
@/api/users
'
import
{
fetchUsers
,
toggleUserActivation
,
searchUsers
}
from
'
@/api/users
'
const
user
=
{
state
:
{
...
...
@@ -42,8 +42,8 @@ const user = {
}
},
actions
:
{
async
FetchUsers
({
commit
},
{
page
})
{
const
response
=
await
fetchUsers
(
page
)
async
FetchUsers
({
commit
,
state
},
{
page
})
{
const
response
=
await
fetchUsers
(
page
,
state
.
showLocalUsers
)
commit
(
'
SET_LOADING
'
,
true
)
...
...
@@ -54,7 +54,7 @@ const user = {
commit
(
'
SWAP_USER
'
,
response
.
data
)
},
async
SearchUsers
({
commit
,
dispatch
},
{
query
,
page
})
{
async
SearchUsers
({
commit
,
dispatch
,
state
},
{
query
,
page
})
{
if
(
query
.
length
===
0
)
{
commit
(
'
SET_SEARCH_QUERY
'
,
query
)
dispatch
(
'
FetchUsers
'
,
page
)
...
...
@@ -62,20 +62,14 @@ const user = {
commit
(
'
SET_LOADING
'
,
true
)
commit
(
'
SET_SEARCH_QUERY
'
,
query
)
const
response
=
await
searchUsers
(
query
,
page
)
const
response
=
await
searchUsers
(
query
,
page
,
state
.
showLocalUsers
)
loadUsers
(
commit
,
page
,
response
.
data
)
}
},
async
ToggleLocalUsersFilter
({
commit
,
dispatch
},
value
)
{
async
ToggleLocalUsersFilter
({
commit
,
dispatch
,
state
},
value
)
{
commit
(
'
SET_LOCAL_USERS_FILTER
'
,
value
)
if
(
value
)
{
const
response
=
await
fetchLocalUsers
()
loadUsers
(
commit
,
1
,
response
.
data
)
}
else
{
dispatch
(
'
FetchUsers
'
,
1
)
}
dispatch
(
'
SearchUsers
'
,
{
query
:
state
.
searchQuery
,
page
:
1
})
}
}
}
...
...
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