1
+ import {
2
+ useAllLinodeConfigsQuery ,
3
+ useBootLinodeMutation ,
4
+ useRebootLinodeMutation ,
5
+ useShutdownLinodeMutation ,
6
+ } from '@linode/queries' ;
1
7
import { ActionsPanel , Autocomplete , Notice , Typography } from '@linode/ui' ;
2
8
import { useTheme } from '@mui/material/styles' ;
3
9
import * as React from 'react' ;
4
10
5
11
import { ConfirmationDialog } from 'src/components/ConfirmationDialog/ConfirmationDialog' ;
6
12
import { Link } from 'src/components/Link' ;
7
13
import { useEventsPollingActions } from 'src/queries/events/events' ;
8
- import {
9
- useAllLinodeConfigsQuery ,
10
- useBootLinodeMutation ,
11
- useRebootLinodeMutation ,
12
- useShutdownLinodeMutation ,
13
- } from '@linode/queries' ;
14
14
15
15
import type { Config } from '@linode/api-v4/lib/linodes' ;
16
16
17
17
export type Action = 'Power Off' | 'Power On' | 'Reboot' ;
18
18
19
19
interface Props {
20
20
action : Action ;
21
+ isFetching ?: boolean ;
21
22
isOpen : boolean ;
22
23
linodeId : number | undefined ;
23
24
linodeLabel ?: string | undefined ;
@@ -36,7 +37,7 @@ export const selectDefaultConfig = (configs?: Config[]) =>
36
37
configs ?. length === 1 ? configs [ 0 ] . id : undefined ;
37
38
38
39
export const PowerActionsDialog = ( props : Props ) => {
39
- const { action, isOpen, linodeId, linodeLabel, onClose } = props ;
40
+ const { action, isFetching , isOpen, linodeId, linodeLabel, onClose } = props ;
40
41
const theme = useTheme ( ) ;
41
42
42
43
const {
@@ -139,6 +140,7 @@ export const PowerActionsDialog = (props: Props) => {
139
140
/>
140
141
}
141
142
error = { error ?. [ 0 ] . reason }
143
+ isFetching = { isFetching }
142
144
onClose = { handleOnClose }
143
145
open = { isOpen }
144
146
title = { `${ action } Linode ${ linodeLabel ?? '' } ?` }
@@ -170,15 +172,15 @@ export const PowerActionsDialog = (props: Props) => {
170
172
autoHighlight
171
173
disablePortal = { false }
172
174
errorText = { configsError ?. [ 0 ] . reason }
175
+ helperText = "If no value is selected, the last booted config will be used."
173
176
label = "Config"
174
177
loading = { configsLoading }
175
178
onChange = { ( _ , option ) => setSelectConfigID ( option ?. value ?? null ) }
176
179
options = { configOptions }
177
- helperText = "If no value is selected, the last booted config will be used."
178
180
/>
179
181
) }
180
182
{ props . action === 'Power Off' && (
181
- < Notice variant = "warning" spacingBottom = { 0 } >
183
+ < Notice spacingBottom = { 0 } variant = "warning" >
182
184
< Typography >
183
185
< strong > Note: </ strong > Powered down Linodes will still accrue
184
186
charges. See the
0 commit comments