diff --git a/src/pages/compute/containers/Instance/actions/CreateIronic/index.jsx b/src/pages/compute/containers/Instance/actions/CreateIronic/index.jsx index bf3e32a9..23e100b1 100644 --- a/src/pages/compute/containers/Instance/actions/CreateIronic/index.jsx +++ b/src/pages/compute/containers/Instance/actions/CreateIronic/index.jsx @@ -23,6 +23,7 @@ import classnames from 'classnames'; import { isEmpty, isFinite } from 'lodash'; import { getUserData, canCreateIronicByLicense } from 'resources/instance'; import { ironicOriginEndpoint } from 'client/client/constants'; +import Notify from 'components/Notify'; import styles from './index.less'; import ConfirmStep from './ConfirmStep'; import SystemStep from './SystemStep'; @@ -318,4 +319,28 @@ export default class CreateIronic extends StepAction { }; return this.store.create(body); }; + + onOk = () => { + const { data } = this.state; + this.values = data; + this.onSubmit(data).then( + () => { + this.routing.push(this.listUrl); + Notify.success(this.successText); + }, + (err) => { + const { response: { data: responseData } = {} } = err; + const { forbidden: { message = '' } = {} } = responseData || {}; + if ( + message && + typeof message === 'string' && + message.indexOf('Quota exceeded') !== -1 + ) { + Notify.error(t('Quota exceeded')); + } else { + Notify.errorWithDetail(responseData, this.errorText); + } + } + ); + }; } diff --git a/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx b/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx index 90c12e8a..04538a85 100644 --- a/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx +++ b/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx @@ -371,7 +371,8 @@ class StepCreate extends StepAction { Notify.success(this.successText); }, (err) => { - const { data: { forbidden: { message = '' } = {} } = {} } = err; + const { response: { data: responseData } = {} } = err; + const { forbidden: { message = '' } = {} } = responseData || {}; if ( message && isString(message) && @@ -379,7 +380,7 @@ class StepCreate extends StepAction { ) { Notify.error(t('Quota exceeded')); } else { - Notify.errorWithDetail(err, this.errorText); + Notify.errorWithDetail(responseData, this.errorText); } } );