mirror of
https://github.com/etkecc/synapse-admin.git
synced 2024-11-21 23:35:22 +03:00
Fix missing QueryClient (#47)
This commit is contained in:
parent
b7f8e03894
commit
02bee92806
3 changed files with 42 additions and 32 deletions
|
@ -22,6 +22,7 @@ import userMediaStats from "./resources/user_media_statistics";
|
|||
import users from "./resources/users";
|
||||
import authProvider from "./synapse/authProvider";
|
||||
import dataProvider from "./synapse/dataProvider";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
// TODO: Can we use lazy loading together with browser locale?
|
||||
const messages = {
|
||||
|
@ -46,7 +47,10 @@ const i18nProvider = polyglotI18nProvider(
|
|||
]
|
||||
);
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const App = () => (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Admin
|
||||
disableTelemetry
|
||||
requireAuth
|
||||
|
@ -77,6 +81,7 @@ const App = () => (
|
|||
<Resource name="room_state" />
|
||||
<Resource name="destination_rooms" />
|
||||
</Admin>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
export default App;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { Identifier } from "ra-core";
|
||||
|
||||
/**
|
||||
* Check if a user is managed by an application service
|
||||
* @param id The user ID to check
|
||||
* @returns Whether the user is managed by an application service
|
||||
*/
|
||||
export const isASManaged = (id: string): boolean => {
|
||||
export const isASManaged = (id: string | Identifier): boolean => {
|
||||
const managedUsersString = localStorage.getItem("as_managed_users") || '';
|
||||
try {
|
||||
const asManagedUsers = JSON.parse(managedUsersString).map(regex => new RegExp(regex));
|
||||
|
|
|
@ -244,6 +244,10 @@ export const UserCreate = (props: CreateProps) => (
|
|||
|
||||
const UserTitle = () => {
|
||||
const record = useRecordContext();
|
||||
if (!record) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const translate = useTranslate();
|
||||
let username = record ? (record.displayname ? `"${record.displayname}"` : `"${record.name}"`) : ""
|
||||
if (isASManaged(record?.id)) {
|
||||
|
@ -360,7 +364,7 @@ export const UserEdit = (props: EditProps) => {
|
|||
|
||||
<FormTab label={translate("resources.devices.name", { smart_count: 2 })} icon={<DevicesIcon />} path="devices">
|
||||
<ReferenceManyField reference="devices" target="user_id" label={false}>
|
||||
<Datagrid style={{ width: "100%" }} bulkActionButtons="">
|
||||
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
|
||||
<TextField source="device_id" sortable={false} />
|
||||
<TextField source="display_name" sortable={false} />
|
||||
<TextField source="last_seen_ip" sortable={false} />
|
||||
|
|
Loading…
Reference in a new issue