Skip to content

Commit

Permalink
Federation page improvements for dark mode and last_entry without a d…
Browse files Browse the repository at this point in the history
…ate (#19)

Federation page improvements
This is almost a copy of Awesome-Technologies/synapse-admin#583 PR,
authored by @rkfg
  • Loading branch information
beastafk authored Sep 5, 2024
1 parent cceae77 commit 0bf3440
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_

Expand Down
17 changes: 15 additions & 2 deletions src/resources/destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 />];
Expand Down Expand Up @@ -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
Expand All @@ -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 />
Expand Down

0 comments on commit 0bf3440

Please sign in to comment.