From 691969e1a1378da502a8eedabc93c13ed0a2a90a Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Tue, 6 Feb 2024 07:55:21 +0100
Subject: [PATCH 01/26] Fix translation of device_id in EventReport
Change-Id: Ife6cfdae1fce9b477fc12b2e0cdd6bcea4b8b734
---
src/components/EventReports.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/EventReports.js b/src/components/EventReports.js
index 7e67eb7..1ae063d 100644
--- a/src/components/EventReports.js
+++ b/src/components/EventReports.js
@@ -91,7 +91,7 @@ export const ReportShow = props => {
From 1eb787fd9b17b17f5fc0716efbb56251b2297d3b Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Mon, 5 Feb 2024 21:44:51 +0100
Subject: [PATCH 02/26] Replace "onFailure" with "onError"
https://marmelab.com/react-admin/Upgrade.html#onsuccess-and-onfailure-props-have-moved
Change-Id: I30ae51e06df0293391988a7a84be9c6ef2b158b3
---
src/components/devices.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/devices.js b/src/components/devices.js
index 313bb47..c81a005 100644
--- a/src/components/devices.js
+++ b/src/components/devices.js
@@ -33,7 +33,7 @@ export const DeviceRemoveButton = props => {
notify("resources.devices.action.erase.success");
refresh();
},
- onFailure: () => {
+ onError: () => {
notify("resources.devices.action.erase.failure", { type: "error" });
},
}
From 155e73b9c6782a8522055c038312201c689a1e71 Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Mon, 5 Feb 2024 21:57:14 +0100
Subject: [PATCH 03/26] Rename currentSort to sort
https: //marmelab.com/react-admin/Upgrade.html#currentsort-renamed-to-sort
Change-Id: I676adefe0073a9a0343dcd598e9559ecf30c38af
---
src/components/statistics.js | 12 +++---------
src/components/users.js | 4 ++--
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/components/statistics.js b/src/components/statistics.js
index 90fd2fa..a4090ef 100644
--- a/src/components/statistics.js
+++ b/src/components/statistics.js
@@ -17,14 +17,8 @@ import { DeleteMediaButton } from "./media";
const ListActions = props => {
const { className, exporter, filters, maxResults, ...rest } = props;
- const {
- currentSort,
- resource,
- displayedFilters,
- filterValues,
- showFilter,
- total,
- } = useListContext();
+ const { sort, resource, displayedFilters, filterValues, showFilter, total } =
+ useListContext();
return (
{filters &&
@@ -39,7 +33,7 @@ const ListActions = props => {
diff --git a/src/components/users.js b/src/components/users.js
index dcd3b87..3b58465 100644
--- a/src/components/users.js
+++ b/src/components/users.js
@@ -73,7 +73,7 @@ const date_format = {
};
const UserListActions = ({
- currentSort,
+ sort,
className,
resource,
filters,
@@ -103,7 +103,7 @@ const UserListActions = ({
Date: Mon, 5 Feb 2024 22:02:06 +0100
Subject: [PATCH 04/26] Update pagination
https: //marmelab.com/react-admin/Upgrade.html#no-more-props-injection-in-custom-pagination-and-empty-components
Change-Id: I6f4d3941dee22cf00da30bada5442f3fdd345127
---
src/components/EventReports.js | 4 ++--
src/components/RoomDirectory.js | 4 ++--
src/components/destinations.js | 4 ++--
src/components/rooms.js | 4 ++--
src/components/statistics.js | 4 ++--
src/components/users.js | 4 ++--
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/components/EventReports.js b/src/components/EventReports.js
index 1ae063d..ffece71 100644
--- a/src/components/EventReports.js
+++ b/src/components/EventReports.js
@@ -25,8 +25,8 @@ const date_format = {
second: "2-digit",
};
-const ReportPagination = props => (
-
+const ReportPagination = () => (
+
);
export const ReportShow = props => {
diff --git a/src/components/RoomDirectory.js b/src/components/RoomDirectory.js
index 6981889..345dac8 100644
--- a/src/components/RoomDirectory.js
+++ b/src/components/RoomDirectory.js
@@ -24,8 +24,8 @@ import { useMutation } from "react-query";
import RoomDirectoryIcon from "@mui/icons-material/FolderShared";
import AvatarField from "./AvatarField";
-const RoomDirectoryPagination = props => (
-
+const RoomDirectoryPagination = () => (
+
);
export const RoomDirectoryDeleteButton = props => {
diff --git a/src/components/destinations.js b/src/components/destinations.js
index 7f6ee02..3fc7f78 100644
--- a/src/components/destinations.js
+++ b/src/components/destinations.js
@@ -24,8 +24,8 @@ import DestinationsIcon from "@mui/icons-material/CloudQueue";
import FolderSharedIcon from "@mui/icons-material/FolderShared";
import ViewListIcon from "@mui/icons-material/ViewList";
-const DestinationPagination = props => (
-
+const DestinationPagination = () => (
+
);
const date_format = {
diff --git a/src/components/rooms.js b/src/components/rooms.js
index 8cfa793..514581f 100644
--- a/src/components/rooms.js
+++ b/src/components/rooms.js
@@ -51,8 +51,8 @@ const date_format = {
second: "2-digit",
};
-const RoomPagination = props => (
-
+const RoomPagination = () => (
+
);
const RoomTitle = () => {
diff --git a/src/components/statistics.js b/src/components/statistics.js
index a4090ef..d3ca6c8 100644
--- a/src/components/statistics.js
+++ b/src/components/statistics.js
@@ -41,8 +41,8 @@ const ListActions = props => {
);
};
-const UserMediaStatsPagination = props => (
-
+const UserMediaStatsPagination = () => (
+
);
const userMediaStatsFilters = [];
diff --git a/src/components/users.js b/src/components/users.js
index 3b58465..ac18915 100644
--- a/src/components/users.js
+++ b/src/components/users.js
@@ -121,8 +121,8 @@ UserListActions.defaultProps = {
onUnselectItems: () => null,
};
-const UserPagination = props => (
-
+const UserPagination = () => (
+
);
const userFilters = [
From 82578c657013d80ebdfe8e638f51e1926afb116e Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Mon, 5 Feb 2024 22:03:34 +0100
Subject: [PATCH 05/26] Change unselectAll syntax
https: //marmelab.com/react-admin/Upgrade.html#useunselectall-syntax-changed
Change-Id: Ie8d261e863fe4726b3a5925ed0446eb824c6e517
---
src/components/RoomDirectory.js | 4 ++--
src/components/ServerNotices.js | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/RoomDirectory.js b/src/components/RoomDirectory.js
index 345dac8..bb30e75 100644
--- a/src/components/RoomDirectory.js
+++ b/src/components/RoomDirectory.js
@@ -65,7 +65,7 @@ export const RoomDirectoryBulkSaveButton = () => {
const { selectedIds } = useListContext();
const notify = useNotify();
const refresh = useRefresh();
- const unselectAll = useUnselectAll();
+ const unselectAllRooms = useUnselectAll("rooms");
const { createMany, isloading } = useMutation();
const handleSend = values => {
@@ -74,7 +74,7 @@ export const RoomDirectoryBulkSaveButton = () => {
{
onSuccess: data => {
notify("resources.room_directory.action.send_success");
- unselectAll("rooms");
+ unselectAllRooms();
refresh();
},
onError: error =>
diff --git a/src/components/ServerNotices.js b/src/components/ServerNotices.js
index 92e55f6..45d45b7 100644
--- a/src/components/ServerNotices.js
+++ b/src/components/ServerNotices.js
@@ -115,7 +115,7 @@ export const ServerNoticeBulkButton = () => {
const { selectedIds } = useListContext();
const [open, setOpen] = useState(false);
const notify = useNotify();
- const unselectAll = useUnselectAll();
+ const unselectAllUsers = useUnselectAll("users");
const { createMany, isloading } = useMutation();
const handleDialogOpen = () => setOpen(true);
@@ -127,7 +127,7 @@ export const ServerNoticeBulkButton = () => {
{
onSuccess: data => {
notify("resources.servernotices.action.send_success");
- unselectAll("users");
+ unselectAllUsers();
handleDialogClose();
},
onError: error =>
From 2c769c309e4eef29337f271c6eef356c319e6992 Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Mon, 5 Feb 2024 22:14:54 +0100
Subject: [PATCH 06/26] Move Toolbar's alwaysEnableSaveButton into SaveButton
https: //marmelab.com/react-admin/Upgrade.html#toolbars-alwaysenablesavebutton-prop-has-been-removed
Change-Id: I6c8693d4f55bfabdeaa677bd294d8663b7f14d69
---
src/components/RegistrationTokens.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/components/RegistrationTokens.js b/src/components/RegistrationTokens.js
index 483d1d8..978835c 100644
--- a/src/components/RegistrationTokens.js
+++ b/src/components/RegistrationTokens.js
@@ -12,6 +12,7 @@ import {
NumberField,
NumberInput,
regex,
+ SaveButton,
SimpleForm,
TextInput,
TextField,
@@ -80,7 +81,15 @@ export const RegistrationTokenList = props => (
export const RegistrationTokenCreate = props => (
- }>
+
+ {/* It is possible to create tokens per default without input. */}
+
+
+ }
+ >
Date: Mon, 5 Feb 2024 22:20:49 +0100
Subject: [PATCH 07/26] Move redirect from SimpleForm to Create
Change-Id: I7c5c0043a49bcb16c131e400b2ebe022e233c5ae
---
src/components/RegistrationTokens.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/components/RegistrationTokens.js b/src/components/RegistrationTokens.js
index 978835c..af248ef 100644
--- a/src/components/RegistrationTokens.js
+++ b/src/components/RegistrationTokens.js
@@ -80,9 +80,8 @@ export const RegistrationTokenList = props => (
);
export const RegistrationTokenCreate = props => (
-
+
{/* It is possible to create tokens per default without input. */}
From 6430aca02b07b7d1dfe39277626acbd680975b4e Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Mon, 5 Feb 2024 22:23:09 +0100
Subject: [PATCH 08/26] Rename save to onSubmit in SimpleForm
https: //marmelab.com/react-admin/Upgrade.html#the-form-components-save-prop-has-been-renamed-to-onsubmit
Change-Id: Iaf2c0b665c8058336d4df6326531780a2790e71d
---
src/components/ServerNotices.js | 8 ++++----
src/components/media.js | 8 ++------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/components/ServerNotices.js b/src/components/ServerNotices.js
index 45d45b7..f2c8fcb 100644
--- a/src/components/ServerNotices.js
+++ b/src/components/ServerNotices.js
@@ -23,7 +23,7 @@ import {
DialogTitle,
} from "@mui/material";
-const ServerNoticeDialog = ({ open, loading, onClose, onSend }) => {
+const ServerNoticeDialog = ({ open, loading, onClose, onSubmit }) => {
const translate = useTranslate();
const ServerNoticeToolbar = props => (
@@ -50,7 +50,7 @@ const ServerNoticeDialog = ({ open, loading, onClose, onSend }) => {
}
redirect={false}
- onSubmit={onSend}
+ onSubmit={onSubmit}
>
{
>
);
@@ -150,7 +150,7 @@ export const ServerNoticeBulkButton = () => {
>
);
diff --git a/src/components/media.js b/src/components/media.js
index 9df9ad1..1a4362c 100644
--- a/src/components/media.js
+++ b/src/components/media.js
@@ -29,7 +29,7 @@ import LockIcon from "@mui/icons-material/Lock";
import LockOpenIcon from "@mui/icons-material/LockOpen";
import { alpha, useTheme } from "@mui/material/styles";
-const DeleteMediaDialog = ({ open, loading, onClose, onSend }) => {
+const DeleteMediaDialog = ({ open, loading, onClose, onSubmit }) => {
const translate = useTranslate();
const dateParser = v => {
@@ -61,11 +61,7 @@ const DeleteMediaDialog = ({ open, loading, onClose, onSend }) => {
{translate("resources.delete_media.helper.send")}
- }
- redirect={false}
- save={onSend}
- >
+ } onSubmit={onSubmit}>
Date: Tue, 6 Feb 2024 14:17:00 +0100
Subject: [PATCH 09/26] Refactor ServerNotices
https://marmelab.com/react-admin/Upgrade.html#usequery-usemutation-and-usequerywithstore-have-been-removed
Change-Id: Id12f727d8813f78c3ae300035aeb1333a1272e02
---
src/components/ServerNotices.js | 56 ++++++++++++++++-----------------
1 file changed, 27 insertions(+), 29 deletions(-)
diff --git a/src/components/ServerNotices.js b/src/components/ServerNotices.js
index f2c8fcb..ab15825 100644
--- a/src/components/ServerNotices.js
+++ b/src/components/ServerNotices.js
@@ -7,6 +7,7 @@ import {
Toolbar,
required,
useCreate,
+ useDataProvider,
useListContext,
useNotify,
useRecordContext,
@@ -47,11 +48,7 @@ const ServerNoticeDialog = ({ open, loading, onClose, onSubmit }) => {
{translate("resources.servernotices.helper.send")}
- }
- redirect={false}
- onSubmit={onSubmit}
- >
+ } onSubmit={onSubmit}>
{
export const ServerNoticeBulkButton = () => {
const { selectedIds } = useListContext();
const [open, setOpen] = useState(false);
+ const openDialog = () => setOpen(true);
+ const closeDialog = () => setOpen(false);
const notify = useNotify();
const unselectAllUsers = useUnselectAll("users");
- const { createMany, isloading } = useMutation();
+ const dataProvider = useDataProvider();
- const handleDialogOpen = () => setOpen(true);
- const handleDialogClose = () => setOpen(false);
-
- const handleSend = values => {
- createMany(
- ["servernotices", "createMany", { ids: selectedIds, data: values }],
- {
- onSuccess: data => {
- notify("resources.servernotices.action.send_success");
- unselectAllUsers();
- handleDialogClose();
- },
- onError: error =>
- notify("resources.servernotices.action.send_failure", {
- type: "error",
- }),
- }
- );
- };
+ const { mutate: sendNotices, isLoading } = useMutation(
+ data =>
+ dataProvider.createMany("servernotices", {
+ ids: selectedIds,
+ data: data,
+ }),
+ {
+ onSuccess: () => {
+ notify("resources.servernotices.action.send_success");
+ unselectAllUsers();
+ closeDialog();
+ },
+ onError: () =>
+ notify("resources.servernotices.action.send_failure", {
+ type: "error",
+ }),
+ }
+ );
return (
<>
>
);
From 00ecb29d6bdc11972a8df548cb5c1365784d2637 Mon Sep 17 00:00:00 2001
From: dklimpel <5740567+dklimpel@users.noreply.github.com>
Date: Tue, 6 Feb 2024 12:01:25 +0100
Subject: [PATCH 10/26] Refactor RoomDirectory
Change-Id: Ie3bd606fc91b2673d2a3422f8fd465258d3211b0
---
src/components/RoomDirectory.js | 66 +++++++++++++++++----------------
src/components/rooms.js | 21 ++++-------
2 files changed, 42 insertions(+), 45 deletions(-)
diff --git a/src/components/RoomDirectory.js b/src/components/RoomDirectory.js
index bb30e75..2b338a6 100644
--- a/src/components/RoomDirectory.js
+++ b/src/components/RoomDirectory.js
@@ -13,6 +13,7 @@ import {
TextField,
TopToolbar,
useCreate,
+ useDataProvider,
useListContext,
useNotify,
useTranslate,
@@ -28,7 +29,7 @@ const RoomDirectoryPagination = () => (
);
-export const RoomDirectoryDeleteButton = props => {
+export const RoomDirectoryUnpublishButton = props => {
const translate = useTranslate();
return (
@@ -49,7 +50,7 @@ export const RoomDirectoryDeleteButton = props => {
);
};
-export const RoomDirectoryBulkDeleteButton = props => (
+export const RoomDirectoryBulkUnpublishButton = props => (
(
/>
);
-export const RoomDirectoryBulkSaveButton = () => {
+export const RoomDirectoryBulkPublishButton = props => {
const { selectedIds } = useListContext();
const notify = useNotify();
const refresh = useRefresh();
const unselectAllRooms = useUnselectAll("rooms");
- const { createMany, isloading } = useMutation();
-
- const handleSend = values => {
- createMany(
- ["room_directory", "createMany", { ids: selectedIds, data: {} }],
- {
- onSuccess: data => {
- notify("resources.room_directory.action.send_success");
- unselectAllRooms();
- refresh();
- },
- onError: error =>
- notify("resources.room_directory.action.send_failure", {
- type: "error",
- }),
- }
- );
- };
+ const dataProvider = useDataProvider();
+ const { mutate, isLoading } = useMutation(
+ () =>
+ dataProvider.createMany("room_directory", {
+ ids: selectedIds,
+ data: {},
+ }),
+ {
+ onSuccess: () => {
+ notify("resources.room_directory.action.send_success");
+ unselectAllRooms();
+ refresh();
+ },
+ onError: () =>
+ notify("resources.room_directory.action.send_failure", {
+ type: "error",
+ }),
+ }
+ );
return (
);
};
-export const RoomDirectorySaveButton = () => {
+export const RoomDirectoryPublishButton = props => {
const record = useRecordContext();
const notify = useNotify();
const refresh = useRefresh();
- const [create, { isloading }] = useCreate();
+ const [create, { isLoading }] = useCreate();
const handleSend = () => {
create(
"room_directory",
{ data: { id: record.id } },
{
- onSuccess: _data => {
+ onSuccess: () => {
notify("resources.room_directory.action.send_success");
refresh();
},
- onError: _error =>
+ onError: () =>
notify("resources.room_directory.action.send_failure", {
type: "error",
}),
@@ -121,17 +124,16 @@ export const RoomDirectorySaveButton = () => {
return (
);
};
-const RoomDirectoryBulkActionButtons = () => ;
-
const RoomDirectoryListActions = () => (
@@ -146,8 +148,8 @@ export const RoomDirectoryList = () => (
actions={}
>
"/rooms/" + id + "/show"}
- bulkActionButtons={}
+ rowClick={(id, _resource, _record) => "/rooms/" + id + "/show"}
+ bulkActionButtons={}
omit={["room_id", "canonical_alias", "topic"]}
>
{
return (
- {roomDirectoryStatus === false && (
-
- )}
- {roomDirectoryStatus === true && (
-
- )}
+ {roomDirectoryStatus === false && }
+ {roomDirectoryStatus === true && }
{
const RoomBulkActionButtons = () => (
<>
-
-
+
+
Date: Wed, 7 Feb 2024 08:43:07 +0100
Subject: [PATCH 11/26] Refactor media
Change-Id: Ic24c53048c35b76532af24d9c5c9bf831688344b
---
src/components/media.js | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/src/components/media.js b/src/components/media.js
index 1a4362c..fec66a6 100644
--- a/src/components/media.js
+++ b/src/components/media.js
@@ -38,19 +38,17 @@ const DeleteMediaDialog = ({ open, loading, onClose, onSubmit }) => {
return d.getTime();
};
- const DeleteMediaToolbar = props => {
- return (
-
- }
- />
-
-
- );
- };
+ const DeleteMediaToolbar = props => (
+
+ }
+ />
+
+
+ );
return (