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
Angelina Filippova
admin-fe
Commits
1494f7fd
Commit
1494f7fd
authored
May 22, 2019
by
Angelina Filippova
Browse files
Implement pagination for reports
parent
f8562896
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/api/reports.js
View file @
1494f7fd
...
...
@@ -2,10 +2,10 @@ import request from '@/utils/request'
import
{
getToken
}
from
'
@/utils/auth
'
import
{
baseName
}
from
'
./utils
'
export
async
function
fetchReports
(
authHost
,
token
)
{
export
async
function
fetchReports
(
limit
,
max_id
,
authHost
,
token
)
{
return
await
request
({
baseURL
:
baseName
(
authHost
),
url
:
`/api/pleroma/admin/reports`
,
url
:
`/api/pleroma/admin/reports
?limit=
${
limit
}
&max_id=
${
max_id
}
`
,
method
:
'
get
'
,
headers
:
authHeaders
(
token
)
})
...
...
src/store/modules/reports.js
View file @
1494f7fd
...
...
@@ -3,8 +3,8 @@ import { fetchReports, toggleReportsFilter } from '@/api/reports'
const
reports
=
{
state
:
{
fetchedReports
:
[],
i
ndex
OfLast
Shown
Report
:
0
,
size
:
3
,
i
d
OfLastReport
:
''
,
page_limit
:
5
,
loading
:
true
},
mutations
:
{
...
...
@@ -17,17 +17,19 @@ const reports = {
SET_LOADING
:
(
state
,
status
)
=>
{
state
.
loading
=
status
},
SET_
INDEX
:
(
state
)
=>
{
state
.
i
ndex
OfLast
Shown
Report
=
state
.
indexOfLastShownReport
+
state
.
size
SET_
LAST_REPORT_ID
:
(
state
,
id
)
=>
{
state
.
i
d
OfLastReport
=
id
}
},
actions
:
{
async
FetchReports
({
commit
,
getters
})
{
async
FetchReports
({
commit
,
state
,
getters
})
{
commit
(
'
SET_LOADING
'
,
true
)
const
response
=
await
fetchReports
(
getters
.
authHost
,
getters
.
token
)
const
response
=
await
fetchReports
(
state
.
page_limit
,
state
.
idOfLastReport
,
getters
.
authHost
,
getters
.
token
)
const
reports
=
response
.
data
.
reports
const
id
=
reports
.
length
>
0
?
reports
[
reports
.
length
-
1
].
id
:
state
.
idOfLastReport
commit
(
'
SET_REPORTS
'
,
response
.
data
.
reports
)
commit
(
'
SET_
INDEX
'
)
commit
(
'
SET_REPORTS
'
,
reports
)
commit
(
'
SET_
LAST_REPORT_ID
'
,
id
)
commit
(
'
SET_LOADING
'
,
false
)
},
async
ToggleReportsFilter
({
getters
},
filters
)
{
...
...
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