mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: link workspaces empty state to template builder (#28280)
This commit is contained in:
@@ -54,7 +54,7 @@ export const WorkspacesEmpty: FC<WorkspacesEmptyProps> = ({
|
||||
description={`${defaultMessage} To create a workspace, you first need to create a template.`}
|
||||
cta={
|
||||
<Button asChild>
|
||||
<Link to="/templates">Go to templates</Link>
|
||||
<Link to="/templates/new/builder">Create a template</Link>
|
||||
</Button>
|
||||
}
|
||||
className="pb-0"
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
waitFor,
|
||||
within,
|
||||
} from "storybook/test";
|
||||
import { reactRouterParameters } from "storybook-addon-remix-react-router";
|
||||
import { API } from "#/api/api";
|
||||
import { getAuthorizationKey } from "#/api/queries/authCheck";
|
||||
import { workspacePermissionsByOrganization } from "#/api/queries/organizations";
|
||||
@@ -241,6 +242,43 @@ export const Empty: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const EmptyWithoutTemplates: Story = {
|
||||
parameters: {
|
||||
permissions: {
|
||||
createTemplates: true,
|
||||
createWorkspace: true,
|
||||
},
|
||||
queries: [
|
||||
{
|
||||
key: getTemplatesQueryKey(),
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
key: workspacesKey({ q: "owner:me", limit: 25, offset: 0 }),
|
||||
data: { workspaces: [], count: 0 },
|
||||
},
|
||||
],
|
||||
reactRouter: reactRouterParameters({
|
||||
location: { path: "/workspaces" },
|
||||
routing: [
|
||||
{ path: "/workspaces", useStoryElement: true },
|
||||
{
|
||||
path: "/templates/new/builder",
|
||||
element: <div>Template builder</div>,
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
const user = userEvent.setup();
|
||||
await user.click(
|
||||
await canvas.findByRole("link", { name: "Create a template" }),
|
||||
);
|
||||
await canvas.findByText("Template builder");
|
||||
},
|
||||
};
|
||||
|
||||
export const RendersWorkspaces: Story = {
|
||||
beforeEach: () => {
|
||||
spyOn(API, "getWorkspaces").mockResolvedValue(MockWorkspacesResponse);
|
||||
|
||||
Reference in New Issue
Block a user