Federation page improvements for dark mode and last_entry without a date (#19)

Federation page improvements
This is almost a copy of https://github.com/Awesome-Technologies/synapse-admin/pull/583 PR,
authored by @rkfg
This commit is contained in:
Borislav Pantaleev 2024-09-06 00:23:23 +03:00 committed by GitHub
parent cceae77529
commit 0bf3440fc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 3 deletions

View file

@ -4,7 +4,7 @@ on:
branches: [ "main" ]
env:
upstream_version: v0.10.3
etke_version: etke11
etke_version: etke12
bunny_version: v0.1.0
base_path: ./
permissions:

View file

@ -34,6 +34,7 @@ The following changes are already implemented:
* [Display actual Synapse errors](https://github.com/etkecc/synapse-admin/pull/17)
* [Fix base_url being undefined on unsuccessful login](https://github.com/etkecc/synapse-admin/pull/18)
* [Put the version into manifest.json](https://github.com/Awesome-Technologies/synapse-admin/issues/507) (CI only)
* [Federation page improvements](https://github.com/Awesome-Technologies/synapse-admin/pull/583) (using theme colors)
_the list will be updated as new changes are added_

View file

@ -27,14 +27,19 @@ import {
useNotify,
useRefresh,
useTranslate,
DateFieldProps,
} from "react-admin";
import { DATE_FORMAT } from "../components/date";
import { get } from "lodash";
const DestinationPagination = () => <Pagination rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />;
const destinationRowSx = (record: RaRecord) => ({
backgroundColor: record.retry_last_ts > 0 ? "#ffcccc" : "white",
backgroundColor: record.retry_last_ts > 0 ? "warning.light" : "primary.contrastText",
"& .MuiButtonBase-root": {
color: "primary.dark",
},
});
const destinationFilters = [<SearchInput source="destination" alwaysOn />];
@ -92,6 +97,14 @@ const DestinationTitle = () => {
);
};
const RetryDateField = (props: DateFieldProps) => {
const record = useRecordContext(props);
if (props.source && get(record, props.source) === 0) {
return <DateField {...props} record={{ ...record, [props.source]: null }} />;
}
return <DateField {...props} />;
};
export const DestinationList = (props: ListProps) => {
return (
<List
@ -103,7 +116,7 @@ export const DestinationList = (props: ListProps) => {
<Datagrid rowSx={destinationRowSx} rowClick={id => `${id}/show/rooms`} bulkActionButtons={false}>
<TextField source="destination" />
<DateField source="failure_ts" showTime options={DATE_FORMAT} />
<DateField source="retry_last_ts" showTime options={DATE_FORMAT} />
<RetryDateField source="retry_last_ts" showTime options={DATE_FORMAT} />
<TextField source="retry_interval" />
<TextField source="last_successful_stream_ordering" />
<DestinationReconnectButton />