From 2e0d504594aec050bb53035cb48987672a3484f3 Mon Sep 17 00:00:00 2001 From: xusongfu Date: Mon, 20 Jun 2022 14:04:13 +0800 Subject: [PATCH] fix: Fix the root disk in flavor Allow set root disk size in flavor creating when no-cinder Change-Id: Ia68f1c804c2aa359893ffba8344fa5990d368210 --- src/locales/en.json | 1 + src/locales/zh.json | 1 + .../compute/containers/Flavor/Detail/BaseDetail.jsx | 2 +- .../Flavor/actions/StepCreate/ParamSetting.jsx | 12 ++++++++++++ .../containers/Flavor/actions/StepCreate/index.jsx | 3 ++- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index a32e871b..fc4df850 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1929,6 +1929,7 @@ "Rollback In Progress": "Rollback In Progress", "Romania": "Romania", "Root Disk": "Root Disk", + "Root Disk(GiB)": "Root Disk(GiB)", "Root directory": "Root directory", "Router": "Router", "Router Advertisements Mode": "Router Advertisements Mode", diff --git a/src/locales/zh.json b/src/locales/zh.json index b3353219..a6182600 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -1929,6 +1929,7 @@ "Rollback In Progress": "回滚中", "Romania": "罗马尼亚", "Root Disk": "系统盘", + "Root Disk(GiB)": "根磁盘 (GiB)", "Root directory": "根目录", "Router": "路由器", "Router Advertisements Mode": "路由广播模式", diff --git a/src/pages/compute/containers/Flavor/Detail/BaseDetail.jsx b/src/pages/compute/containers/Flavor/Detail/BaseDetail.jsx index 89b830eb..85630c85 100644 --- a/src/pages/compute/containers/Flavor/Detail/BaseDetail.jsx +++ b/src/pages/compute/containers/Flavor/Detail/BaseDetail.jsx @@ -154,7 +154,7 @@ export class BaseDetail extends Base { get diskCard() { const options = [ { - label: t('Disk'), + label: t('Root Disk(GiB)'), dataIndex: 'disk', }, ]; diff --git a/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx b/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx index 35bc4914..62a2c55a 100644 --- a/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx +++ b/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx @@ -152,6 +152,7 @@ export class ParamSetting extends Base { settings: toJS(this.settingStore.list.data || []), ephemeral: 0, ephemeralTmp: 0, + disk: 0, architecture: this.tab, attachUsb: false, resourceProps: this.getDefaultResourcePropValues(), @@ -180,6 +181,10 @@ export class ParamSetting extends Base { ]; } + get enableCinder() { + return this.props.rootStore.checkEndpoint('cinder'); + } + allowed = () => Promise.resolve(); numaValidate = ({ getFieldValue }) => ({ @@ -382,6 +387,13 @@ export class ParamSetting extends Base { hidden: isBareMetal || hasEphemeral, disabled: !hasEphemeral, }, + { + name: 'disk', + label: t('Root Disk(GiB)'), + type: 'input-int', + min: 0, + hidden: this.enableCinder, + }, { name: 'iops', label: t('Storage IOPS'), diff --git a/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx b/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx index 1a607a61..57acf39d 100644 --- a/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx +++ b/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx @@ -122,12 +122,13 @@ export class StepCreate extends StepAction { accessControl = {}, resourceProps, traitProps, + disk, } = values; const body = { name, vcpus, ram: memoryGb * 1024, - disk: 0, + disk: disk || 0, }; const isPublic = accessType === 'public'; body['os-flavor-access:is_public'] = isPublic;