From 06030e158e207bb345f89e12f33053f16855714c Mon Sep 17 00:00:00 2001 From: rkfg Date: Thu, 18 Jul 2024 12:53:08 +0300 Subject: [PATCH 1/2] Hide zero last retry timestamps in federation list --- src/resources/destinations.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/resources/destinations.tsx b/src/resources/destinations.tsx index 8a249a1b..89c7a9c8 100644 --- a/src/resources/destinations.tsx +++ b/src/resources/destinations.tsx @@ -27,6 +27,7 @@ import { useNotify, useRefresh, useTranslate, + DateFieldProps, } from "react-admin"; import { DATE_FORMAT } from "../components/date"; @@ -92,6 +93,14 @@ 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) => { return ( { `${id}/show/rooms`} bulkActionButtons={false}> - + From 537cd34e3f56dc2470ecb0b4a78aad2fe7c5d6c6 Mon Sep 17 00:00:00 2001 From: rkfg Date: Thu, 18 Jul 2024 12:53:26 +0300 Subject: [PATCH 2/2] Federation dark theme improvements --- src/resources/destinations.tsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/resources/destinations.tsx b/src/resources/destinations.tsx index 89c7a9c8..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, @@ -31,13 +33,10 @@ import { } 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 = () => { @@ -96,12 +95,22 @@ const DestinationTitle = () => { const RetryDateField = (props: DateFieldProps) => { const record = useRecordContext(props); if (props.source && get(record, props.source) === 0) { - return + return ; } - 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 (