Skip to content

Commit 934254c

Browse files
committed
update API again for non-optional instance update keys
1 parent 60ca75e commit 934254c

File tree

9 files changed

+17
-24
lines changed

9 files changed

+17
-24
lines changed

OMICRON_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2d7479e297966b9fd486459d5865e8d958a78022
1+
af4a78e9cfcfeda9cf99156744c0efb913a9c1f8

app/api/__generated__/Api.ts

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/api/__generated__/OMICRON_VERSION

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/api/__generated__/validate.ts

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/api/util.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type {
1515
DiskState,
1616
Instance,
1717
InstanceState,
18-
InstanceUpdate,
1918
Measurement,
2019
SiloUtilization,
2120
Sled,
@@ -282,5 +281,3 @@ export function synthesizeData(
282281
}
283282

284283
export const OXQL_GROUP_BY_ERROR = 'Input tables to a `group_by` must be aligned'
285-
286-
export const instanceUpdateBody = (body: Required<InstanceUpdate>): InstanceUpdate => body

app/pages/project/instances/AutoRestartCard.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
useApiMutation,
1818
usePrefetchedApiQuery,
1919
} from '~/api'
20-
import { instanceUpdateBody } from '~/api/util'
2120
import { ListboxField } from '~/components/form/fields/ListboxField'
2221
import { useInstanceSelector } from '~/hooks/use-params'
2322
import { addToast } from '~/stores/toast'
@@ -76,7 +75,7 @@ export function AutoRestartCard() {
7675
instanceUpdate.mutate({
7776
path: { instance: instanceSelector.instance },
7877
query: { project: instanceSelector.project },
79-
body: instanceUpdateBody({
78+
body: {
8079
autoRestartPolicy: match(values.autoRestartPolicy)
8180
.with('default', () => null)
8281
.with('never', () => 'never' as const)
@@ -87,7 +86,7 @@ export function AutoRestartCard() {
8786
// optional ones would be unset if we left them out
8887
cpuPlatform: instance.cpuPlatform || null,
8988
bootDisk: instance.bootDiskId || null,
90-
}),
89+
},
9190
})
9291
})
9392

app/pages/project/instances/InstancePage.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
instanceAutoRestartingSoon,
2727
instanceCan,
2828
instanceTransitioning,
29-
instanceUpdateBody,
3029
} from '~/api/util'
3130
import { CopyIdItem } from '~/components/CopyIdItem'
3231
import { ExternalIps } from '~/components/ExternalIps'
@@ -342,14 +341,14 @@ export function ResizeInstanceModal({
342341
instanceUpdate.mutate({
343342
path: { instance: instance.name },
344343
query: { project },
345-
body: instanceUpdateBody({
344+
body: {
346345
ncpus,
347346
memory: memory * GiB,
348347
// these need to be passed in or they'll be unset
349348
bootDisk: instance.bootDiskId || null,
350349
cpuPlatform: instance.cpuPlatform || null,
351350
autoRestartPolicy: instance.autoRestartPolicy || null,
352-
}),
351+
},
353352
})
354353
})
355354
const formId = useId()

app/pages/project/instances/StorageTab.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
} from '@oxide/api'
2424
import { Storage24Icon } from '@oxide/design-system/icons/react'
2525

26-
import { instanceUpdateBody } from '~/api/util'
2726
import { HL } from '~/components/HL'
2827
import { DiskStateBadge } from '~/components/StateBadge'
2928
import { AttachDiskModalForm } from '~/forms/disk-attach'
@@ -164,14 +163,14 @@ export default function StorageTab() {
164163
doAction: () =>
165164
instanceUpdate({
166165
path: { instance: instance.id },
167-
body: instanceUpdateBody({
166+
body: {
168167
bootDisk: null,
169168
ncpus: instance.ncpus,
170169
memory: instance.memory,
171170
// optional ones would be unset if we left them out
172171
autoRestartPolicy: instance.autoRestartPolicy || null,
173172
cpuPlatform: instance.cpuPlatform || null,
174-
}),
173+
},
175174
}),
176175
errorTitle: 'Could not unset boot disk',
177176
modalTitle: 'Confirm unset boot disk',
@@ -230,14 +229,14 @@ export default function StorageTab() {
230229
doAction: () =>
231230
instanceUpdate({
232231
path: { instance: instance.id },
233-
body: instanceUpdateBody({
232+
body: {
234233
bootDisk: disk.id,
235234
ncpus: instance.ncpus,
236235
memory: instance.memory,
237236
// optional ones would be unset if we left them out
238237
autoRestartPolicy: instance.autoRestartPolicy || null,
239238
cpuPlatform: instance.cpuPlatform || null,
240-
}),
239+
},
241240
}),
242241
errorTitle: `Could not ${verb} boot disk`,
243242
modalTitle: `Confirm ${verb} boot disk`,

mock-api/msw/handlers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,6 @@ export const handlers = makeHandlers({
652652

653653
// https://github.com/oxidecomputer/omicron/blob/0c6ab099e/nexus/db-queries/src/db/datastore/instance.rs#L228-L239
654654
instance.auto_restart_enabled = match(instance.auto_restart_policy)
655-
.with(undefined, () => true)
656655
.with(null, () => true)
657656
.with('best_effort', () => true)
658657
.with('never', () => false)

0 commit comments

Comments
 (0)