@@ -35,6 +35,9 @@ import TextField from "@mui/material/TextField";
35
35
import SensorsIcon from "@mui/icons-material/Sensors" ;
36
36
import LockIcon from "@mui/icons-material/Lock" ;
37
37
import LockOpenIcon from "@mui/icons-material/LockOpen" ;
38
+ import IconButton from "@mui/material/IconButton" ;
39
+ import CloseIcon from "@mui/icons-material/Close" ;
40
+ import Grid from "@mui/material/Grid" ;
38
41
39
42
export interface PortForwardButtonProps {
40
43
host : string ;
@@ -215,8 +218,8 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
215
218
< Stack
216
219
key = { port . port }
217
220
direction = "row"
218
- justifyContent = "space-between"
219
221
alignItems = "center"
222
+ justifyContent = "space-between"
220
223
>
221
224
< Link
222
225
underline = "none"
@@ -228,6 +231,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
228
231
< SensorsIcon css = { { width : 14 , height : 14 } } />
229
232
{ label }
230
233
</ Link >
234
+ < Stack direction = "row" gap = { 2 } justifyContent = "flex-end" alignItems = "center" >
231
235
< Link
232
236
underline = "none"
233
237
css = { styles . portLink }
@@ -240,6 +244,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
240
244
< Button size = "small" variant = "text" >
241
245
Share
242
246
</ Button >
247
+ </ Stack >
243
248
</ Stack >
244
249
) ;
245
250
} ) }
@@ -252,9 +257,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
252
257
>
253
258
< HelpTooltipTitle > Shared Ports</ HelpTooltipTitle >
254
259
< HelpTooltipText css = { { color : theme . palette . text . secondary } } >
255
- { listeningPorts ?. length === 0
256
- ? "No ports are shared."
257
- : "Ports can be shared with other Coder users or with the public." }
260
+ Ports can be shared with other Coder users or with the public.
258
261
</ HelpTooltipText >
259
262
< div >
260
263
{ sharedPorts ?. map ( ( share ) => {
@@ -287,27 +290,36 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
287
290
) }
288
291
{ label }
289
292
</ Link >
290
- < Stack direction = "row" gap = { 1 } >
291
- < FormControl size = "small" >
292
- < Select
293
- sx = { {
294
- boxShadow : "none" ,
295
- ".MuiOutlinedInput-notchedOutline" : { border : 0 } ,
296
- "&.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline" :
297
- {
298
- border : 0 ,
299
- } ,
300
- "&.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline" :
301
- {
302
- border : 0 ,
303
- } ,
304
- } }
305
- value = { share . share_level }
306
- >
307
- < MenuItem value = "Authenticated" > Authenticated</ MenuItem >
308
- < MenuItem value = "Public" > Public</ MenuItem >
309
- </ Select >
310
- </ FormControl >
293
+ < Stack direction = "row" justifyContent = "flex-end" >
294
+ < FormControl size = "small" >
295
+ < Select
296
+ sx = { {
297
+ boxShadow : "none" ,
298
+ ".MuiOutlinedInput-notchedOutline" : { border : 0 } ,
299
+ "&.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline" :
300
+ {
301
+ border : 0 ,
302
+ } ,
303
+ "&.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline" :
304
+ {
305
+ border : 0 ,
306
+ } ,
307
+ } }
308
+ value = { share . share_level }
309
+ >
310
+ < MenuItem value = "authenticated" > Authenticated</ MenuItem >
311
+ < MenuItem value = "public" > Public</ MenuItem >
312
+ </ Select >
313
+ </ FormControl >
314
+ < IconButton >
315
+ < CloseIcon
316
+ css = { {
317
+ width : 14 ,
318
+ height : 14 ,
319
+ color : theme . palette . text . primary ,
320
+ } }
321
+ />
322
+ </ IconButton >
311
323
</ Stack >
312
324
</ Stack >
313
325
) ;
@@ -328,69 +340,9 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
328
340
< MenuItem value = "Public" > Public</ MenuItem >
329
341
</ Select >
330
342
</ FormControl >
331
- < Button variant = "contained" > Add Shared Port</ Button >
343
+ < Button variant = "contained" > Share Port</ Button >
332
344
</ Stack >
333
345
</ div >
334
-
335
- { /* <div css={{ padding: 20 }}>
336
- <HelpTooltipTitle>Forward port</HelpTooltipTitle>
337
- <HelpTooltipText css={{ color: theme.palette.text.secondary }}>
338
- Access ports running on the agent:
339
- </HelpTooltipText>
340
-
341
- <form
342
- css={styles.newPortForm}
343
- onSubmit={(e) => {
344
- e.preventDefault();
345
- const formData = new FormData(e.currentTarget);
346
- const port = Number(formData.get("portNumber"));
347
- const url = portForwardURL(
348
- host,
349
- port,
350
- agent.name,
351
- workspaceName,
352
- username,
353
- );
354
- window.open(url, "_blank");
355
- }}
356
- >
357
- <input
358
- aria-label="Port number"
359
- name="portNumber"
360
- type="number"
361
- placeholder="Type a port number..."
362
- min={0}
363
- max={65535}
364
- required
365
- css={styles.newPortInput}
366
- />
367
- <Button
368
- type="submit"
369
- size="small"
370
- variant="text"
371
- css={{
372
- paddingLeft: 12,
373
- paddingRight: 12,
374
- minWidth: 0,
375
- }}
376
- >
377
- <OpenInNewOutlined
378
- css={{
379
- flexShrink: 0,
380
- width: 14,
381
- height: 14,
382
- color: theme.palette.text.primary,
383
- }}
384
- />
385
- </Button>
386
- </form>
387
-
388
- <HelpTooltipLinksGroup>
389
- <HelpTooltipLink href={docs("/networking/port-forwarding#dashboard")}>
390
- Learn more
391
- </HelpTooltipLink>
392
- </HelpTooltipLinksGroup>
393
- </div> */ }
394
346
</ >
395
347
) ;
396
348
} ;
0 commit comments