From 3fd615943cc441ee154d4fc278b036b16fdd1986 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Wed, 1 Jul 2020 22:36:15 +0200 Subject: [PATCH] Shows encrypted status with icons --- src/components/rooms.js | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/components/rooms.js b/src/components/rooms.js index a28290f..4c598b9 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -5,12 +5,43 @@ import { TextField, Pagination, BooleanField, + useTranslate, } from "react-admin"; +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"; 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" }} > + } + /> @@ -25,7 +61,6 @@ export const RoomList = props => ( -