Skip to content

Commit b1dc605

Browse files
Cleanup
1 parent 61438c6 commit b1dc605

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

app/forms/disk-attach.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { useMemo } from 'react'
99
import { useForm } from 'react-hook-form'
1010

11-
import { useApiQuery, type ApiError, type Instance } from '@oxide/api'
11+
import { instanceCan, useApiQuery, type ApiError, type Instance } from '@oxide/api'
1212

1313
import { ComboboxField } from '~/components/form/fields/ComboboxField'
1414
import { ModalForm } from '~/components/form/ModalForm'
@@ -71,7 +71,7 @@ export function AttachDiskModalForm({
7171
onSubmit={onSubmit}
7272
width="medium"
7373
submitDisabled={
74-
instance.runState !== 'stopped' ? 'Instance must be stopped' : undefined
74+
!instanceCan.attachDisk(instance) ? 'Instance must be stopped' : undefined
7575
}
7676
>
7777
<StopInstancePrompt instance={instance}>

app/pages/project/instances/StorageTab.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -334,18 +334,7 @@ export default function StorageTab() {
334334

335335
<CardBlock>
336336
<CardBlock.Header title="Additional disks" titleId="other-disks-label">
337-
<Button
338-
variant="secondary"
339-
size="sm"
340-
onClick={() => setShowDiskAttach(true)}
341-
disabledReason={
342-
<>
343-
Instance must be <span className="text-raise">stopped</span> to attach a
344-
disk
345-
</>
346-
}
347-
disabled={!instanceCan.attachDisk(instance)}
348-
>
337+
<Button variant="secondary" size="sm" onClick={() => setShowDiskAttach(true)}>
349338
Attach existing disk
350339
</Button>
351340
<Button

0 commit comments

Comments
 (0)