put -> patch

This commit is contained in:
Alex Holliday
2026-02-04 19:30:41 +00:00
parent a89e5ed565
commit 04fef2ef75
4 changed files with 8 additions and 16 deletions
@@ -121,7 +121,7 @@ export const BasePageWithStates = ({
}: BasePageWithStatesProps) => {
const showLoading = loading && (!items || items.length === 0);
if (isEmpty(items)) {
if (!loading && isEmpty(items)) {
return (
<EmptyFallback
bullets={bullets}
@@ -24,7 +24,7 @@ interface MaintenanceWindowTableProps {
maintenanceWindowCount: number;
page: number;
setPage: (page: number) => void;
updateCallback: () => void;
refetch: () => void;
}
const getTimeToNextWindow = (
@@ -68,7 +68,7 @@ export const MaintenanceWindowTable = ({
maintenanceWindowCount,
page,
setPage,
updateCallback,
refetch,
}: MaintenanceWindowTableProps) => {
const theme = useTheme();
const { t } = useTranslation();
@@ -88,7 +88,7 @@ export const MaintenanceWindowTable = ({
if (!selectedWindow) return;
const result = await deleteFn(`/maintenance-window/${selectedWindow.id}`);
if (result) {
updateCallback();
refetch();
setDeleteDialogOpen(false);
setSelectedWindow(null);
}
@@ -99,7 +99,7 @@ export const MaintenanceWindowTable = ({
active: !maintenanceWindow.active,
});
if (result) {
updateCallback();
refetch();
}
};
+2 -10
View File
@@ -23,14 +23,6 @@ const MaintenanceWindowPage = () => {
`/maintenance-window/team?page=${page}&rowsPerPage=${rowsPerPage}`
);
const handleUpdate = useCallback(() => {
refetch();
}, [refetch]);
const handlePageChange = useCallback((newPage: number) => {
setPage(newPage);
}, []);
const maintenanceWindows = data?.maintenanceWindows ?? [];
const maintenanceWindowCount = data?.maintenanceWindowCount ?? 0;
@@ -50,8 +42,8 @@ const MaintenanceWindowPage = () => {
maintenanceWindows={maintenanceWindows}
maintenanceWindowCount={maintenanceWindowCount}
page={page}
setPage={handlePageChange}
updateCallback={handleUpdate}
setPage={setPage}
refetch={refetch}
/>
</BasePageWithStates>
);
+1 -1
View File
@@ -16,7 +16,7 @@ class MaintenanceWindowRoutes {
this.router.get("/monitor/:monitorId", this.mwController.getMaintenanceWindowsByMonitorId);
this.router.get("/:id", this.mwController.getMaintenanceWindowById);
this.router.put("/:id", this.mwController.editMaintenanceWindow);
this.router.patch("/:id", this.mwController.editMaintenanceWindow);
this.router.delete("/:id", this.mwController.deleteMaintenanceWindow);
}