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 users from "./resources/users";
|
||||||
import authProvider from "./synapse/authProvider";
|
import authProvider from "./synapse/authProvider";
|
||||||
import dataProvider from "./synapse/dataProvider";
|
import dataProvider from "./synapse/dataProvider";
|
||||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
|
||||||
// TODO: Can we use lazy loading together with browser locale?
|
// TODO: Can we use lazy loading together with browser locale?
|
||||||
const messages = {
|
const messages = {
|
||||||
|
@ -46,7 +47,10 @@ const i18nProvider = polyglotI18nProvider(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
const App = () => (
|
const App = () => (
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
<Admin
|
<Admin
|
||||||
disableTelemetry
|
disableTelemetry
|
||||||
requireAuth
|
requireAuth
|
||||||
|
@ -77,6 +81,7 @@ const App = () => (
|
||||||
<Resource name="room_state" />
|
<Resource name="room_state" />
|
||||||
<Resource name="destination_rooms" />
|
<Resource name="destination_rooms" />
|
||||||
</Admin>
|
</Admin>
|
||||||
|
</QueryClientProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { Identifier } from "ra-core";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a user is managed by an application service
|
* Check if a user is managed by an application service
|
||||||
* @param id The user ID to check
|
* @param id The user ID to check
|
||||||
* @returns Whether the user is managed by an application service
|
* @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") || '';
|
const managedUsersString = localStorage.getItem("as_managed_users") || '';
|
||||||
try {
|
try {
|
||||||
const asManagedUsers = JSON.parse(managedUsersString).map(regex => new RegExp(regex));
|
const asManagedUsers = JSON.parse(managedUsersString).map(regex => new RegExp(regex));
|
||||||
|
|
|
@ -244,6 +244,10 @@ export const UserCreate = (props: CreateProps) => (
|
||||||
|
|
||||||
const UserTitle = () => {
|
const UserTitle = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
|
if (!record) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
let username = record ? (record.displayname ? `"${record.displayname}"` : `"${record.name}"`) : ""
|
let username = record ? (record.displayname ? `"${record.displayname}"` : `"${record.name}"`) : ""
|
||||||
if (isASManaged(record?.id)) {
|
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">
|
<FormTab label={translate("resources.devices.name", { smart_count: 2 })} icon={<DevicesIcon />} path="devices">
|
||||||
<ReferenceManyField reference="devices" target="user_id" label={false}>
|
<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="device_id" sortable={false} />
|
||||||
<TextField source="display_name" sortable={false} />
|
<TextField source="display_name" sortable={false} />
|
||||||
<TextField source="last_seen_ip" sortable={false} />
|
<TextField source="last_seen_ip" sortable={false} />
|
||||||
|
|
Loading…
Reference in a new issue