mirror of
https://github.com/coder/coder.git
synced 2025-03-14 10:09:57 +00:00
make fmt lint
This commit is contained in:
@ -1173,10 +1173,12 @@ func TestWorkspaceAgentContainers(t *testing.T) {
|
||||
Labels: testLabels,
|
||||
Running: true,
|
||||
Status: "running",
|
||||
Ports: []codersdk.WorkspaceAgentListeningPort{
|
||||
Ports: []codersdk.WorkspaceAgentDevcontainerPort{
|
||||
{
|
||||
Network: "tcp",
|
||||
Port: 80,
|
||||
Network: "tcp",
|
||||
Port: 80,
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: 8000,
|
||||
},
|
||||
},
|
||||
Volumes: map[string]string{
|
||||
|
@ -1,10 +1,10 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
|
||||
import {
|
||||
MockWorkspace,
|
||||
MockWorkspaceAgentDevcontainer,
|
||||
MockWorkspaceAgentDevcontainerPorts,
|
||||
} from "testHelpers/entities";
|
||||
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
|
||||
|
||||
const meta: Meta<typeof AgentDevcontainerCard> = {
|
||||
title: "modules/resources/AgentDevcontainerCard",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import Link from "@mui/material/Link";
|
||||
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip";
|
||||
import type {
|
||||
Workspace,
|
||||
WorkspaceAgentDevcontainer,
|
||||
@ -10,7 +11,6 @@ import { portForwardURL } from "utils/portForward";
|
||||
import { AgentButton } from "./AgentButton";
|
||||
import { AgentDevcontainerSSHButton } from "./SSHButton/SSHButton";
|
||||
import { TerminalLink } from "./TerminalLink/TerminalLink";
|
||||
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip";
|
||||
|
||||
type AgentDevcontainerCardProps = {
|
||||
container: WorkspaceAgentDevcontainer;
|
||||
@ -52,13 +52,13 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
|
||||
/>
|
||||
{wildcardHostname !== "" &&
|
||||
container.ports.map((port) => {
|
||||
let portLabel = `${port.port}/${port.network.toUpperCase()}`;
|
||||
let hasHostBind =
|
||||
const portLabel = `${port.port}/${port.network.toUpperCase()}`;
|
||||
const hasHostBind =
|
||||
port.host_port !== undefined &&
|
||||
port.host_port !== null &&
|
||||
port.host_ip !== undefined &&
|
||||
port.host_ip !== null;
|
||||
let helperText = hasHostBind
|
||||
const helperText = hasHostBind
|
||||
? `${port.host_ip}:${port.host_port}`
|
||||
: "Not bound to host";
|
||||
return (
|
||||
|
@ -4273,45 +4273,45 @@ function mockTwoDaysAgo() {
|
||||
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 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 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"],
|
||||
}
|
||||
{
|
||||
containers: [MockWorkspaceAgentDevcontainer],
|
||||
warnings: ["This is a warning"],
|
||||
};
|
||||
|
Reference in New Issue
Block a user