@@ -44,10 +44,11 @@ import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
44
44
import { Columns } from '~/table/columns/common'
45
45
import { Table } from '~/table/Table'
46
46
import { Badge } from '~/ui/lib/Badge'
47
+ import { Button } from '~/ui/lib/Button'
48
+ import { CardBlock } from '~/ui/lib/CardBlock'
47
49
import { CopyableIp } from '~/ui/lib/CopyableIp'
48
- import { CreateButton } from '~/ui/lib/CreateButton'
49
50
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
50
- import { TableControls , TableEmptyBox , TableTitle } from '~/ui/lib/Table'
51
+ import { TableEmptyBox } from '~/ui/lib/Table'
51
52
import { TipIcon } from '~/ui/lib/TipIcon'
52
53
import { ALL_ISH } from '~/util/consts'
53
54
import { pb } from '~/util/path-builder'
@@ -390,28 +391,49 @@ export default function NetworkingTab() {
390
391
: null
391
392
392
393
return (
393
- < >
394
- < TableControls >
395
- < TableTitle id = "attached-ips-label" > External IPs</ TableTitle >
396
- < div className = "flex gap-3" >
397
- { /*
398
- We normally wouldn't hide this button and would just have a disabled state on it,
399
- but it is very rare for this button to be necessary, and it would be disabled
400
- most of the time, for most users. To reduce clutter on the screen, we're hiding it.
401
- */ }
402
- { enableEphemeralAttachButton && (
403
- < CreateButton onClick = { ( ) => setAttachEphemeralModalOpen ( true ) } >
404
- Attach ephemeral IP
405
- </ CreateButton >
394
+ < div className = "space-y-5" >
395
+ < CardBlock >
396
+ < CardBlock . Header title = "External IPs" titleId = "attached-ips-label" >
397
+ < div className = "flex gap-3" >
398
+ { /*
399
+ We normally wouldn't hide this button and would just have a disabled state on it,
400
+ but it is very rare for this button to be necessary, and it would be disabled
401
+ most of the time, for most users. To reduce clutter on the screen, we're hiding it.
402
+ */ }
403
+ { enableEphemeralAttachButton && (
404
+ < Button size = "sm" onClick = { ( ) => setAttachEphemeralModalOpen ( true ) } >
405
+ Attach ephemeral IP
406
+ </ Button >
407
+ ) }
408
+ < Button
409
+ size = "sm"
410
+ onClick = { ( ) => setAttachFloatingModalOpen ( true ) }
411
+ disabled = { ! ! floatingDisabledReason }
412
+ disabledReason = { floatingDisabledReason }
413
+ >
414
+ Attach floating IP
415
+ </ Button >
416
+ </ div >
417
+ </ CardBlock . Header >
418
+
419
+ < CardBlock . Body >
420
+ { eips . items . length > 0 ? (
421
+ < Table
422
+ aria-labelledby = "attached-ips-label"
423
+ table = { ipTableInstance }
424
+ className = "table-inline"
425
+ />
426
+ ) : (
427
+ < TableEmptyBox border = { false } >
428
+ < EmptyMessage
429
+ icon = { < IpGlobal24Icon /> }
430
+ title = "No external IPs"
431
+ body = "Attach an external IP to see it here"
432
+ />
433
+ </ TableEmptyBox >
406
434
) }
407
- < CreateButton
408
- onClick = { ( ) => setAttachFloatingModalOpen ( true ) }
409
- disabled = { ! ! floatingDisabledReason }
410
- disabledReason = { floatingDisabledReason }
411
- >
412
- Attach floating IP
413
- </ CreateButton >
414
- </ div >
435
+ </ CardBlock . Body >
436
+
415
437
{ attachEphemeralModalOpen && (
416
438
< AttachEphemeralIpModal onDismiss = { ( ) => setAttachEphemeralModalOpen ( false ) } />
417
439
) }
@@ -422,56 +444,55 @@ export default function NetworkingTab() {
422
444
onDismiss = { ( ) => setAttachFloatingModalOpen ( false ) }
423
445
/>
424
446
) }
425
- </ TableControls >
426
- { eips . items . length > 0 ? (
427
- < Table aria-labelledby = "attached-ips-label" table = { ipTableInstance } />
428
- ) : (
429
- < TableEmptyBox >
430
- < EmptyMessage
431
- icon = { < IpGlobal24Icon /> }
432
- title = "No external IPs"
433
- body = "Attach an external IP to see it here"
434
- />
435
- </ TableEmptyBox >
436
- ) }
437
-
438
- < TableControls className = "mt-8" >
439
- < TableTitle id = "nics-label" > Network interfaces</ TableTitle >
440
- < CreateButton
441
- onClick = { ( ) => setCreateModalOpen ( true ) }
442
- disabled = { ! instanceCan . updateNic ( instance ) }
443
- disabledReason = {
444
- < >
445
- A network interface cannot be created or edited unless the instance is{ ' ' }
446
- { updateNicStates } .
447
- </ >
448
- }
449
- >
450
- Add network interface
451
- </ CreateButton >
447
+ </ CardBlock >
448
+
449
+ < CardBlock >
450
+ < CardBlock . Header title = "Network interfaces" titleId = "nics-label" >
451
+ < Button
452
+ size = "sm"
453
+ onClick = { ( ) => setCreateModalOpen ( true ) }
454
+ disabled = { ! instanceCan . updateNic ( instance ) }
455
+ disabledReason = {
456
+ < >
457
+ A network interface cannot be created or edited unless the instance is{ ' ' }
458
+ { updateNicStates } .
459
+ </ >
460
+ }
461
+ >
462
+ Add network interface
463
+ </ Button >
464
+ </ CardBlock . Header >
465
+
466
+ < CardBlock . Body >
467
+ { nics . length > 0 ? (
468
+ < Table
469
+ aria-labelledby = "nics-label"
470
+ table = { tableInstance }
471
+ className = "table-inline"
472
+ />
473
+ ) : (
474
+ < TableEmptyBox border = { false } >
475
+ < EmptyMessage
476
+ icon = { < Networking24Icon /> }
477
+ title = "No network interfaces"
478
+ body = "Create a network interface to see it here"
479
+ />
480
+ </ TableEmptyBox >
481
+ ) }
482
+ </ CardBlock . Body >
483
+
452
484
{ createModalOpen && (
453
485
< CreateNetworkInterfaceForm
454
486
onDismiss = { ( ) => setCreateModalOpen ( false ) }
455
487
onSubmit = { ( body ) => createNic . mutate ( { query : instanceSelector , body } ) }
456
488
submitError = { createNic . error }
457
489
/>
458
490
) }
459
- </ TableControls >
460
- { nics . length > 0 ? (
461
- < Table aria-labelledby = "nics-label" table = { tableInstance } />
462
- ) : (
463
- < TableEmptyBox >
464
- < EmptyMessage
465
- icon = { < Networking24Icon /> }
466
- title = "No network interfaces"
467
- body = "Create a network interface to see it here"
468
- />
469
- </ TableEmptyBox >
470
- ) }
471
491
472
- { editing && (
473
- < EditNetworkInterfaceForm editing = { editing } onDismiss = { ( ) => setEditing ( null ) } />
474
- ) }
475
- </ >
492
+ { editing && (
493
+ < EditNetworkInterfaceForm editing = { editing } onDismiss = { ( ) => setEditing ( null ) } />
494
+ ) }
495
+ </ CardBlock >
496
+ </ div >
476
497
)
477
498
}
0 commit comments