Skip to content

Commit 8d86e8d

Browse files
committed
chore(site): add stories for AgentDevcontainerCard
1 parent 718db77 commit 8d86e8d

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
3+
import {
4+
MockWorkspace,
5+
MockWorkspaceAgentDevcontainer,
6+
MockWorkspaceAgentDevcontainerPorts,
7+
} from "testHelpers/entities";
8+
9+
const meta: Meta<typeof AgentDevcontainerCard> = {
10+
title: "modules/resources/AgentDevcontainerCard",
11+
component: AgentDevcontainerCard,
12+
args: {
13+
container: MockWorkspaceAgentDevcontainer,
14+
workspace: MockWorkspace,
15+
wildcardHostname: "*.wildcard.hostname",
16+
agentName: "dev",
17+
},
18+
};
19+
20+
export default meta;
21+
type Story = StoryObj<typeof AgentDevcontainerCard>;
22+
23+
export const NoPorts: Story = {};
24+
25+
export const WithPorts: Story = {
26+
args: {
27+
container: {
28+
...MockWorkspaceAgentDevcontainer,
29+
ports: MockWorkspaceAgentDevcontainerPorts,
30+
},
31+
},
32+
};

site/src/testHelpers/entities.ts

+43
Original file line numberDiff line numberDiff line change
@@ -4243,3 +4243,46 @@ export const MockNotificationTemplates: TypesGen.NotificationTemplate[] = [
42434243

42444244
export const MockNotificationMethodsResponse: TypesGen.NotificationMethodsResponse =
42454245
{ available: ["smtp", "webhook"], default: "smtp" };
4246+
4247+
export const MockWorkspaceAgentDevcontainerPorts: TypesGen.WorkspaceAgentDevcontainerPort[] = [
4248+
{
4249+
port: 1000,
4250+
network: "tcp",
4251+
host_port: 1000,
4252+
host_ip: "0.0.0.0"
4253+
},
4254+
{
4255+
port: 2001,
4256+
network: "tcp",
4257+
host_port: 2000,
4258+
host_ip: "::1"
4259+
},
4260+
{
4261+
port: 8888,
4262+
network: "tcp",
4263+
}
4264+
]
4265+
4266+
export const MockWorkspaceAgentDevcontainer : TypesGen.WorkspaceAgentDevcontainer = {
4267+
created_at: "2024-01-04T15:53:03.21563Z",
4268+
id: "abcd1234",
4269+
name: "container-1",
4270+
image: "ubuntu:latest",
4271+
labels: {
4272+
"foo": "bar"
4273+
},
4274+
ports: [],
4275+
running: true,
4276+
status: "running",
4277+
volumes: {
4278+
"/mnt/volume1": "/volume1",
4279+
}
4280+
}
4281+
4282+
export const MockWorkspaceAgentListContainersResponse: TypesGen.WorkspaceAgentListContainersResponse =
4283+
{
4284+
containers: [
4285+
MockWorkspaceAgentDevcontainer,
4286+
],
4287+
"warnings": ["This is a warning"],
4288+
}

0 commit comments

Comments
 (0)