import React, { Fragment } from "react"; import { connect } from "react-redux"; import { BooleanField, BulkDeleteButton, DateField, Datagrid, DeleteButton, Filter, List, NumberField, Pagination, ReferenceField, ReferenceManyField, SearchInput, SelectField, Show, Tab, TabbedShowLayout, TextField, TopToolbar, useRecordContext, useTranslate, } from "react-admin"; import get from "lodash/get"; import PropTypes from "prop-types"; import { makeStyles } from "@material-ui/core/styles"; import { Tooltip, Typography, Chip } from "@material-ui/core"; import FastForwardIcon from "@material-ui/icons/FastForward"; import HttpsIcon from "@material-ui/icons/Https"; import NoEncryptionIcon from "@material-ui/icons/NoEncryption"; import PageviewIcon from "@material-ui/icons/Pageview"; import UserIcon from "@material-ui/icons/Group"; import ViewListIcon from "@material-ui/icons/ViewList"; import VisibilityIcon from "@material-ui/icons/Visibility"; import EventIcon from "@material-ui/icons/Event"; import { RoomDirectoryBulkDeleteButton, RoomDirectoryBulkSaveButton, RoomDirectoryDeleteButton, RoomDirectorySaveButton, } from "./RoomDirectory"; const useStyles = makeStyles(theme => ({ helper_forward_extremities: { fontFamily: "Roboto, Helvetica, Arial, sans-serif", margin: "0.5em", }, })); 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} ); }; const RoomTitle = ({ record }) => { const translate = useTranslate(); var name = ""; if (record) { name = record.name !== "" ? record.name : record.id; } return ( {translate("resources.rooms.name", 1)} {name} ); }; const RoomShowActions = ({ basePath, data, resource }) => { var roomDirectoryStatus = ""; if (data) { roomDirectoryStatus = data.public; } return ( {roomDirectoryStatus === false && ( )} {roomDirectoryStatus === true && ( )} ); }; export const RoomShow = props => { const classes = useStyles({ props }); const translate = useTranslate(); return ( } title={}> }> } path="detail" > }> "/users/" + id} > } path="permission" > } path="state" > } path="forward_extremities" >
{translate("resources.rooms.helper.forward_extremities")}
); }; const RoomBulkActionButtons = props => ( ); const RoomFilter = ({ ...props }) => { const translate = useTranslate(); return ( ); }; const RoomNameField = props => { const { source } = props; const record = useRecordContext(props); return ( {record[source] || record["canonical_alias"] || record["id"]} ); }; RoomNameField.propTypes = { label: PropTypes.string, record: PropTypes.object, source: PropTypes.string.isRequired, }; const FilterableRoomList = ({ roomFilters, dispatch, ...props }) => { const filter = roomFilters; const localMembersFilter = filter && filter.joined_local_members ? true : false; const stateEventsFilter = filter && filter.state_events ? true : false; const versionFilter = filter && filter.version ? true : false; const federateableFilter = filter && filter.federatable ? true : false; return ( } sort={{ field: "name", order: "ASC" }} filters={} bulkActionButtons={} > } /> {localMembersFilter && } {stateEventsFilter && } {versionFilter && } {federateableFilter && } ); }; function mapStateToProps(state) { return { roomFilters: state.admin.resources.rooms.list.params.displayedFilters, }; } export const RoomList = connect(mapStateToProps)(FilterableRoomList);