feat: support quota info when backup create volume
1. Support quota info when backup create volume 2. Disable click submit button when quota is insufficient Change-Id: I154a2fd85560c9b27770e4c828321da167d68133
This commit is contained in:
parent
b605ac01c4
commit
132c1d13be
@ -15,6 +15,13 @@
|
|||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { ModalAction } from 'containers/Action';
|
import { ModalAction } from 'containers/Action';
|
||||||
import globalVolumeStore from 'stores/cinder/volume';
|
import globalVolumeStore from 'stores/cinder/volume';
|
||||||
|
import {
|
||||||
|
getQuotaInfo,
|
||||||
|
checkQuotaDisable,
|
||||||
|
fetchQuota,
|
||||||
|
onVolumeSizeChange,
|
||||||
|
onVolumeTypeChange,
|
||||||
|
} from 'resources/cinder/volume';
|
||||||
|
|
||||||
export class CreateVolume extends ModalAction {
|
export class CreateVolume extends ModalAction {
|
||||||
static id = 'create';
|
static id = 'create';
|
||||||
@ -31,6 +38,7 @@ export class CreateVolume extends ModalAction {
|
|||||||
this.volumeStore = globalVolumeStore;
|
this.volumeStore = globalVolumeStore;
|
||||||
this.getAvailZones();
|
this.getAvailZones();
|
||||||
this.getVolumeTypes();
|
this.getVolumeTypes();
|
||||||
|
fetchQuota(this, this.item.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAvailZones() {
|
getAvailZones() {
|
||||||
@ -58,6 +66,22 @@ export class CreateVolume extends ModalAction {
|
|||||||
return this.volumeStore.volumeTypes;
|
return this.volumeStore.volumeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get disableSubmit() {
|
||||||
|
return checkQuotaDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static get showQuota() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
get showQuota() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
get quotaInfo() {
|
||||||
|
return getQuotaInfo(this);
|
||||||
|
}
|
||||||
|
|
||||||
static allowed = (item) => Promise.resolve(item.status === 'available');
|
static allowed = (item) => Promise.resolve(item.status === 'available');
|
||||||
|
|
||||||
get defaultValue() {
|
get defaultValue() {
|
||||||
@ -94,6 +118,7 @@ export class CreateVolume extends ModalAction {
|
|||||||
min: this.minSize,
|
min: this.minSize,
|
||||||
extra: `${t('Min size')}: ${this.minSize}GiB`,
|
extra: `${t('Min size')}: ${this.minSize}GiB`,
|
||||||
required: true,
|
required: true,
|
||||||
|
onChange: onVolumeSizeChange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'volume_type',
|
name: 'volume_type',
|
||||||
@ -102,6 +127,7 @@ export class CreateVolume extends ModalAction {
|
|||||||
required: true,
|
required: true,
|
||||||
options: this.volumeTypes,
|
options: this.volumeTypes,
|
||||||
placeholder: t('Please select volume type'),
|
placeholder: t('Please select volume type'),
|
||||||
|
onChange: onVolumeTypeChange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'availability_zone',
|
name: 'availability_zone',
|
||||||
|
Loading…
Reference in New Issue
Block a user