Skip to content

Commit 2b905e7

Browse files
committed
add stories
1 parent 12cdd47 commit 2b905e7

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

site/src/components/Workspace/Workspace.stories.tsx

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { action } from "@storybook/addon-actions"
22
import { Story } from "@storybook/react"
33
import * as Mocks from "../../testHelpers/entities"
4-
import { Workspace, WorkspaceProps } from "./Workspace"
4+
import { Workspace, WorkspaceErrors, WorkspaceProps } from "./Workspace"
55

66
export default {
77
title: "components/Workspace",
@@ -71,6 +71,11 @@ Error.args = {
7171
transition: "start",
7272
},
7373
},
74+
workspaceErrors: {
75+
[WorkspaceErrors.BUILD_ERROR]: Mocks.makeMockApiError({
76+
message: "A workspace build is already active.",
77+
}),
78+
}
7479
}
7580

7681
export const Deleting = Template.bind({})
@@ -95,10 +100,35 @@ export const Canceled = Template.bind({})
95100
Canceled.args = {
96101
...Started.args,
97102
workspace: Mocks.MockCanceledWorkspace,
103+
workspaceErrors: {
104+
[WorkspaceErrors.CANCELLATION_MESSAGE]: Mocks.makeMockApiError({
105+
message: "Job has been marked as canceled...",
106+
}),
107+
}
98108
}
99109

100110
export const Outdated = Template.bind({})
101111
Outdated.args = {
102112
...Started.args,
103113
workspace: Mocks.MockOutdatedWorkspace,
104114
}
115+
116+
export const GetBuildsError = Template.bind({})
117+
GetBuildsError.args = {
118+
...Started.args,
119+
workspaceErrors: {
120+
[WorkspaceErrors.GET_BUILDS_ERROR]: Mocks.makeMockApiError({
121+
message: "There is a problem fetching builds.",
122+
}),
123+
}
124+
}
125+
126+
export const GetResourcesError = Template.bind({})
127+
GetResourcesError.args = {
128+
...Started.args,
129+
workspaceErrors: {
130+
[WorkspaceErrors.GET_RESOURCES_ERROR]: Mocks.makeMockApiError({
131+
message: "There is a problem fetching workspace resources.",
132+
}),
133+
}
134+
}

site/src/components/Workspace/Workspace.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface WorkspaceProps {
4141
resources?: TypesGen.WorkspaceResource[]
4242
builds?: TypesGen.WorkspaceBuild[]
4343
canUpdateWorkspace: boolean
44-
workspaceErrors: Partial<Record<WorkspaceErrors, Error>>
44+
workspaceErrors: Partial<Record<WorkspaceErrors, Error | unknown>>
4545
}
4646

4747
/**
@@ -117,7 +117,7 @@ export const Workspace: FC<WorkspaceProps> = ({
117117
{!!resources && !!resources.length && (
118118
<Resources
119119
resources={resources}
120-
getResourcesError={workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR]}
120+
getResourcesError={workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR] as Error}
121121
workspace={workspace}
122122
canUpdateWorkspace={canUpdateWorkspace}
123123
/>

site/src/pages/WorkspacePage/WorkspacePage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export const WorkspacePage: React.FC = () => {
4646
cancellationMessage,
4747
} = workspaceState.context
4848

49-
console.log(cancellationMessage)
5049
const canUpdateWorkspace = !!permissions?.updateWorkspace
5150

5251
const [bannerState, bannerSend] = useMachine(workspaceScheduleBannerMachine)

0 commit comments

Comments
 (0)