mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-25 07:45:23 +00:00
Fix pagination and use deactivated users switch
This commit is contained in:
parent
0a241539f2
commit
d099e582e0
1 changed files with 7 additions and 5 deletions
|
@ -25,8 +25,8 @@ const resourceMap = {
|
||||||
deactivated: !!u.deactivated,
|
deactivated: !!u.deactivated,
|
||||||
}),
|
}),
|
||||||
data: "users",
|
data: "users",
|
||||||
total: (json, perPage) => {
|
total: (json, from, perPage) => {
|
||||||
return parseInt(json.next_token, 10) + perPage;
|
return json.next_token ? parseInt(json.next_token, 10) + perPage : from + json.users.length;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
rooms: {
|
rooms: {
|
||||||
|
@ -55,13 +55,15 @@ function filterNullValues(key, value) {
|
||||||
const dataProvider = {
|
const dataProvider = {
|
||||||
getList: (resource, params) => {
|
getList: (resource, params) => {
|
||||||
console.log("getList " + resource);
|
console.log("getList " + resource);
|
||||||
const { user_id, guests } = params.filter;
|
const { user_id, guests, deactivated } = params.filter;
|
||||||
const { page, perPage } = params.pagination;
|
const { page, perPage } = params.pagination;
|
||||||
|
const from = (page - 1) * perPage;
|
||||||
const query = {
|
const query = {
|
||||||
from: (page - 1) * perPage,
|
from: from,
|
||||||
limit: perPage,
|
limit: perPage,
|
||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
guests: guests,
|
guests: guests,
|
||||||
|
deactivated: deactivated,
|
||||||
};
|
};
|
||||||
const homeserver = localStorage.getItem("base_url");
|
const homeserver = localStorage.getItem("base_url");
|
||||||
if (!homeserver || !(resource in resourceMap)) return Promise.reject();
|
if (!homeserver || !(resource in resourceMap)) return Promise.reject();
|
||||||
|
@ -73,7 +75,7 @@ const dataProvider = {
|
||||||
|
|
||||||
return jsonClient(url).then(({ json }) => ({
|
return jsonClient(url).then(({ json }) => ({
|
||||||
data: json[res.data].map(res.map),
|
data: json[res.data].map(res.map),
|
||||||
total: res.total(json, perPage),
|
total: res.total(json, from, perPage),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue