fix: create instance by given image/instance snapshot

1. fix the image value check when create instance by a given image
2. fix the instance snapshot value check when create instance by a given instance snapshot
3. remove the useless instance snapshot request when create instance by a given bootable volume or a given image

Closes-Bug: #1990349
Change-Id: I4cee48bd9bb38ce6db1d59acc362d24d4af49b08
This commit is contained in:
Jingwei.Zhang 2022-09-21 14:23:26 +08:00
parent 06af9d6fd3
commit fdcf5c14b2

View File

@ -209,12 +209,6 @@ export class BaseStep extends Base {
} else {
await this.imageStore.fetchList({ all_projects: this.hasAdminRole });
}
if (image) {
this.updateFormValue('image', {
selectedRowKeys: [image],
selectedRows: this.images.filter((it) => it.id === image),
});
}
}
async getVolumeTypes() {
@ -244,27 +238,18 @@ export class BaseStep extends Base {
sortOrder: 'ascend',
});
}
if (volume) {
this.updateFormValue('volume', {
selectedRowKeys: [volume],
selectedRows: this.volumes.filter((it) => it.id === volume),
});
}
}
async getInstanceSnapshots() {
const { snapshot } = this.locationParams;
const { image, snapshot, volume } = this.locationParams;
if (image || volume) {
return;
}
if (!snapshot) {
this.instanceSnapshotStore.fetchList();
return;
}
await this.instanceSnapshotStore.fetchDetail({ id: snapshot });
if (snapshot) {
this.updateFormValue('instanceSnapshot', {
selectedRowKeys: [snapshot],
selectedRows: this.snapshots.filter((it) => it.id === snapshot),
});
}
}
onImageTabChange = (value) => {