Skip to content

Commit 9ec5952

Browse files
committed
Remove mutation errors from alerts
1 parent 38f213e commit 9ec5952

File tree

3 files changed

+4
-73
lines changed

3 files changed

+4
-73
lines changed

site/src/pages/WorkspacePage/Workspace.stories.tsx

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export const Running: Story = {
7878
workspace: Mocks.MockWorkspace,
7979
handleStart: action("start"),
8080
handleStop: action("stop"),
81-
workspaceErrors: {},
8281
buildInfo: Mocks.MockBuildInfo,
8382
template: Mocks.MockTemplate,
8483
},
@@ -122,18 +121,6 @@ export const Stopping: Story = {
122121
},
123122
};
124123

125-
export const Failed: Story = {
126-
args: {
127-
...Running.args,
128-
workspace: Mocks.MockFailedWorkspace,
129-
workspaceErrors: {
130-
buildError: Mocks.mockApiError({
131-
message: "A workspace build is already active.",
132-
}),
133-
},
134-
},
135-
};
136-
137124
export const FailedWithLogs: Story = {
138125
args: {
139126
...Running.args,
@@ -224,29 +211,6 @@ export const CantAutostart: Story = {
224211
},
225212
};
226213

227-
export const GetBuildsError: Story = {
228-
args: {
229-
...Running.args,
230-
workspaceErrors: {
231-
getBuildsError: Mocks.mockApiError({
232-
message: "There is a problem fetching builds.",
233-
}),
234-
},
235-
},
236-
};
237-
238-
export const CancellationError: Story = {
239-
args: {
240-
...Failed.args,
241-
workspaceErrors: {
242-
cancellationError: Mocks.mockApiError({
243-
message: "Job could not be canceled.",
244-
}),
245-
},
246-
buildLogs: <WorkspaceBuildLogsSection logs={makeFailedBuildLogs()} />,
247-
},
248-
};
249-
250214
export const Deprecated: Story = {
251215
args: {
252216
...Running.args,

site/src/pages/WorkspacePage/Workspace.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import dayjs from "dayjs";
77
import type * as TypesGen from "api/typesGenerated";
88
import { Alert, AlertDetail } from "components/Alert/Alert";
99
import { Stack } from "components/Stack/Stack";
10-
import { ErrorAlert } from "components/Alert/ErrorAlert";
1110
import { AgentRow } from "components/Resources/AgentRow";
1211
import { useTab } from "hooks";
1312
import {
@@ -28,13 +27,6 @@ import { ResourceCard } from "components/Resources/ResourceCard";
2827
import { WorkspaceNotifications } from "./WorkspaceNotifications";
2928
import { WorkspacePermissions } from "./permissions";
3029

31-
export type WorkspaceError =
32-
| "getBuildsError"
33-
| "buildError"
34-
| "cancellationError";
35-
36-
export type WorkspaceErrors = Partial<Record<WorkspaceError, unknown>>;
37-
3830
export interface WorkspaceProps {
3931
handleStart: (buildParameters?: TypesGen.WorkspaceBuildParameter[]) => void;
4032
handleStop: () => void;
@@ -51,7 +43,6 @@ export interface WorkspaceProps {
5143
canChangeVersions: boolean;
5244
hideSSHButton?: boolean;
5345
hideVSCodeDesktopButton?: boolean;
54-
workspaceErrors: WorkspaceErrors;
5546
buildInfo?: TypesGen.BuildInfoResponse;
5647
sshPrefix?: string;
5748
template?: TypesGen.Template;
@@ -80,7 +71,6 @@ export const Workspace: FC<WorkspaceProps> = ({
8071
isUpdating,
8172
isRestarting,
8273
canChangeVersions,
83-
workspaceErrors,
8474
hideSSHButton,
8575
hideVSCodeDesktopButton,
8676
buildInfo,
@@ -242,17 +232,6 @@ export const Workspace: FC<WorkspaceProps> = ({
242232
onRestartWorkspace={handleRestart}
243233
/>
244234

245-
{Boolean(workspaceErrors.buildError) && (
246-
<ErrorAlert error={workspaceErrors.buildError} dismissible />
247-
)}
248-
249-
{Boolean(workspaceErrors.cancellationError) && (
250-
<ErrorAlert
251-
error={workspaceErrors.cancellationError}
252-
dismissible
253-
/>
254-
)}
255-
256235
{workspace.latest_build.status === "deleted" && (
257236
<WorkspaceDeletedBanner
258237
handleClick={() => navigate(`/templates`)}

site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,10 @@ export const WorkspaceReadyPage = ({
7474
open: boolean;
7575
buildParameters?: TypesGen.WorkspaceBuildParameter[];
7676
}>({ open: false });
77-
const {
78-
mutate: mutateRestartWorkspace,
79-
error: restartBuildError,
80-
isLoading: isRestarting,
81-
} = useMutation({
82-
mutationFn: restartWorkspace,
83-
});
77+
const { mutate: mutateRestartWorkspace, isLoading: isRestarting } =
78+
useMutation({
79+
mutationFn: restartWorkspace,
80+
});
8481

8582
// SSH Prefix
8683
const sshPrefixQuery = useQuery(deploymentSSHConfig());
@@ -221,15 +218,6 @@ export const WorkspaceReadyPage = ({
221218
canChangeVersions={canChangeVersions}
222219
hideSSHButton={featureVisibility["browser_only"]}
223220
hideVSCodeDesktopButton={featureVisibility["browser_only"]}
224-
workspaceErrors={{
225-
buildError:
226-
restartBuildError ??
227-
startWorkspaceMutation.error ??
228-
stopWorkspaceMutation.error ??
229-
deleteWorkspaceMutation.error ??
230-
updateWorkspaceMutation.error,
231-
cancellationError: cancelBuildMutation.error,
232-
}}
233221
buildInfo={buildInfo}
234222
sshPrefix={sshPrefixQuery.data?.hostname_prefix}
235223
template={template}

0 commit comments

Comments
 (0)