Skip to content

Commit e45f2d9

Browse files
authored
Update copy regarding disk attach / detach requirements (#2207)
1 parent e8e4f57 commit e45f2d9

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

app/pages/project/instances/instance/tabs/StorageTab.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ const staticCols = [
6262
colHelper.accessor('timeCreated', Columns.timeCreated),
6363
]
6464

65-
const attachableStates = fancifyStates(instanceCan.attachDisk.states)
66-
const detachableStates = fancifyStates(instanceCan.detachDisk.states)
67-
6865
export function StorageTab() {
6966
const [showDiskCreate, setShowDiskCreate] = useState(false)
7067
const [showDiskAttach, setShowDiskAttach] = useState(false)
@@ -128,7 +125,10 @@ export function StorageTab() {
128125
{
129126
label: 'Detach',
130127
disabled: !instanceCan.detachDisk(instance) && (
131-
<>Instance must be in state {detachableStates} before disk can be detached</>
128+
<>
129+
Instance must be <span className="text-default">stopped</span> before disk can
130+
be detached
131+
</>
132132
),
133133
onActivate() {
134134
detachDisk.mutate({ body: { disk: disk.name }, ...instancePathQuery })
@@ -174,7 +174,12 @@ export function StorageTab() {
174174
<Button
175175
size="sm"
176176
onClick={() => setShowDiskCreate(true)}
177-
disabledReason={<>Instance must be {attachableStates} to create a disk</>}
177+
disabledReason={
178+
<>
179+
Instance must be <span className="text-default">stopped</span> to create and
180+
attach a disk
181+
</>
182+
}
178183
disabled={!instanceCan.attachDisk(instance)}
179184
>
180185
Create new disk
@@ -183,15 +188,21 @@ export function StorageTab() {
183188
variant="secondary"
184189
size="sm"
185190
onClick={() => setShowDiskAttach(true)}
186-
disabledReason={<>Instance must be {attachableStates} to attach a disk</>}
191+
disabledReason={
192+
<>
193+
Instance must be <span className="text-default">stopped</span> to attach a
194+
disk
195+
</>
196+
}
187197
disabled={!instanceCan.attachDisk(instance)}
188198
>
189199
Attach existing disk
190200
</Button>
191201
</div>
192202
{!instanceCan.attachDisk(instance) && (
193203
<span className="max-w-xs text-sans-md text-tertiary">
194-
A disk cannot be added or attached unless the instance is {attachableStates}.
204+
The instance must be <span className="text-default">stopped</span> to add or
205+
attach a disk.
195206
</span>
196207
)}
197208
</div>

test/e2e/instance-disks.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import {
1818
test('Attach disk', async ({ page }) => {
1919
await page.goto('/projects/mock-project/instances/db1')
2020

21-
const warning =
22-
'A disk cannot be added or attached unless the instance is creating or stopped.'
21+
const warning = 'The instance must be stopped to add or attach a disk.'
2322
await expect(page.getByText(warning)).toBeVisible()
2423

2524
const row = page.getByRole('row', { name: 'disk-1', exact: false })
@@ -30,7 +29,7 @@ test('Attach disk', async ({ page }) => {
3029
await expect(page.getByRole('menuitem', { name: 'Detach' })).toBeDisabled()
3130
await page.getByRole('menuitem', { name: 'Detach' }).hover()
3231
await expect(
33-
page.getByText('Instance must be in state creating, stopped, or failed')
32+
page.getByText('Instance must be stopped before disk can be detached')
3433
).toBeVisible()
3534
await page.keyboard.press('Escape') // close menu
3635

0 commit comments

Comments
 (0)