diff --git a/src/resources/destinations.tsx b/src/resources/destinations.tsx index 8a249a1b..a71151ec 100644 --- a/src/resources/destinations.tsx +++ b/src/resources/destinations.tsx @@ -1,9 +1,11 @@ +import { get } from "lodash"; import { MouseEvent } from "react"; import AutorenewIcon from "@mui/icons-material/Autorenew"; import DestinationsIcon from "@mui/icons-material/CloudQueue"; import FolderSharedIcon from "@mui/icons-material/FolderShared"; import ViewListIcon from "@mui/icons-material/ViewList"; +import { blue } from "@mui/material/colors"; import { Button, Datagrid, @@ -27,16 +29,14 @@ import { useNotify, useRefresh, useTranslate, + DateFieldProps, } from "react-admin"; import { DATE_FORMAT } from "../components/date"; +import { lighten, useTheme } from '@mui/material'; const DestinationPagination = () => ; -const destinationRowSx = (record: RaRecord) => ({ - backgroundColor: record.retry_last_ts > 0 ? "#ffcccc" : "white", -}); - const destinationFilters = []; export const DestinationReconnectButton = () => { @@ -92,7 +92,25 @@ const DestinationTitle = () => { ); }; +const RetryDateField = (props: DateFieldProps) => { + const record = useRecordContext(props); + if (props.source && get(record, props.source) === 0) { + return ; + } + return ; +}; + export const DestinationList = (props: ListProps) => { + const { palette: { error, mode }, } = useTheme(); + const destinationRowSx = (record: RaRecord) => ({ + backgroundColor: record.retry_last_ts > 0 ? lighten(error[mode], 0.5) : undefined, + "& > td": mode === 'dark' ? { + color: record.retry_last_ts > 0 ? "black" : "white", + "& > button": { + color: blue[700], + }, + } : undefined, + }); return ( { `${id}/show/rooms`} bulkActionButtons={false}> - +