From df67bd758fed1bcc68bc24873d43998c6630564d Mon Sep 17 00:00:00 2001 From: xusongfu Date: Thu, 7 Jul 2022 20:47:04 +0800 Subject: [PATCH] fix: fix create zun container 1. Optimization parameters 2. Use select-table for image 3. Fix ZunVolume component Change-Id: Ic8ce3fb91fd70848766003fe24d782b3347e055b --- src/client/client/constants.js | 2 +- src/components/FormItem/ZunVolume/index.jsx | 60 +++---- src/locales/en.json | 12 +- src/locales/zh.json | 14 +- .../actions/StepCreate/StepInfo/index.jsx | 59 ++++++- .../StepCreate/StepMiscellaneous/index.jsx | 10 +- .../actions/StepCreate/StepNetworks/index.jsx | 54 ++++-- .../actions/StepCreate/StepSpec/index.jsx | 38 ++-- .../actions/StepCreate/StepVolumes/index.jsx | 22 +-- .../Containers/actions/StepCreate/index.jsx | 164 ++++++++++-------- 10 files changed, 263 insertions(+), 172 deletions(-) diff --git a/src/client/client/constants.js b/src/client/client/constants.js index be280ed4..5f9da290 100644 --- a/src/client/client/constants.js +++ b/src/client/client/constants.js @@ -111,7 +111,7 @@ export const apiVersionMaps = { }, zun: { key: 'OpenStack-API-Version', - value: 'container 1.7', + value: 'container 1.11', }, }; diff --git a/src/components/FormItem/ZunVolume/index.jsx b/src/components/FormItem/ZunVolume/index.jsx index 3a6e5796..1be5cdbe 100644 --- a/src/components/FormItem/ZunVolume/index.jsx +++ b/src/components/FormItem/ZunVolume/index.jsx @@ -27,28 +27,28 @@ export default class ZunVolume extends React.Component { constructor(props) { super(props); this.state = { - type: [], - source: [], + type: '', + source: '', destination: '', - cinderVolumeSize: 0, - isCinderVolume: false, + size: 0, + isNewVolume: false, }; } static getDerivedStateFromProps(nextProps, prevState) { - const { type, source, cinderVolumeSize, destination } = - nextProps.value || {}; + const { type, source, size, destination } = nextProps.value || {}; if ( type !== prevState.type || source !== prevState.source || - cinderVolumeSize !== prevState.cinderVolumeSize || + size !== prevState.size || destination !== prevState.destination ) { return { type, source, - cinderVolumeSize, + size, destination, + isNewVolume: type === 'volume', }; } return null; @@ -62,20 +62,17 @@ export default class ZunVolume extends React.Component { }; onTypeChange = (value) => { - if (value === 'cinder-new') { - this.setState({ - isCinderVolume: true, - }); - } - if (value === 'cinder-available') { - this.setState({ - isCinderVolume: false, - }); - } - this.onChange({ - ...this.state, - type: value, - }); + this.setState( + { + isNewVolume: value === 'volume', + }, + () => { + this.onChange({ + ...this.state, + type: value, + }); + } + ); }; onSourceChange = (value) => { @@ -85,10 +82,10 @@ export default class ZunVolume extends React.Component { }); }; - onCinderVolumeSizeChange = (e) => { + onVolumeSizeChange = (e) => { this.onChange({ ...this.state, - cinderVolumeSize: e, + size: e, }); }; @@ -100,9 +97,7 @@ export default class ZunVolume extends React.Component { }; render() { - const { type, source, destination, cinderVolumeSize, isCinderVolume } = - this.state; - const { name } = this.props; + const { type, source, destination, size, isNewVolume } = this.state; const selectType = (