@@ -45,6 +45,7 @@ import {
4545 useInstanceSelector ,
4646 useProjectSelector ,
4747} from '~/hooks/use-params'
48+ import { useQuickActions } from '~/hooks/use-quick-actions'
4849import { confirmAction } from '~/stores/confirm-action'
4950import { confirmDelete } from '~/stores/confirm-delete'
5051import { addToast } from '~/stores/toast'
@@ -636,6 +637,53 @@ export default function NetworkingTab() {
636637 const subnetDisabledReason =
637638 availableSubnets . length === 0 ? 'No available external subnets' : null
638639
640+ useQuickActions (
641+ ( ) => [
642+ ...( ! ephemeralDisabledReason
643+ ? [
644+ {
645+ value : 'Attach ephemeral IP' ,
646+ navGroup : 'Actions' ,
647+ action : ( ) => setAttachEphemeralModalOpen ( true ) ,
648+ } ,
649+ ]
650+ : [ ] ) ,
651+ ...( ! floatingDisabledReason
652+ ? [
653+ {
654+ value : 'Attach floating IP' ,
655+ navGroup : 'Actions' ,
656+ action : ( ) => setAttachFloatingModalOpen ( true ) ,
657+ } ,
658+ ]
659+ : [ ] ) ,
660+ ...( instanceCan . updateNic ( { runState : instance . runState } )
661+ ? [
662+ {
663+ value : 'Add network interface' ,
664+ navGroup : 'Actions' ,
665+ action : ( ) => setCreateModalOpen ( true ) ,
666+ } ,
667+ ]
668+ : [ ] ) ,
669+ ...( ! subnetDisabledReason
670+ ? [
671+ {
672+ value : 'Attach external subnet' ,
673+ navGroup : 'Actions' ,
674+ action : ( ) => setAttachSubnetModalOpen ( true ) ,
675+ } ,
676+ ]
677+ : [ ] ) ,
678+ ] ,
679+ [
680+ ephemeralDisabledReason ,
681+ floatingDisabledReason ,
682+ instance . runState ,
683+ subnetDisabledReason ,
684+ ]
685+ )
686+
639687 return (
640688 < div className = "space-y-5" >
641689 < CardBlock >
0 commit comments