chore(site): add stories for AgentDevcontainerCard

This commit is contained in:
Cian Johnston
2025-03-13 17:01:30 +00:00
parent f8f30003a1
commit 999469f6e9
2 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import type { Meta, StoryObj } from "@storybook/react";
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
import {
MockWorkspace,
MockWorkspaceAgentDevcontainer,
MockWorkspaceAgentDevcontainerPorts,
} from "testHelpers/entities";
const meta: Meta<typeof AgentDevcontainerCard> = {
title: "modules/resources/AgentDevcontainerCard",
component: AgentDevcontainerCard,
args: {
container: MockWorkspaceAgentDevcontainer,
workspace: MockWorkspace,
wildcardHostname: "*.wildcard.hostname",
agentName: "dev",
},
};
export default meta;
type Story = StoryObj<typeof AgentDevcontainerCard>;
export const NoPorts: Story = {};
export const WithPorts: Story = {
args: {
container: {
...MockWorkspaceAgentDevcontainer,
ports: MockWorkspaceAgentDevcontainerPorts,
},
},
};

View File

@ -4272,3 +4272,46 @@ function mockTwoDaysAgo() {
date.setDate(date.getDate() - 2);
return date.toISOString();
}
export const MockWorkspaceAgentDevcontainerPorts: TypesGen.WorkspaceAgentDevcontainerPort[] = [
{
port: 1000,
network: "tcp",
host_port: 1000,
host_ip: "0.0.0.0"
},
{
port: 2001,
network: "tcp",
host_port: 2000,
host_ip: "::1"
},
{
port: 8888,
network: "tcp",
}
]
export const MockWorkspaceAgentDevcontainer : TypesGen.WorkspaceAgentDevcontainer = {
created_at: "2024-01-04T15:53:03.21563Z",
id: "abcd1234",
name: "container-1",
image: "ubuntu:latest",
labels: {
"foo": "bar"
},
ports: [],
running: true,
status: "running",
volumes: {
"/mnt/volume1": "/volume1",
}
}
export const MockWorkspaceAgentListContainersResponse: TypesGen.WorkspaceAgentListContainersResponse =
{
containers: [
MockWorkspaceAgentDevcontainer,
],
"warnings": ["This is a warning"],
}