File tree 4 files changed +49
-47
lines changed
4 files changed +49
-47
lines changed Original file line number Diff line number Diff line change @@ -1173,10 +1173,12 @@ func TestWorkspaceAgentContainers(t *testing.T) {
1173
1173
Labels : testLabels ,
1174
1174
Running : true ,
1175
1175
Status : "running" ,
1176
- Ports : []codersdk.WorkspaceAgentListeningPort {
1176
+ Ports : []codersdk.WorkspaceAgentDevcontainerPort {
1177
1177
{
1178
- Network : "tcp" ,
1179
- Port : 80 ,
1178
+ Network : "tcp" ,
1179
+ Port : 80 ,
1180
+ HostIP : "0.0.0.0" ,
1181
+ HostPort : 8000 ,
1180
1182
},
1181
1183
},
1182
1184
Volumes : map [string ]string {
Original file line number Diff line number Diff line change 1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
- import { AgentDevcontainerCard } from "./AgentDevcontainerCard" ;
3
2
import {
4
3
MockWorkspace ,
5
4
MockWorkspaceAgentDevcontainer ,
6
5
MockWorkspaceAgentDevcontainerPorts ,
7
6
} from "testHelpers/entities" ;
7
+ import { AgentDevcontainerCard } from "./AgentDevcontainerCard" ;
8
8
9
9
const meta : Meta < typeof AgentDevcontainerCard > = {
10
10
title : "modules/resources/AgentDevcontainerCard" ,
Original file line number Diff line number Diff line change 1
1
import Link from "@mui/material/Link" ;
2
+ import Tooltip , { type TooltipProps } from "@mui/material/Tooltip" ;
2
3
import type {
3
4
Workspace ,
4
5
WorkspaceAgentDevcontainer ,
@@ -10,7 +11,6 @@ import { portForwardURL } from "utils/portForward";
10
11
import { AgentButton } from "./AgentButton" ;
11
12
import { AgentDevcontainerSSHButton } from "./SSHButton/SSHButton" ;
12
13
import { TerminalLink } from "./TerminalLink/TerminalLink" ;
13
- import Tooltip , { type TooltipProps } from "@mui/material/Tooltip" ;
14
14
15
15
type AgentDevcontainerCardProps = {
16
16
container : WorkspaceAgentDevcontainer ;
@@ -52,13 +52,13 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
52
52
/>
53
53
{ wildcardHostname !== "" &&
54
54
container . ports . map ( ( port ) => {
55
- let portLabel = `${ port . port } /${ port . network . toUpperCase ( ) } ` ;
56
- let hasHostBind =
55
+ const portLabel = `${ port . port } /${ port . network . toUpperCase ( ) } ` ;
56
+ const hasHostBind =
57
57
port . host_port !== undefined &&
58
58
port . host_port !== null &&
59
59
port . host_ip !== undefined &&
60
60
port . host_ip !== null ;
61
- let helperText = hasHostBind
61
+ const helperText = hasHostBind
62
62
? `${ port . host_ip } :${ port . host_port } `
63
63
: "Not bound to host" ;
64
64
return (
Original file line number Diff line number Diff line change @@ -4273,45 +4273,45 @@ function mockTwoDaysAgo() {
4273
4273
return date . toISOString ( ) ;
4274
4274
}
4275
4275
4276
- export const MockWorkspaceAgentDevcontainerPorts : TypesGen . WorkspaceAgentDevcontainerPort [ ] = [
4277
- {
4278
- port : 1000 ,
4279
- network : "tcp" ,
4280
- host_port : 1000 ,
4281
- host_ip : "0.0.0.0"
4282
- } ,
4283
- {
4284
- port : 2001 ,
4285
- network : "tcp" ,
4286
- host_port : 2000 ,
4287
- host_ip : "::1"
4288
- } ,
4276
+ export const MockWorkspaceAgentDevcontainerPorts : TypesGen . WorkspaceAgentDevcontainerPort [ ] =
4277
+ [
4278
+ {
4279
+ port : 1000 ,
4280
+ network : "tcp" ,
4281
+ host_port : 1000 ,
4282
+ host_ip : "0.0.0.0" ,
4283
+ } ,
4284
+ {
4285
+ port : 2001 ,
4286
+ network : "tcp" ,
4287
+ host_port : 2000 ,
4288
+ host_ip : "::1" ,
4289
+ } ,
4290
+ {
4291
+ port : 8888 ,
4292
+ network : "tcp" ,
4293
+ } ,
4294
+ ] ;
4295
+
4296
+ export const MockWorkspaceAgentDevcontainer : TypesGen . WorkspaceAgentDevcontainer =
4289
4297
{
4290
- port : 8888 ,
4291
- network : "tcp" ,
4292
- }
4293
- ]
4294
-
4295
- export const MockWorkspaceAgentDevcontainer : TypesGen . WorkspaceAgentDevcontainer = {
4296
- created_at : "2024-01-04T15:53:03.21563Z" ,
4297
- id : "abcd1234" ,
4298
- name : "container-1" ,
4299
- image : "ubuntu:latest" ,
4300
- labels : {
4301
- "foo" : "bar"
4302
- } ,
4303
- ports : [ ] ,
4304
- running : true ,
4305
- status : "running" ,
4306
- volumes : {
4307
- "/mnt/volume1" : "/volume1" ,
4308
- }
4309
- }
4298
+ created_at : "2024-01-04T15:53:03.21563Z" ,
4299
+ id : "abcd1234" ,
4300
+ name : "container-1" ,
4301
+ image : "ubuntu:latest" ,
4302
+ labels : {
4303
+ foo : "bar" ,
4304
+ } ,
4305
+ ports : [ ] ,
4306
+ running : true ,
4307
+ status : "running" ,
4308
+ volumes : {
4309
+ "/mnt/volume1" : "/volume1" ,
4310
+ } ,
4311
+ } ;
4310
4312
4311
4313
export const MockWorkspaceAgentListContainersResponse : TypesGen . WorkspaceAgentListContainersResponse =
4312
- {
4313
- containers : [
4314
- MockWorkspaceAgentDevcontainer ,
4315
- ] ,
4316
- "warnings" : [ "This is a warning" ] ,
4317
- }
4314
+ {
4315
+ containers : [ MockWorkspaceAgentDevcontainer ] ,
4316
+ warnings : [ "This is a warning" ] ,
4317
+ } ;
You can’t perform that action at this time.
0 commit comments