diff --git a/src/components/StepForm/index.jsx b/src/components/StepForm/index.jsx index 459e295c..78e49acf 100644 --- a/src/components/StepForm/index.jsx +++ b/src/components/StepForm/index.jsx @@ -35,6 +35,7 @@ export default class BaseStepForm extends React.Component { data: {}, }; + this.values = {}; this.setFormRefs(); this.init(); } diff --git a/src/locales/en.json b/src/locales/en.json index 7c487da6..f064d0b8 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1231,6 +1231,8 @@ "Qos Policy": "Qos Policy", "Queued": "Queued", "Quota Overview": "Quota Overview", + "Quota Resource": "Quota Resource", + "Quota exceeded": "Quota exceeded", "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).", "Quota: Project quotas sufficient resources can be created": "Quota: Project quotas sufficient resources can be created", "RAM": "RAM", @@ -1840,6 +1842,8 @@ "image": "image", "images": "images", "ingress": "ingress", + "insert": "insert", + "insert rule": "insert rule", "instance": "instance", "instance snapshot": "instance snapshot", "instances": "instances", @@ -1923,6 +1927,7 @@ "unlock instance": "unlock instance", "unpause instance": "unpause instance", "unshelve instance": "unshelve instance", + "update": "update", "update status": "update status", "update template": "update template", "user": "user", diff --git a/src/locales/zh.json b/src/locales/zh.json index 4c93adbc..036417cf 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -1231,6 +1231,8 @@ "Qos Policy": "QoS策略", "Queued": "已排队", "Quota Overview": "配额概况", + "Quota Resource": "Quota(配额)", + "Quota exceeded": "配额用尽", "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "配额:项目配额不足,无法创建资源,请进行资源数量或配额的调整(剩余{ quota },输入{ input })。", "Quota: Project quotas sufficient resources can be created": "配额:项目配额充足,可创建资源", "RAM": "内存", @@ -1840,6 +1842,8 @@ "image": "镜像", "images": "镜像", "ingress": "入方向", + "insert": "", + "insert rule": "插入规则", "instance": "云主机", "instance snapshot": "云主机快照", "instances": "云主机", @@ -1923,6 +1927,7 @@ "unlock instance": "解锁云主机", "unpause instance": "恢复云主机", "unshelve instance": "取消归档云主机", + "update": "", "update status": "更新状态", "update template": "更新模板", "user": "用户", diff --git a/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx b/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx index f4d0c631..dd9cb9a1 100644 --- a/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx +++ b/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx @@ -20,8 +20,9 @@ import { StepAction } from 'containers/Action'; import globalServerStore from 'stores/nova/instance'; import globalProjectStore from 'stores/keystone/project'; import classnames from 'classnames'; -import { isEmpty, isFinite } from 'lodash'; +import { isEmpty, isFinite, isString } from 'lodash'; import { getUserData } from 'resources/instance'; +import Notify from 'components/Notify'; import styles from './index.less'; import ConfirmStep from './ConfirmStep'; import SystemStep from './SystemStep'; @@ -351,6 +352,29 @@ class StepCreate 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 { data: { forbidden: { message = '' } = {} } = {} } = err; + if ( + message && + isString(message) && + message.includes('Quota exceeded') + ) { + Notify.error(t('Quota exceeded')); + } else { + Notify.errorWithDetail(this.errorText, err); + } + } + ); + }; } export default StepCreate;