refactor: refactor create ironic

refact create ironic code

Change-Id: I9aa223951e610e9a63e5fdc680381aea88d08ff0
This commit is contained in:
Jingwei.Zhang 2023-08-07 20:27:21 +08:00
parent 29c4030d0c
commit 06e581191b

View File

@ -207,27 +207,37 @@ export class CreateIronic extends StepAction {
return null; return null;
} }
renderFooterLeft() { getCountInputConfig() {
const { data } = this.state; return {
const { count = 1 } = data;
const configs = {
min: 1, min: 1,
max: 100, max: 100,
precision: 0, precision: 0,
onChange: this.onCountChange, onChange: this.onCountChange,
formatter: (value) => `$ ${value}`.replace(/\D/g, ''), formatter: (value) => `$ ${value}`.replace(/\D/g, ''),
}; };
}
renderCountInput() {
const { data } = this.state;
const { count = 1 } = data || {};
const configs = this.getCountInputConfig();
return (
<div className={styles['number-input']}>
<span>{t('Count')}</span>
<InputNumber
{...configs}
value={count}
className={classnames(styles.input, 'instance-count')}
/>
</div>
);
}
renderFooterLeft() {
return ( return (
<div style={{ display: 'flex', flexDirection: 'column' }}> <div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
<div className={styles['number-input']}> {this.renderCountInput()}
<span>{t('Count')}</span>
<InputNumber
{...configs}
value={count}
className={classnames(styles.input, 'instance-count')}
/>
</div>
{this.renderExtra()} {this.renderExtra()}
</div> </div>
{this.renderBadge()} {this.renderBadge()}