fix: display notification on schedule update (#16672)

Fixes: https://github.com/coder/coder/issues/15214
This commit is contained in:
Marcin Tojek
2025-02-24 13:27:16 +00:00
committed by GitHub
parent 3a2d4a2ccc
commit ab5c9f7e0c
2 changed files with 15 additions and 0 deletions
@@ -291,6 +291,12 @@ describe("WorkspaceSchedulePage", () => {
name: /save/i,
});
await user.click(submitButton);
const notification = await screen.findByText(
"Workspace schedule updated",
);
expect(notification).toBeInTheDocument();
const dialog = await screen.findByText("Restart workspace?");
expect(dialog).toBeInTheDocument();
});
@@ -312,6 +318,12 @@ describe("WorkspaceSchedulePage", () => {
name: /save/i,
});
await user.click(submitButton);
const notification = await screen.findByText(
"Workspace schedule updated",
);
expect(notification).toBeInTheDocument();
const dialog = screen.queryByText("Restart workspace?");
expect(dialog).not.toBeInTheDocument();
});
@@ -6,6 +6,7 @@ import type * as TypesGen from "api/typesGenerated";
import { Alert } from "components/Alert/Alert";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
import { displayError, displaySuccess } from "components/GlobalSnackbar/utils";
import { Loader } from "components/Loader/Loader";
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
import dayjs from "dayjs";
@@ -60,7 +61,9 @@ export const WorkspaceSchedulePage: FC = () => {
params.workspace,
),
);
displaySuccess("Workspace schedule updated");
},
onError: () => displayError("Failed to update workspace schedule"),
});
const error = checkPermissionsError || getTemplateError;
const isLoading = !template || !permissions;