put -> patch

This commit is contained in:
Alex Holliday committed 2026-02-04 19:30:41 +00:00
1 parent a89e5ed565
commit 04fef2ef75
4 files changed
+8 -16

No files matched your search

@@ -121,7 +121,7 @@ export const BasePageWithStates = ({
}: BasePageWithStatesProps) => { }: BasePageWithStatesProps) => {
const showLoading = loading && (!items || items.length === 0); const showLoading = loading && (!items || items.length === 0);
if (isEmpty(items)) { if (!loading && isEmpty(items)) {
return ( return (
<EmptyFallback <EmptyFallback
bullets={bullets} bullets={bullets}
@@ -24,7 +24,7 @@ interface MaintenanceWindowTableProps {
maintenanceWindowCount: number; maintenanceWindowCount: number;
page: number; page: number;
setPage: (page: number) => void; setPage: (page: number) => void;
updateCallback: () => void; refetch: () => void;
} }
const getTimeToNextWindow = ( const getTimeToNextWindow = (
@@ -68,7 +68,7 @@ export const MaintenanceWindowTable = ({
maintenanceWindowCount, maintenanceWindowCount,
page, page,
setPage, setPage,
updateCallback, refetch,
}: MaintenanceWindowTableProps) => { }: MaintenanceWindowTableProps) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -88,7 +88,7 @@ export const MaintenanceWindowTable = ({
if (!selectedWindow) return; if (!selectedWindow) return;
const result = await deleteFn(`/maintenance-window/${selectedWindow.id}`); const result = await deleteFn(`/maintenance-window/${selectedWindow.id}`);
if (result) { if (result) {
updateCallback(); refetch();
setDeleteDialogOpen(false); setDeleteDialogOpen(false);
setSelectedWindow(null); setSelectedWindow(null);
} }
@@ -99,7 +99,7 @@ export const MaintenanceWindowTable = ({
active: !maintenanceWindow.active, active: !maintenanceWindow.active,
}); });
if (result) { if (result) {
updateCallback(); refetch();
} }
}; };
+2 -10
View File
@@ -23,14 +23,6 @@ const MaintenanceWindowPage = () => {
`/maintenance-window/team?page=${page}&rowsPerPage=${rowsPerPage}` `/maintenance-window/team?page=${page}&rowsPerPage=${rowsPerPage}`
); );
const handleUpdate = useCallback(() => {
refetch();
}, [refetch]);
const handlePageChange = useCallback((newPage: number) => {
setPage(newPage);
}, []);
const maintenanceWindows = data?.maintenanceWindows ?? []; const maintenanceWindows = data?.maintenanceWindows ?? [];
const maintenanceWindowCount = data?.maintenanceWindowCount ?? 0; const maintenanceWindowCount = data?.maintenanceWindowCount ?? 0;
@@ -50,8 +42,8 @@ const MaintenanceWindowPage = () => {
maintenanceWindows={maintenanceWindows} maintenanceWindows={maintenanceWindows}
maintenanceWindowCount={maintenanceWindowCount} maintenanceWindowCount={maintenanceWindowCount}
page={page} page={page}
setPage={handlePageChange} setPage={setPage}
updateCallback={handleUpdate} refetch={refetch}
/> />
</BasePageWithStates> </BasePageWithStates>
); );
+1 -1
View File
@@ -16,7 +16,7 @@ class MaintenanceWindowRoutes {
this.router.get("/monitor/:monitorId", this.mwController.getMaintenanceWindowsByMonitorId); this.router.get("/monitor/:monitorId", this.mwController.getMaintenanceWindowsByMonitorId);
this.router.get("/:id", this.mwController.getMaintenanceWindowById); 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); this.router.delete("/:id", this.mwController.deleteMaintenanceWindow);
} }