From 8c979780a0a56c62684be24f1895a3fed27cf8aa Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Wed, 8 Jun 2022 14:18:11 +0800 Subject: [PATCH] feat: Add error message when create instance quota exceeded Show error message when create instance with quota exceeded: 1. change the instance number 2. change the volume type 3. change the volume size the above situations may trigger a prompt Update error message style in the footer Change-Id: I038bb1919d05d78fc8a78b3ab1a6e72cf327f2ce --- .../Instance/actions/StepCreate/index.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx b/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx index c9c16c37..14efa44a 100644 --- a/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx +++ b/src/pages/compute/containers/Instance/actions/StepCreate/index.jsx @@ -15,7 +15,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; -import { InputNumber, Badge } from 'antd'; +import { InputNumber, Badge, message as $message } from 'antd'; import { StepAction } from 'containers/Action'; import globalServerStore from 'stores/nova/instance'; import globalProjectStore from 'stores/keystone/project'; @@ -334,6 +334,10 @@ export class StepCreate extends StepAction { return msg; } + get badgeStyle() { + return { marginTop: 8, marginBottom: 8, marginLeft: 10, maxWidth: 600 }; + } + renderBadge() { const { status = 'success' } = this.state; const volumeMsg = this.checkVolumeQuota(); @@ -344,9 +348,12 @@ export class StepCreate extends StepAction { } this.status = 'error'; const msg = status === 'error' ? this.msg : volumeMsg; + if (this.errorMsg !== msg) { + $message.error(msg); + } this.errorMsg = msg; return ( -
+
); @@ -372,7 +379,7 @@ export class StepCreate extends StepAction { formatter: (value) => `$ ${value}`.replace(/\D/g, ''), }; return ( -
+
{t('Count')}