diff --git a/src/components/rooms.js b/src/components/rooms.js index 4b775b0..0a0dad6 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -1,4 +1,8 @@ import React from "react"; +import get from "lodash/get"; +import { Tooltip, Typography } from "@material-ui/core"; +import HttpsIcon from "@material-ui/icons/Https"; +import NoEncryptionIcon from "@material-ui/icons/NoEncryption"; import ViewAgendaIcon from "@material-ui/icons/ViewAgenda"; import PageviewIcon from "@material-ui/icons/Pageview"; import VisibilityIcon from "@material-ui/icons/Visibility"; @@ -18,13 +22,53 @@ const RoomPagination = props => ( ); +const EncryptionField = ({ source, record = {}, emptyText }) => { + const translate = useTranslate(); + const value = get(record, source); + let ariaLabel = value === false ? "ra.boolean.false" : "ra.boolean.true"; + + if (value === false || value === true) { + return ( + + + {value === true ? ( + + ) : ( + + )} + + + ); + } + + return ( + + {emptyText} + + ); +}; + export const RoomList = props => ( - }> + } + sort={{ field: "name", order: "ASC" }} + > - + } + /> + + + + + + ); diff --git a/src/components/users.js b/src/components/users.js index 16167a0..e83b70e 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -78,7 +78,7 @@ export const UserList = props => ( > - + {/* Hack since the users endpoint does not give displaynames in the list*/} ( source="deactivated" helperText="resources.users.helper.deactivate" /> + + ( label="resources.connections.name" icon={} > - + { @@ -48,6 +50,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 +91,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 +112,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(); diff --git a/yarn.lock b/yarn.lock index c5be95c..72f4311 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11444,9 +11444,9 @@ websocket-driver@>=0.5.1: websocket-extensions ">=0.1.1" websocket-extensions@>=0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" - integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== + version "0.1.4" + resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" + integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3, whatwg-encoding@^1.0.5: version "1.0.5"