-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
204 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import React from "react"; | ||
import { | ||
Datagrid, | ||
DateField, | ||
List, | ||
NumberField, | ||
Pagination, | ||
ReferenceField, | ||
Show, | ||
Tab, | ||
TabbedShowLayout, | ||
TextField, | ||
useTranslate, | ||
} from "react-admin"; | ||
import PageviewIcon from "@material-ui/icons/Pageview"; | ||
import ViewListIcon from "@material-ui/icons/ViewList"; | ||
|
||
const ReportPagination = props => ( | ||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} /> | ||
); | ||
|
||
export const ReportShow = props => { | ||
const translate = useTranslate(); | ||
return ( | ||
<Show {...props}> | ||
<TabbedShowLayout> | ||
<Tab | ||
label={translate("synapseadmin.reports.tabs.basic", { | ||
smart_count: 1, | ||
})} | ||
icon={<ViewListIcon />} | ||
> | ||
<DateField | ||
source="received_ts" | ||
showTime | ||
options={{ | ||
year: "numeric", | ||
month: "2-digit", | ||
day: "2-digit", | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
second: "2-digit", | ||
}} | ||
sortable={true} | ||
/> | ||
<ReferenceField source="user_id" reference="users"> | ||
<TextField source="id" /> | ||
</ReferenceField> | ||
<NumberField source="score" /> | ||
<TextField source="reason" /> | ||
<TextField source="name" /> | ||
<TextField | ||
source="canonical_alias" | ||
label="resources.rooms.fields.canonical_alias" | ||
/> | ||
<ReferenceField | ||
source="room_id" | ||
reference="rooms" | ||
link="show" | ||
label="resources.rooms.fields.room_id" | ||
> | ||
<TextField source="id" /> | ||
</ReferenceField> | ||
</Tab> | ||
|
||
<Tab | ||
label="synapseadmin.reports.tabs.detail" | ||
icon={<PageviewIcon />} | ||
path="detail" | ||
> | ||
{" "} | ||
<DateField | ||
source="event_json.origin_server_ts" | ||
showTime | ||
options={{ | ||
year: "numeric", | ||
month: "2-digit", | ||
day: "2-digit", | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
second: "2-digit", | ||
}} | ||
sortable={true} | ||
/> | ||
<ReferenceField source="sender" reference="users"> | ||
<TextField source="id" /> | ||
</ReferenceField> | ||
<TextField source="event_id" /> | ||
<TextField source="event_json.origin" /> | ||
<TextField source="event_json.type" /> | ||
<TextField source="event_json.content.msgtype" /> | ||
<TextField source="event_json.content.body" /> | ||
<TextField source="event_json.content.format" /> | ||
<TextField source="event_json.content.formatted_body" /> | ||
<TextField source="event_json.content.algorithm" /> | ||
<TextField | ||
source="event_json.content.device_id" | ||
label="resources.users.fields.device_id" | ||
/> | ||
</Tab> | ||
</TabbedShowLayout> | ||
</Show> | ||
); | ||
}; | ||
|
||
export const ReportList = ({ ...props }) => { | ||
return ( | ||
<List | ||
{...props} | ||
pagination={<ReportPagination />} | ||
sort={{ field: "received_ts", order: "DESC" }} | ||
bulkActionButtons={false} | ||
> | ||
<Datagrid rowClick="show"> | ||
<TextField source="id" sortable={false} /> | ||
<DateField | ||
source="received_ts" | ||
showTime | ||
options={{ | ||
year: "numeric", | ||
month: "2-digit", | ||
day: "2-digit", | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
second: "2-digit", | ||
}} | ||
sortable={true} | ||
/> | ||
<TextField sortable={false} source="user_id" /> | ||
<TextField sortable={false} source="name" /> | ||
<TextField sortable={false} source="score" /> | ||
</Datagrid> | ||
</List> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters