2024-02-03 15:56:33 +03:00
|
|
|
import React, { cloneElement } from "react";
|
2023-01-24 23:27:02 +03:00
|
|
|
import AssignmentIndIcon from "@mui/icons-material/AssignmentInd";
|
|
|
|
import ContactMailIcon from "@mui/icons-material/ContactMail";
|
|
|
|
import DevicesIcon from "@mui/icons-material/Devices";
|
|
|
|
import GetAppIcon from "@mui/icons-material/GetApp";
|
|
|
|
import NotificationsIcon from "@mui/icons-material/Notifications";
|
|
|
|
import PermMediaIcon from "@mui/icons-material/PermMedia";
|
|
|
|
import PersonPinIcon from "@mui/icons-material/PersonPin";
|
|
|
|
import SettingsInputComponentIcon from "@mui/icons-material/SettingsInputComponent";
|
|
|
|
import ViewListIcon from "@mui/icons-material/ViewList";
|
2020-02-07 19:44:48 +03:00
|
|
|
import {
|
2020-03-30 11:22:27 +03:00
|
|
|
ArrayInput,
|
2020-03-28 23:25:34 +03:00
|
|
|
ArrayField,
|
2020-09-22 12:30:27 +03:00
|
|
|
Button,
|
2020-02-07 19:44:48 +03:00
|
|
|
Datagrid,
|
2020-03-28 23:25:34 +03:00
|
|
|
DateField,
|
2020-02-07 19:44:48 +03:00
|
|
|
Create,
|
|
|
|
Edit,
|
|
|
|
List,
|
2020-04-09 11:32:06 +03:00
|
|
|
Toolbar,
|
2020-02-07 19:44:48 +03:00
|
|
|
SimpleForm,
|
2020-03-30 11:22:27 +03:00
|
|
|
SimpleFormIterator,
|
2020-03-28 23:25:34 +03:00
|
|
|
TabbedForm,
|
|
|
|
FormTab,
|
2020-02-07 19:44:48 +03:00
|
|
|
BooleanField,
|
|
|
|
BooleanInput,
|
|
|
|
PasswordInput,
|
|
|
|
TextField,
|
|
|
|
TextInput,
|
|
|
|
ReferenceField,
|
2020-07-08 11:58:57 +03:00
|
|
|
ReferenceManyField,
|
2020-10-08 09:07:55 +03:00
|
|
|
SearchInput,
|
2020-03-30 11:22:27 +03:00
|
|
|
SelectInput,
|
2020-04-09 11:32:06 +03:00
|
|
|
BulkDeleteButton,
|
|
|
|
DeleteButton,
|
|
|
|
SaveButton,
|
2021-11-15 22:57:38 +03:00
|
|
|
maxLength,
|
2020-02-07 19:44:48 +03:00
|
|
|
regex,
|
2021-11-15 22:40:05 +03:00
|
|
|
required,
|
2023-01-24 18:36:08 +03:00
|
|
|
useRecordContext,
|
2020-04-09 11:32:06 +03:00
|
|
|
useTranslate,
|
2020-03-27 23:02:37 +03:00
|
|
|
Pagination,
|
2020-07-13 11:14:49 +03:00
|
|
|
CreateButton,
|
|
|
|
ExportButton,
|
|
|
|
TopToolbar,
|
|
|
|
sanitizeListRestProps,
|
2021-02-11 23:11:34 +03:00
|
|
|
NumberField,
|
2020-02-07 19:44:48 +03:00
|
|
|
} from "react-admin";
|
2021-07-05 15:32:51 +03:00
|
|
|
import { Link } from "react-router-dom";
|
2023-02-04 18:57:37 +03:00
|
|
|
import AvatarField from "./AvatarField";
|
2020-05-06 10:03:33 +03:00
|
|
|
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
2020-07-08 12:11:24 +03:00
|
|
|
import { DeviceRemoveButton } from "./devices";
|
2021-08-19 14:51:53 +03:00
|
|
|
import { ProtectMediaButton, QuarantineMediaButton } from "./media";
|
2020-06-10 15:59:55 +03:00
|
|
|
|
2023-01-16 14:37:30 +03:00
|
|
|
const choices_medium = [
|
|
|
|
{ id: "email", name: "resources.users.email" },
|
|
|
|
{ id: "msisdn", name: "resources.users.msisdn" },
|
|
|
|
];
|
|
|
|
|
|
|
|
const choices_type = [
|
|
|
|
{ id: "bot", name: "bot" },
|
|
|
|
{ id: "support", name: "support" },
|
|
|
|
];
|
|
|
|
|
2022-02-17 22:50:38 +03:00
|
|
|
const date_format = {
|
|
|
|
year: "numeric",
|
|
|
|
month: "2-digit",
|
|
|
|
day: "2-digit",
|
|
|
|
hour: "2-digit",
|
|
|
|
minute: "2-digit",
|
|
|
|
second: "2-digit",
|
|
|
|
};
|
|
|
|
|
2020-07-13 11:14:49 +03:00
|
|
|
const UserListActions = ({
|
|
|
|
currentSort,
|
|
|
|
className,
|
|
|
|
resource,
|
|
|
|
filters,
|
|
|
|
displayedFilters,
|
|
|
|
exporter, // you can hide ExportButton if exporter = (null || false)
|
|
|
|
filterValues,
|
|
|
|
permanentFilter,
|
|
|
|
hasCreate, // you can hide CreateButton if hasCreate = false
|
|
|
|
selectedIds,
|
|
|
|
onUnselectItems,
|
|
|
|
showFilter,
|
|
|
|
maxResults,
|
|
|
|
total,
|
|
|
|
...rest
|
2020-09-22 12:30:27 +03:00
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
|
|
|
{filters &&
|
|
|
|
cloneElement(filters, {
|
|
|
|
resource,
|
|
|
|
showFilter,
|
|
|
|
displayedFilters,
|
|
|
|
filterValues,
|
|
|
|
context: "button",
|
|
|
|
})}
|
2023-02-04 18:57:37 +03:00
|
|
|
<CreateButton />
|
2020-09-22 12:30:27 +03:00
|
|
|
<ExportButton
|
|
|
|
disabled={total === 0}
|
|
|
|
resource={resource}
|
|
|
|
sort={currentSort}
|
|
|
|
filter={{ ...filterValues, ...permanentFilter }}
|
|
|
|
exporter={exporter}
|
|
|
|
maxResults={maxResults}
|
|
|
|
/>
|
|
|
|
{/* Add your custom actions */}
|
2023-02-04 18:57:37 +03:00
|
|
|
<Button component={Link} to="/import_users" label="CSV Import">
|
2024-02-02 18:37:39 +03:00
|
|
|
<GetAppIcon sx={{ transform: "rotate(180deg)", fontSize: "20px" }} />
|
2020-09-22 12:30:27 +03:00
|
|
|
</Button>
|
|
|
|
</TopToolbar>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
UserListActions.defaultProps = {
|
|
|
|
selectedIds: [],
|
|
|
|
onUnselectItems: () => null,
|
|
|
|
};
|
2020-07-13 11:14:49 +03:00
|
|
|
|
2020-03-27 23:02:37 +03:00
|
|
|
const UserPagination = props => (
|
|
|
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
|
|
|
);
|
|
|
|
|
2024-02-03 15:46:33 +03:00
|
|
|
const userFilters = [
|
|
|
|
<SearchInput source="name" alwaysOn />,
|
|
|
|
<BooleanInput source="guests" alwaysOn />,
|
|
|
|
<BooleanInput
|
|
|
|
label="resources.users.fields.show_deactivated"
|
|
|
|
source="deactivated"
|
|
|
|
alwaysOn
|
|
|
|
/>,
|
|
|
|
];
|
2020-02-07 19:44:48 +03:00
|
|
|
|
2024-02-05 15:06:47 +03:00
|
|
|
const UserBulkActionButtons = () => (
|
2024-02-03 15:56:33 +03:00
|
|
|
<>
|
2024-02-05 15:06:47 +03:00
|
|
|
<ServerNoticeBulkButton />
|
2021-05-04 14:52:43 +03:00
|
|
|
<BulkDeleteButton
|
|
|
|
label="resources.users.action.erase"
|
|
|
|
confirmTitle="resources.users.helper.erase"
|
2021-11-15 23:18:29 +03:00
|
|
|
mutationMode="pessimistic"
|
2021-05-04 14:52:43 +03:00
|
|
|
/>
|
2024-02-03 15:56:33 +03:00
|
|
|
</>
|
2021-05-04 14:52:43 +03:00
|
|
|
);
|
2020-04-09 11:32:06 +03:00
|
|
|
|
2024-02-05 15:06:47 +03:00
|
|
|
export const UserList = props => (
|
|
|
|
<List
|
|
|
|
{...props}
|
|
|
|
filters={userFilters}
|
|
|
|
filterDefaultValues={{ guests: true, deactivated: false }}
|
|
|
|
sort={{ field: "name", order: "ASC" }}
|
|
|
|
actions={<UserListActions maxResults={10000} />}
|
|
|
|
pagination={<UserPagination />}
|
|
|
|
>
|
|
|
|
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
|
|
|
|
<AvatarField
|
|
|
|
source="avatar_src"
|
|
|
|
sx={{ height: "40px", width: "40px" }}
|
|
|
|
sortBy="avatar_url"
|
|
|
|
/>
|
|
|
|
<TextField source="id" sortBy="name" />
|
|
|
|
<TextField source="displayname" />
|
|
|
|
<BooleanField source="is_guest" />
|
|
|
|
<BooleanField source="admin" />
|
|
|
|
<BooleanField source="deactivated" />
|
|
|
|
<DateField
|
|
|
|
source="creation_ts"
|
|
|
|
label="resources.users.fields.creation_ts_ms"
|
|
|
|
showTime
|
|
|
|
options={date_format}
|
|
|
|
/>
|
|
|
|
</Datagrid>
|
|
|
|
</List>
|
|
|
|
);
|
2020-06-10 15:59:55 +03:00
|
|
|
|
2020-02-07 19:44:48 +03:00
|
|
|
// https://matrix.org/docs/spec/appendices#user-identifiers
|
2021-11-15 22:57:38 +03:00
|
|
|
// here only local part of user_id
|
|
|
|
// maxLength = 255 - "@" - ":" - localStorage.getItem("home_server").length
|
|
|
|
// localStorage.getItem("home_server").length is not valid here
|
|
|
|
const validateUser = [
|
|
|
|
required(),
|
|
|
|
maxLength(253),
|
|
|
|
regex(/^[a-z0-9._=\-/]+$/, "synapseadmin.users.invalid_user_id"),
|
|
|
|
];
|
|
|
|
|
|
|
|
const validateAddress = [required(), maxLength(255)];
|
2020-02-07 19:44:48 +03:00
|
|
|
|
2020-09-22 12:30:27 +03:00
|
|
|
export function generateRandomUser() {
|
|
|
|
const homeserver = localStorage.getItem("home_server");
|
|
|
|
const user_id =
|
|
|
|
"@" +
|
|
|
|
Array(8)
|
|
|
|
.fill("0123456789abcdefghijklmnopqrstuvwxyz")
|
|
|
|
.map(
|
|
|
|
x =>
|
|
|
|
x[
|
|
|
|
Math.floor(
|
|
|
|
(crypto.getRandomValues(new Uint32Array(1))[0] /
|
|
|
|
(0xffffffff + 1)) *
|
|
|
|
x.length
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
.join("") +
|
|
|
|
":" +
|
|
|
|
homeserver;
|
|
|
|
|
|
|
|
const password = Array(20)
|
|
|
|
.fill(
|
|
|
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@-#$"
|
|
|
|
)
|
|
|
|
.map(
|
|
|
|
x =>
|
|
|
|
x[
|
|
|
|
Math.floor(
|
|
|
|
(crypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)) *
|
|
|
|
x.length
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
.join("");
|
|
|
|
|
|
|
|
return {
|
|
|
|
id: user_id,
|
|
|
|
password: password,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-16 14:52:00 +03:00
|
|
|
const UserEditToolbar = props => (
|
|
|
|
<Toolbar {...props}>
|
2023-02-04 18:57:37 +03:00
|
|
|
<SaveButton disabled={props.pristine} />
|
2023-01-16 14:52:00 +03:00
|
|
|
</Toolbar>
|
|
|
|
);
|
|
|
|
|
|
|
|
const UserEditActions = ({ data }) => {
|
2020-04-09 11:32:06 +03:00
|
|
|
const translate = useTranslate();
|
2023-01-16 14:52:00 +03:00
|
|
|
var userStatus = "";
|
|
|
|
if (data) {
|
|
|
|
userStatus = data.deactivated;
|
|
|
|
}
|
|
|
|
|
2020-04-09 11:32:06 +03:00
|
|
|
return (
|
2023-01-16 14:52:00 +03:00
|
|
|
<TopToolbar>
|
|
|
|
{!userStatus && <ServerNoticeButton record={data} />}
|
2020-04-09 11:32:06 +03:00
|
|
|
<DeleteButton
|
2023-01-16 14:52:00 +03:00
|
|
|
record={data}
|
2020-04-09 11:32:06 +03:00
|
|
|
label="resources.users.action.erase"
|
2021-05-04 14:52:43 +03:00
|
|
|
confirmTitle={translate("resources.users.helper.erase", {
|
|
|
|
smart_count: 1,
|
|
|
|
})}
|
|
|
|
mutationMode="pessimistic"
|
2020-04-09 11:32:06 +03:00
|
|
|
/>
|
2023-01-16 14:52:00 +03:00
|
|
|
</TopToolbar>
|
2020-04-09 11:32:06 +03:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2020-02-07 19:44:48 +03:00
|
|
|
export const UserCreate = props => (
|
|
|
|
<Create {...props}>
|
|
|
|
<SimpleForm>
|
|
|
|
<TextInput source="id" autoComplete="off" validate={validateUser} />
|
2021-11-15 22:57:38 +03:00
|
|
|
<TextInput source="displayname" validate={maxLength(256)} />
|
|
|
|
<PasswordInput
|
|
|
|
source="password"
|
|
|
|
autoComplete="new-password"
|
|
|
|
validate={maxLength(512)}
|
|
|
|
/>
|
2023-01-16 14:37:30 +03:00
|
|
|
<SelectInput
|
|
|
|
source="user_type"
|
|
|
|
choices={choices_type}
|
|
|
|
translateChoice={false}
|
|
|
|
resettable
|
|
|
|
/>
|
2020-02-07 19:44:48 +03:00
|
|
|
<BooleanInput source="admin" />
|
2020-03-30 11:22:27 +03:00
|
|
|
<ArrayInput source="threepids">
|
2022-03-22 19:58:28 +03:00
|
|
|
<SimpleFormIterator disableReordering>
|
2020-03-30 11:22:27 +03:00
|
|
|
<SelectInput
|
|
|
|
source="medium"
|
2023-01-16 14:37:30 +03:00
|
|
|
choices={choices_medium}
|
2021-11-15 22:57:38 +03:00
|
|
|
validate={required()}
|
2020-03-30 11:22:27 +03:00
|
|
|
/>
|
2021-11-15 22:57:38 +03:00
|
|
|
<TextInput source="address" validate={validateAddress} />
|
2020-03-30 11:22:27 +03:00
|
|
|
</SimpleFormIterator>
|
|
|
|
</ArrayInput>
|
2021-11-15 22:40:05 +03:00
|
|
|
<ArrayInput source="external_ids" label="synapseadmin.users.tabs.sso">
|
2022-03-22 19:58:28 +03:00
|
|
|
<SimpleFormIterator disableReordering>
|
2021-11-15 22:40:05 +03:00
|
|
|
<TextInput source="auth_provider" validate={required()} />
|
|
|
|
<TextInput
|
|
|
|
source="external_id"
|
|
|
|
label="resources.users.fields.id"
|
|
|
|
validate={required()}
|
|
|
|
/>
|
|
|
|
</SimpleFormIterator>
|
|
|
|
</ArrayInput>
|
2020-02-07 19:44:48 +03:00
|
|
|
</SimpleForm>
|
|
|
|
</Create>
|
|
|
|
);
|
|
|
|
|
2024-02-05 15:06:47 +03:00
|
|
|
const UserTitle = () => {
|
2023-01-24 18:36:08 +03:00
|
|
|
const record = useRecordContext();
|
2020-04-21 19:39:51 +03:00
|
|
|
const translate = useTranslate();
|
|
|
|
return (
|
|
|
|
<span>
|
2020-06-16 10:52:08 +03:00
|
|
|
{translate("resources.users.name", {
|
|
|
|
smart_count: 1,
|
|
|
|
})}{" "}
|
2020-04-21 19:39:51 +03:00
|
|
|
{record ? `"${record.displayname}"` : ""}
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
};
|
2023-01-16 14:37:30 +03:00
|
|
|
|
2020-06-10 15:59:55 +03:00
|
|
|
export const UserEdit = props => {
|
2020-07-08 11:58:57 +03:00
|
|
|
const translate = useTranslate();
|
2020-06-10 15:59:55 +03:00
|
|
|
return (
|
2023-01-16 14:52:00 +03:00
|
|
|
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
|
2020-06-10 15:59:55 +03:00
|
|
|
<TabbedForm toolbar={<UserEditToolbar />}>
|
2020-08-11 11:25:05 +03:00
|
|
|
<FormTab
|
|
|
|
label={translate("resources.users.name", { smart_count: 1 })}
|
|
|
|
icon={<PersonPinIcon />}
|
|
|
|
>
|
2020-06-10 15:59:55 +03:00
|
|
|
<AvatarField
|
|
|
|
source="avatar_src"
|
|
|
|
sortable={false}
|
2024-02-02 18:37:39 +03:00
|
|
|
sx={{ height: "120px", width: "120px", float: "right" }}
|
2020-06-10 15:59:55 +03:00
|
|
|
/>
|
|
|
|
<TextInput source="id" disabled />
|
|
|
|
<TextInput source="displayname" />
|
2023-01-16 22:18:21 +03:00
|
|
|
<PasswordInput
|
|
|
|
source="password"
|
|
|
|
autoComplete="new-password"
|
|
|
|
helperText="resources.users.helper.password"
|
|
|
|
/>
|
2023-01-16 14:37:30 +03:00
|
|
|
<SelectInput
|
|
|
|
source="user_type"
|
|
|
|
choices={choices_type}
|
|
|
|
translateChoice={false}
|
|
|
|
resettable
|
|
|
|
/>
|
2020-06-10 15:59:55 +03:00
|
|
|
<BooleanInput source="admin" />
|
|
|
|
<BooleanInput
|
|
|
|
source="deactivated"
|
|
|
|
helperText="resources.users.helper.deactivate"
|
|
|
|
/>
|
2022-02-17 22:50:38 +03:00
|
|
|
<DateField source="creation_ts_ms" showTime options={date_format} />
|
2020-06-10 15:59:55 +03:00
|
|
|
<TextField source="consent_version" />
|
|
|
|
</FormTab>
|
2021-02-11 22:37:20 +03:00
|
|
|
|
2020-06-10 15:59:55 +03:00
|
|
|
<FormTab
|
|
|
|
label="resources.users.threepid"
|
|
|
|
icon={<ContactMailIcon />}
|
|
|
|
path="threepid"
|
2020-06-16 08:54:49 +03:00
|
|
|
>
|
2020-06-10 15:59:55 +03:00
|
|
|
<ArrayInput source="threepids">
|
2022-03-22 19:58:28 +03:00
|
|
|
<SimpleFormIterator disableReordering>
|
2023-01-16 14:37:30 +03:00
|
|
|
<SelectInput source="medium" choices={choices_medium} />
|
2020-06-10 15:59:55 +03:00
|
|
|
<TextInput source="address" />
|
|
|
|
</SimpleFormIterator>
|
|
|
|
</ArrayInput>
|
|
|
|
</FormTab>
|
2021-02-11 22:37:20 +03:00
|
|
|
|
2021-08-18 10:33:22 +03:00
|
|
|
<FormTab
|
|
|
|
label="synapseadmin.users.tabs.sso"
|
|
|
|
icon={<AssignmentIndIcon />}
|
|
|
|
path="sso"
|
|
|
|
>
|
2021-11-15 22:40:05 +03:00
|
|
|
<ArrayInput source="external_ids" label={false}>
|
2022-03-22 19:58:28 +03:00
|
|
|
<SimpleFormIterator disableReordering>
|
2021-11-15 22:40:05 +03:00
|
|
|
<TextInput source="auth_provider" validate={required()} />
|
|
|
|
<TextInput
|
2021-08-18 10:33:22 +03:00
|
|
|
source="external_id"
|
|
|
|
label="resources.users.fields.id"
|
2021-11-15 22:40:05 +03:00
|
|
|
validate={required()}
|
2021-08-18 10:33:22 +03:00
|
|
|
/>
|
2021-11-15 22:40:05 +03:00
|
|
|
</SimpleFormIterator>
|
|
|
|
</ArrayInput>
|
2021-08-18 10:33:22 +03:00
|
|
|
</FormTab>
|
|
|
|
|
2020-07-08 11:58:57 +03:00
|
|
|
<FormTab
|
|
|
|
label={translate("resources.devices.name", { smart_count: 2 })}
|
|
|
|
icon={<DevicesIcon />}
|
|
|
|
path="devices"
|
|
|
|
>
|
|
|
|
<ReferenceManyField
|
|
|
|
reference="devices"
|
|
|
|
target="user_id"
|
|
|
|
addLabel={false}
|
|
|
|
>
|
|
|
|
<Datagrid style={{ width: "100%" }}>
|
|
|
|
<TextField source="device_id" sortable={false} />
|
|
|
|
<TextField source="display_name" sortable={false} />
|
|
|
|
<TextField source="last_seen_ip" sortable={false} />
|
|
|
|
<DateField
|
|
|
|
source="last_seen_ts"
|
|
|
|
showTime
|
2022-02-17 22:50:38 +03:00
|
|
|
options={date_format}
|
2020-07-08 11:58:57 +03:00
|
|
|
sortable={false}
|
|
|
|
/>
|
2020-07-08 12:11:24 +03:00
|
|
|
<DeviceRemoveButton />
|
2020-07-08 11:58:57 +03:00
|
|
|
</Datagrid>
|
|
|
|
</ReferenceManyField>
|
|
|
|
</FormTab>
|
2021-02-11 22:37:20 +03:00
|
|
|
|
2020-06-10 15:59:55 +03:00
|
|
|
<FormTab
|
|
|
|
label="resources.connections.name"
|
|
|
|
icon={<SettingsInputComponentIcon />}
|
|
|
|
path="connections"
|
|
|
|
>
|
|
|
|
<ReferenceField
|
|
|
|
reference="connections"
|
|
|
|
source="id"
|
|
|
|
addLabel={false}
|
|
|
|
link={false}
|
|
|
|
>
|
|
|
|
<ArrayField
|
|
|
|
source="devices[].sessions[0].connections"
|
|
|
|
label="resources.connections.name"
|
|
|
|
>
|
|
|
|
<Datagrid style={{ width: "100%" }}>
|
|
|
|
<TextField source="ip" sortable={false} />
|
|
|
|
<DateField
|
|
|
|
source="last_seen"
|
|
|
|
showTime
|
2022-02-17 22:50:38 +03:00
|
|
|
options={date_format}
|
2020-06-10 15:59:55 +03:00
|
|
|
sortable={false}
|
|
|
|
/>
|
|
|
|
<TextField
|
|
|
|
source="user_agent"
|
|
|
|
sortable={false}
|
|
|
|
style={{ width: "100%" }}
|
|
|
|
/>
|
|
|
|
</Datagrid>
|
|
|
|
</ArrayField>
|
|
|
|
</ReferenceField>
|
|
|
|
</FormTab>
|
2021-02-11 22:37:20 +03:00
|
|
|
|
2021-02-11 23:11:34 +03:00
|
|
|
<FormTab
|
|
|
|
label={translate("resources.users_media.name", { smart_count: 2 })}
|
|
|
|
icon={<PermMediaIcon />}
|
|
|
|
path="media"
|
|
|
|
>
|
|
|
|
<ReferenceManyField
|
|
|
|
reference="users_media"
|
|
|
|
target="user_id"
|
|
|
|
addLabel={false}
|
|
|
|
pagination={<UserPagination />}
|
|
|
|
perPage={50}
|
2021-05-04 17:18:12 +03:00
|
|
|
sort={{ field: "created_ts", order: "DESC" }}
|
2021-02-11 23:11:34 +03:00
|
|
|
>
|
|
|
|
<Datagrid style={{ width: "100%" }}>
|
2022-02-17 22:50:38 +03:00
|
|
|
<DateField source="created_ts" showTime options={date_format} />
|
2021-02-11 23:11:34 +03:00
|
|
|
<DateField
|
|
|
|
source="last_access_ts"
|
|
|
|
showTime
|
2022-02-17 22:50:38 +03:00
|
|
|
options={date_format}
|
2021-02-11 23:11:34 +03:00
|
|
|
/>
|
2021-05-04 17:18:12 +03:00
|
|
|
<TextField source="media_id" />
|
|
|
|
<NumberField source="media_length" />
|
|
|
|
<TextField source="media_type" />
|
|
|
|
<TextField source="upload_name" />
|
|
|
|
<TextField source="quarantined_by" />
|
2021-08-19 14:51:53 +03:00
|
|
|
<QuarantineMediaButton label="resources.quarantine_media.action.name" />
|
2021-08-19 12:51:07 +03:00
|
|
|
<ProtectMediaButton label="resources.users_media.fields.safe_from_quarantine" />
|
2021-05-04 14:52:43 +03:00
|
|
|
<DeleteButton mutationMode="pessimistic" redirect={false} />
|
2021-02-11 23:11:34 +03:00
|
|
|
</Datagrid>
|
|
|
|
</ReferenceManyField>
|
|
|
|
</FormTab>
|
|
|
|
|
2021-02-11 22:45:02 +03:00
|
|
|
<FormTab
|
|
|
|
label={translate("resources.rooms.name", { smart_count: 2 })}
|
|
|
|
icon={<ViewListIcon />}
|
|
|
|
path="rooms"
|
|
|
|
>
|
|
|
|
<ReferenceManyField
|
|
|
|
reference="joined_rooms"
|
|
|
|
target="user_id"
|
|
|
|
addLabel={false}
|
|
|
|
>
|
|
|
|
<Datagrid
|
|
|
|
style={{ width: "100%" }}
|
2023-02-04 18:57:37 +03:00
|
|
|
rowClick={(id, resource, record) => "/rooms/" + id + "/show"}
|
2021-02-11 22:45:02 +03:00
|
|
|
>
|
|
|
|
<TextField
|
|
|
|
source="id"
|
|
|
|
sortable={false}
|
|
|
|
label="resources.rooms.fields.room_id"
|
|
|
|
/>
|
|
|
|
<ReferenceField
|
|
|
|
label="resources.rooms.fields.name"
|
|
|
|
source="id"
|
|
|
|
reference="rooms"
|
|
|
|
sortable={false}
|
|
|
|
link=""
|
|
|
|
>
|
|
|
|
<TextField source="name" sortable={false} />
|
|
|
|
</ReferenceField>
|
|
|
|
</Datagrid>
|
|
|
|
</ReferenceManyField>
|
|
|
|
</FormTab>
|
|
|
|
|
2021-02-11 22:37:20 +03:00
|
|
|
<FormTab
|
|
|
|
label={translate("resources.pushers.name", { smart_count: 2 })}
|
|
|
|
icon={<NotificationsIcon />}
|
|
|
|
path="pushers"
|
|
|
|
>
|
|
|
|
<ReferenceManyField
|
|
|
|
reference="pushers"
|
|
|
|
target="user_id"
|
|
|
|
addLabel={false}
|
|
|
|
>
|
|
|
|
<Datagrid style={{ width: "100%" }}>
|
|
|
|
<TextField source="kind" sortable={false} />
|
|
|
|
<TextField source="app_display_name" sortable={false} />
|
|
|
|
<TextField source="app_id" sortable={false} />
|
|
|
|
<TextField source="data.url" sortable={false} />
|
|
|
|
<TextField source="device_display_name" sortable={false} />
|
|
|
|
<TextField source="lang" sortable={false} />
|
|
|
|
<TextField source="profile_tag" sortable={false} />
|
|
|
|
<TextField source="pushkey" sortable={false} />
|
|
|
|
</Datagrid>
|
|
|
|
</ReferenceManyField>
|
|
|
|
</FormTab>
|
2020-06-10 15:59:55 +03:00
|
|
|
</TabbedForm>
|
|
|
|
</Edit>
|
|
|
|
);
|
|
|
|
};
|