From fdcf5c14b22d3cd0bb02901898aa18e6f97b7fc4 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Wed, 21 Sep 2022 14:23:26 +0800 Subject: [PATCH] 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 --- .../actions/StepCreate/BaseStep/index.jsx | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/pages/compute/containers/Instance/actions/StepCreate/BaseStep/index.jsx b/src/pages/compute/containers/Instance/actions/StepCreate/BaseStep/index.jsx index b7d180f4..e6e396c5 100644 --- a/src/pages/compute/containers/Instance/actions/StepCreate/BaseStep/index.jsx +++ b/src/pages/compute/containers/Instance/actions/StepCreate/BaseStep/index.jsx @@ -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) => {