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;
}
renderFooterLeft() {
const { data } = this.state;
const { count = 1 } = data;
const configs = {
getCountInputConfig() {
return {
min: 1,
max: 100,
precision: 0,
onChange: this.onCountChange,
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 (
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div className={styles['number-input']}>
<span>{t('Count')}</span>
<InputNumber
{...configs}
value={count}
className={classnames(styles.input, 'instance-count')}
/>
</div>
{this.renderCountInput()}
{this.renderExtra()}
</div>
{this.renderBadge()}