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