fix: Fix create instance error hint

1. Fix create instance error hint
2. Fix create ironic error hint

Change-Id: I42371374d1e7d70d6b6b81fbf451603138ed0b24
This commit is contained in:
zhangjingwei 2021-07-30 10:12:43 +08:00 committed by Jingwei.Zhang
parent 1b122869f7
commit 53f398b8c6
2 changed files with 28 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import classnames from 'classnames';
import { isEmpty, isFinite } from 'lodash'; import { isEmpty, isFinite } from 'lodash';
import { getUserData, canCreateIronicByLicense } from 'resources/instance'; import { getUserData, canCreateIronicByLicense } from 'resources/instance';
import { ironicOriginEndpoint } from 'client/client/constants'; import { ironicOriginEndpoint } from 'client/client/constants';
import Notify from 'components/Notify';
import styles from './index.less'; import styles from './index.less';
import ConfirmStep from './ConfirmStep'; import ConfirmStep from './ConfirmStep';
import SystemStep from './SystemStep'; import SystemStep from './SystemStep';
@ -318,4 +319,28 @@ export default class CreateIronic extends StepAction {
}; };
return this.store.create(body); 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);
}
}
);
};
} }

View File

@ -371,7 +371,8 @@ class StepCreate extends StepAction {
Notify.success(this.successText); Notify.success(this.successText);
}, },
(err) => { (err) => {
const { data: { forbidden: { message = '' } = {} } = {} } = err; const { response: { data: responseData } = {} } = err;
const { forbidden: { message = '' } = {} } = responseData || {};
if ( if (
message && message &&
isString(message) && isString(message) &&
@ -379,7 +380,7 @@ class StepCreate extends StepAction {
) { ) {
Notify.error(t('Quota exceeded')); Notify.error(t('Quota exceeded'));
} else { } else {
Notify.errorWithDetail(err, this.errorText); Notify.errorWithDetail(responseData, this.errorText);
} }
} }
); );