Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
65a84ac
bump API for boot disk changes
david-crespo Sep 22, 2024
c900406
implement instance update endpoint
david-crespo Sep 23, 2024
63aca05
show boot disk with badge in table
david-crespo Sep 23, 2024
2916de6
add row actions
david-crespo Sep 23, 2024
9b31e26
instance create works good
david-crespo Sep 23, 2024
108e6c2
point at the actual omicron PR
david-crespo Sep 23, 2024
0860ce8
split instance disks into two tables
david-crespo Sep 26, 2024
2280633
move the disk buttons into the table headers
david-crespo Sep 26, 2024
2eb1588
fix one our most pointless e2es
david-crespo Sep 26, 2024
4ef587b
assert about boot disks after instance create
david-crespo Sep 26, 2024
71834dc
add e2e test for instance create with more disks, test disk create
david-crespo Sep 26, 2024
38ea6e1
move the buttons back under the tables
david-crespo Sep 26, 2024
f493cb6
take the button out, always disable detach for boot disk
david-crespo Sep 27, 2024
f7d98d0
split frankenstein actions array into two, make e2e tests pass
david-crespo Sep 27, 2024
512f05f
update omicron to latest commit on PR, fix breakage thereby introduced
david-crespo Oct 1, 2024
6c393ea
mock update errors out if boot disk is not attached
david-crespo Oct 1, 2024
393ca9c
update to a commit on omicron main
david-crespo Oct 1, 2024
9f9b982
cite omicron source for logic about when you can set a boot disk
david-crespo Oct 1, 2024
541f95e
test for changing boot disk
david-crespo Oct 1, 2024
4536d50
ixi's feedback, clean up mock API logic
david-crespo Oct 1, 2024
2f41baf
moderately deranged boot disk empty state copy
david-crespo Oct 1, 2024
d73bba5
tweak empty state copy and assert about it in e2e test
david-crespo Oct 2, 2024
17e9a37
clean up copy TODOs in confirm modals
david-crespo Oct 2, 2024
fe3d078
bump API to latest dogfood version (only doc comment changes)
david-crespo Oct 3, 2024
fce35a9
rename disks to otherDisks, existing disk test looks at boot vs. other
david-crespo Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OMICRON_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d2e3f344e82fd7a1f45a39a9d1f867f9238d171d
c50cf019cd9be35f98266a7f4acacab0236b3a3d
84 changes: 80 additions & 4 deletions app/api/__generated__/Api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/api/__generated__/OMICRON_VERSION

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions app/api/__generated__/msw-handlers.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions app/api/__generated__/validate.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions app/api/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,25 @@ export const genName = (...parts: [string, ...string[]]) => {
}

const instanceActions: Record<string, InstanceState[]> = {
// NoVmm maps to to Stopped:
// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/db-model/src/instance_state.rs#L55

// https://github.com/oxidecomputer/omicron/blob/0496637/nexus/src/app/instance.rs#L2064
start: ['stopped', 'failed'],

// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/db-queries/src/db/datastore/instance.rs#L865
delete: ['stopped', 'failed'],

// https://github.com/oxidecomputer/omicron/blob/3093818/nexus/db-queries/src/db/datastore/instance.rs#L1030-L1043
update: ['stopped', 'failed', 'creating'],

// reboot and stop are kind of weird!
// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/src/app/instance.rs#L790-L798
// https://github.com/oxidecomputer/propolis/blob/b278193/bin/propolis-server/src/lib/vm/request_queue.rs
// https://github.com/oxidecomputer/console/pull/2387#discussion_r1722368236
reboot: ['running'], // technically rebooting allowed but too weird to say it
stop: ['running', 'starting', 'rebooting'],

// NoVmm maps to to Stopped:
// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/db-model/src/instance_state.rs#L55

// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/db-queries/src/db/datastore/disk.rs#L323-L327
detachDisk: ['creating', 'stopped', 'failed'],
// only Creating and NoVmm
Expand Down Expand Up @@ -148,6 +151,8 @@ const diskActions: Record<string, DiskState['state'][]> = {
attach: ['creating', 'detached'],
// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/db-queries/src/db/datastore/disk.rs#L313-L314
detach: ['attached'],
// https://github.com/oxidecomputer/omicron/blob/3093818/nexus/db-queries/src/db/datastore/instance.rs#L1077-L1081
setAsBootDisk: ['attached'],
}

export const diskCan = R.mapValues(diskActions, (states) => {
Expand Down
8 changes: 3 additions & 5 deletions app/components/form/fields/DisksTableField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { CreateDiskSideModalForm } from '~/forms/disk-create'
import type { InstanceCreateInput } from '~/forms/instance-create'
import { Badge } from '~/ui/lib/Badge'
import { Button } from '~/ui/lib/Button'
import { FieldLabel } from '~/ui/lib/FieldLabel'
import * as MiniTable from '~/ui/lib/MiniTable'
import { bytesToGiB } from '~/util/units'

Expand All @@ -39,14 +38,13 @@ export function DisksTableField({

const {
field: { value: items, onChange },
} = useController({ control, name: 'disks' })
} = useController({ control, name: 'otherDisks' })

return (
<>
<div className="max-w-lg">
<FieldLabel id="new-disks-label">{/* this was empty */}</FieldLabel>
{!!items.length && (
<MiniTable.Table className="mb-4">
<MiniTable.Table className="mb-4" aria-label="Disks">
<MiniTable.Header>
<MiniTable.HeadCell>Name</MiniTable.HeadCell>
<MiniTable.HeadCell>Type</MiniTable.HeadCell>
Expand All @@ -68,7 +66,7 @@ export function DisksTableField({
</MiniTable.Cell>
<MiniTable.Cell>
{item.type === 'attach' ? (
'-'
''
) : (
<>
<span>{bytesToGiB(item.size)}</span>
Expand Down
7 changes: 4 additions & 3 deletions app/forms/instance-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export type InstanceCreateInput = Assign<
SetRequired<InstanceCreate, 'networkInterfaces'>,
{
presetId: (typeof PRESETS)[number]['id']
disks: DiskTableItem[]
otherDisks: DiskTableItem[]
bootDiskName: string
bootDiskSize: number

Expand Down Expand Up @@ -139,7 +139,7 @@ const baseDefaultValues: InstanceCreateInput = {
projectImageSource: '',
diskSource: '',

disks: [],
otherDisks: [],
networkInterfaces: { type: 'default' },

sshPublicKeys: [],
Expand Down Expand Up @@ -317,7 +317,8 @@ export function CreateInstanceForm() {
description: values.description,
memory: instance.memory * GiB,
ncpus: instance.ncpus,
disks: [bootDisk, ...values.disks],
disks: values.otherDisks,
bootDisk,
externalIps: values.externalIps,
start: values.start,
networkInterfaces: values.networkInterfaces,
Expand Down
Loading