Skip to content

Commit 9247255

Browse files
authored
chore: update API for instance resize without adding instance resize UI (#2562)
update API for instance resize without adding instance resize UI
1 parent 9b60d5c commit 9247255

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

OMICRON_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
33bbad374205a8fcf3d23d8d4c218cfaf74b1e15
1+
9c8aa5372fede528bff8e69fd88cabda0e92fac4

app/api/__generated__/Api.ts

Lines changed: 6 additions & 2 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: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ export function Component() {
146146
[disks.items, instance.bootDiskId]
147147
)
148148

149+
// Needed to keep them the same while setting boot disk.
150+
// Extracted to keep dep array appropriately zealous.
151+
const { ncpus, memory } = instance
152+
149153
const makeBootDiskActions = useCallback(
150154
(disk: InstanceDisk): MenuAction[] => [
151155
getSnapshotAction(disk),
@@ -164,6 +168,8 @@ export function Component() {
164168
path: { instance: instance.id },
165169
body: {
166170
bootDisk: undefined,
171+
ncpus,
172+
memory,
167173
// this would get unset if we left it out
168174
autoRestartPolicy: instance.autoRestartPolicy,
169175
},
@@ -194,7 +200,7 @@ export function Component() {
194200
onActivate() {}, // it's always disabled, so noop is ok
195201
},
196202
],
197-
[instanceUpdate, instance, getSnapshotAction]
203+
[instanceUpdate, instance, getSnapshotAction, ncpus, memory]
198204
)
199205

200206
const makeOtherDiskActions = useCallback(
@@ -217,6 +223,8 @@ export function Component() {
217223
path: { instance: instance.id },
218224
body: {
219225
bootDisk: disk.id,
226+
ncpus,
227+
memory,
220228
// this would get unset if we left it out
221229
autoRestartPolicy: instance.autoRestartPolicy,
222230
},
@@ -254,7 +262,7 @@ export function Component() {
254262
},
255263
},
256264
],
257-
[detachDisk, instanceUpdate, instance, getSnapshotAction, bootDisks]
265+
[detachDisk, instanceUpdate, instance, getSnapshotAction, bootDisks, ncpus, memory]
258266
)
259267

260268
const attachDisk = useApiMutation('instanceDiskAttach', {

mock-api/msw/handlers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,10 @@ export const handlers = makeHandlers({
613613
instance.boot_disk_id = undefined
614614
}
615615

616+
// always present on the body, always set them
617+
instance.ncpus = body.ncpus
618+
instance.memory = body.memory
619+
616620
return instance
617621
},
618622
instanceDelete({ path, query }) {

0 commit comments

Comments
 (0)