mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: display notification on schedule update (#16672)
Fixes: https://github.com/coder/coder/issues/15214
This commit is contained in:
+12
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user