mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
* feat: Improve navbar to be more compact The navbar was unnecessarily large before, which made the UI feel a bit bloaty from my perspective. * Attempt to remove overrides * Update theme * Add text field * Update theme to dark! * Fix import ordering * Fix page location * Fix requested changes * Add storybook for workspaces page view * Add empty view * Add tests for empty view * Remove templates page * Fix local port * Remove templates from nav * Fix e2e test * Remove time.ts * Remove dep * Add background color to margins * Merge status checking from workspace page * Fix requested changes * Fix workspace status tests
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { ComponentMeta, Story } from "@storybook/react"
|
|
import React from "react"
|
|
import { ProvisionerJobStatus, Workspace } from "../../api/typesGenerated"
|
|
import { MockWorkspace } from "../../testHelpers/entities"
|
|
import { WorkspacesPageView, WorkspacesPageViewProps } from "./WorkspacesPageView"
|
|
|
|
export default {
|
|
title: "pages/WorkspacesPageView",
|
|
component: WorkspacesPageView,
|
|
} as ComponentMeta<typeof WorkspacesPageView>
|
|
|
|
const Template: Story<WorkspacesPageViewProps> = (args) => <WorkspacesPageView {...args} />
|
|
|
|
const createWorkspaceWithStatus = (status: ProvisionerJobStatus, transition = "start"): Workspace => {
|
|
return {
|
|
...MockWorkspace,
|
|
latest_build: {
|
|
...MockWorkspace.latest_build,
|
|
transition,
|
|
job: {
|
|
...MockWorkspace.latest_build.job,
|
|
status: status,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
// This is type restricted to prevent future statuses from slipping
|
|
// through the cracks unchecked!
|
|
const workspaces: { [key in ProvisionerJobStatus]: Workspace } = {
|
|
canceled: createWorkspaceWithStatus("canceled"),
|
|
canceling: createWorkspaceWithStatus("canceling"),
|
|
failed: createWorkspaceWithStatus("failed"),
|
|
pending: createWorkspaceWithStatus("pending"),
|
|
running: createWorkspaceWithStatus("running"),
|
|
succeeded: createWorkspaceWithStatus("succeeded"),
|
|
}
|
|
|
|
export const AllStates = Template.bind({})
|
|
AllStates.args = {
|
|
workspaces: [
|
|
...Object.values(workspaces),
|
|
createWorkspaceWithStatus("running", "stop"),
|
|
createWorkspaceWithStatus("succeeded", "stop"),
|
|
createWorkspaceWithStatus("running", "delete"),
|
|
],
|
|
}
|
|
|
|
export const Empty = Template.bind({})
|
|
Empty.args = {}
|