diff --git a/src/components/rooms.js b/src/components/rooms.js index 8cac414..a28290f 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -1,17 +1,33 @@ import React from "react"; -import { Datagrid, List, TextField, Pagination } from "react-admin"; +import { + Datagrid, + List, + TextField, + Pagination, + BooleanField, +} from "react-admin"; const RoomPagination = props => ( ); export const RoomList = props => ( - }> + } + sort={{ field: "name", order: "ASC" }} + > - + + + + + + + ); diff --git a/src/i18n/de.js b/src/i18n/de.js index a467c1a..c7466b4 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -53,6 +53,12 @@ export default { name: "Name", canonical_alias: "Alias", joined_members: "Mitglieder", + joined_local_members: "lokale Mitglieder", + state_events: "Ereignisse", + version: "Version", + is_encrypted: "Verschlüsselt", + federatable: "Fö­de­riert", + public: "Öffentlich", }, }, connections: { diff --git a/src/i18n/en.js b/src/i18n/en.js index a7a6141..e6335e0 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -53,6 +53,12 @@ export default { name: "Name", canonical_alias: "Alias", joined_members: "Members", + joined_local_members: "local members", + state_events: "State events", + version: "Version", + is_encrypted: "Encrypted", + federatable: "Federatable", + public: "Public", }, }, connections: { diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 6d5486c..0729094 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -48,6 +48,9 @@ const resourceMap = { id: r.room_id, alias: r.canonical_alias, members: r.joined_members, + is_encrypted: !!r.encryption, + federatable: !!r.federatable, + public: !!r.public, }), data: "rooms", total: json => { @@ -86,11 +89,20 @@ function filterNullValues(key, value) { return value; } +function getSearchOrder(order) { + if (order === "DESC") { + return "b"; + } else { + return "f"; + } +} + const dataProvider = { getList: (resource, params) => { console.log("getList " + resource); const { user_id, guests, deactivated } = params.filter; const { page, perPage } = params.pagination; + const { field, order } = params.sort; const from = (page - 1) * perPage; const query = { from: from, @@ -98,6 +110,8 @@ const dataProvider = { user_id: user_id, guests: guests, deactivated: deactivated, + order_by: field, + dir: getSearchOrder(order), }; const homeserver = localStorage.getItem("base_url"); if (!homeserver || !(resource in resourceMap)) return Promise.reject();