Skip to content

Commit ab5c9f7

Browse files
authored
fix: display notification on schedule update (#16672)
Fixes: #15214
1 parent 3a2d4a2 commit ab5c9f7

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceSchedulePage.test.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,12 @@ describe("WorkspaceSchedulePage", () => {
291291
name: /save/i,
292292
});
293293
await user.click(submitButton);
294+
295+
const notification = await screen.findByText(
296+
"Workspace schedule updated",
297+
);
298+
expect(notification).toBeInTheDocument();
299+
294300
const dialog = await screen.findByText("Restart workspace?");
295301
expect(dialog).toBeInTheDocument();
296302
});
@@ -312,6 +318,12 @@ describe("WorkspaceSchedulePage", () => {
312318
name: /save/i,
313319
});
314320
await user.click(submitButton);
321+
322+
const notification = await screen.findByText(
323+
"Workspace schedule updated",
324+
);
325+
expect(notification).toBeInTheDocument();
326+
315327
const dialog = screen.queryByText("Restart workspace?");
316328
expect(dialog).not.toBeInTheDocument();
317329
});

site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceSchedulePage.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type * as TypesGen from "api/typesGenerated";
66
import { Alert } from "components/Alert/Alert";
77
import { ErrorAlert } from "components/Alert/ErrorAlert";
88
import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
9+
import { displayError, displaySuccess } from "components/GlobalSnackbar/utils";
910
import { Loader } from "components/Loader/Loader";
1011
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
1112
import dayjs from "dayjs";
@@ -60,7 +61,9 @@ export const WorkspaceSchedulePage: FC = () => {
6061
params.workspace,
6162
),
6263
);
64+
displaySuccess("Workspace schedule updated");
6365
},
66+
onError: () => displayError("Failed to update workspace schedule"),
6467
});
6568
const error = checkPermissionsError || getTemplateError;
6669
const isLoading = !template || !permissions;

0 commit comments

Comments
 (0)