66 * Copyright Oxide Computer Company
77 */
88import { useCallback } from 'react'
9+ import { useNavigate } from 'react-router-dom'
910
1011import { instanceCan , useApiMutation , type Instance } from '@oxide/api'
1112
1213import { HL } from '~/components/HL'
1314import { confirmAction } from '~/stores/confirm-action'
1415import { confirmDelete } from '~/stores/confirm-delete'
1516import { addToast } from '~/stores/toast'
17+ import { pb } from '~/util/path-builder'
1618
1719import { fancifyStates } from './instance/tabs/common'
1820
@@ -114,6 +116,7 @@ export const useMakeInstanceActions = (
114116 [ project , startInstanceAsync , stopInstanceAsync ]
115117 )
116118
119+ const navigate = useNavigate ( )
117120 const makeMenuActions = useCallback (
118121 ( instance : Instance ) => {
119122 const instanceParams = { path : { instance : instance . name } , query : { project } }
@@ -148,6 +151,12 @@ export const useMakeInstanceActions = (
148151 < > Only { fancifyStates ( instanceCan . update . states ) } instances can be resized</ >
149152 ) ,
150153 } ,
154+ {
155+ label : 'View serial console' ,
156+ onActivate ( ) {
157+ navigate ( pb . serialConsole ( { project, instance : instance . name } ) )
158+ } ,
159+ } ,
151160 {
152161 label : 'Delete' ,
153162 onActivate : confirmDelete ( {
@@ -170,7 +179,7 @@ export const useMakeInstanceActions = (
170179 // Do not put `options` in here, refer to the property. options is not ref
171180 // stable. Extra renders here cause the row actions menu to close when it
172181 // shouldn't, like during polling on instance list.
173- [ project , deleteInstanceAsync , rebootInstanceAsync , onResizeClick ]
182+ [ project , deleteInstanceAsync , rebootInstanceAsync , onResizeClick , navigate ]
174183 )
175184
176185 return { makeButtonActions, makeMenuActions }
0 commit comments