Skip to content

refactor: Refactor template resources #4789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix stories
  • Loading branch information
BrunoQuaresma committed Oct 27, 2022
commit 49c3a4ef3bdc110fc4463374730170ae5b643ddb
6 changes: 6 additions & 0 deletions site/src/components/AppLink/AppLink.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Story } from "@storybook/react"
import {
MockWorkspace,
MockWorkspaceAgent,
MockWorkspaceApp,
} from "../../testHelpers/renderHelpers"
import { AppLink, AppLinkProps } from "./AppLink"
Expand All @@ -22,6 +23,7 @@ WithIcon.args = {
sharing_level: "owner",
health: "healthy",
},
agent: MockWorkspaceAgent,
}

export const WithoutIcon = Template.bind({})
Expand All @@ -33,6 +35,7 @@ WithoutIcon.args = {
sharing_level: "owner",
health: "healthy",
},
agent: MockWorkspaceAgent,
}

export const HealthDisabled = Template.bind({})
Expand All @@ -44,6 +47,7 @@ HealthDisabled.args = {
sharing_level: "owner",
health: "disabled",
},
agent: MockWorkspaceAgent,
}

export const HealthInitializing = Template.bind({})
Expand All @@ -54,6 +58,7 @@ HealthInitializing.args = {
name: "code-server",
health: "initializing",
},
agent: MockWorkspaceAgent,
}

export const HealthUnhealthy = Template.bind({})
Expand All @@ -64,4 +69,5 @@ HealthUnhealthy.args = {
name: "code-server",
health: "unhealthy",
},
agent: MockWorkspaceAgent,
}
35 changes: 35 additions & 0 deletions site/src/components/Resources/AgentRow.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Story } from "@storybook/react"
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities"
import { AgentRow, AgentRowProps } from "./AgentRow"

export default {
title: "components/AgentRow",
component: AgentRow,
}

const Template: Story<AgentRowProps> = (args) => <AgentRow {...args} />

export const Example = Template.bind({})
Example.args = {
agent: MockWorkspaceAgent,
workspace: MockWorkspace,
applicationsHost: "",
showApps: true,
}

export const HideSSHButton = Template.bind({})
HideSSHButton.args = {
agent: MockWorkspaceAgent,
workspace: MockWorkspace,
applicationsHost: "",
showApps: true,
hideSSHButton: true,
}

export const NotShowingApps = Template.bind({})
NotShowingApps.args = {
agent: MockWorkspaceAgent,
workspace: MockWorkspace,
applicationsHost: "",
showApps: false,
}
20 changes: 2 additions & 18 deletions site/src/components/Resources/ResourceCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Story } from "@storybook/react"
import {
MockWorkspace,
MockWorkspaceAgent,
MockWorkspaceApp,
MockWorkspaceResource,
} from "testHelpers/entities"
import { AgentRowPreview } from "./AgentRowPreview"
import { ResourceCard, ResourceCardProps } from "./ResourceCard"

export default {
Expand All @@ -17,23 +17,7 @@ const Template: Story<ResourceCardProps> = (args) => <ResourceCard {...args} />
export const Example = Template.bind({})
Example.args = {
resource: MockWorkspaceResource,
workspace: MockWorkspace,
applicationsHost: "https://dev.coder.com",
hideSSHButton: false,
showApps: true,
serverVersion: MockWorkspaceAgent.version,
}

export const NotShowingApps = Template.bind({})
NotShowingApps.args = {
...Example.args,
showApps: false,
}

export const HideSSHButton = Template.bind({})
HideSSHButton.args = {
...Example.args,
hideSSHButton: true,
agentRow: (agent) => <AgentRowPreview key={agent.id} agent={agent} />,
}

export const BunchOfApps = Template.bind({})
Expand Down