From 41ce58bac8325aa886c333ba5484dc5dd8cb8353 Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Tue, 4 May 2021 16:18:12 +0200 Subject: [PATCH] Enable sorting in tab of users' media (#138) --- README.md | 2 +- src/components/users.js | 15 +++++++-------- src/synapse/dataProvider.js | 3 +++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 78112cc..1356b6e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This project is built using [react-admin](https://marmelab.com/react-admin/). -It needs at least Synapse v1.27.0 for all functions to work as expected! +It needs at least Synapse v1.29.0 for all functions to work as expected! You get your server version with the request `/_synapse/admin/v1/server_version`. See also [Synapse version API](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/version_api.rst). diff --git a/src/components/users.js b/src/components/users.js index 98fda4d..3c5690b 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -420,6 +420,7 @@ export const UserEdit = props => { addLabel={false} pagination={} perPage={50} + sort={{ field: "created_ts", order: "DESC" }} > { minute: "2-digit", second: "2-digit", }} - sortable={false} /> { minute: "2-digit", second: "2-digit", }} - sortable={false} /> - - - - - - + + + + + + diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index b7cd5c2..c9e63fa 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -314,10 +314,13 @@ const dataProvider = { getManyReference: (resource, params) => { console.log("getManyReference " + resource); const { page, perPage } = params.pagination; + const { field, order } = params.sort; const from = (page - 1) * perPage; const query = { from: from, limit: perPage, + order_by: field, + dir: getSearchOrder(order), }; const homeserver = localStorage.getItem("base_url");