diff --git a/src/locales/en.json b/src/locales/en.json index 5e5a3e96..05e4512d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -278,7 +278,6 @@ "CPU usage Num (Core)": "CPU usage Num (Core)", "CPU value is { cpu }, NUMA CPU value is { totalCpu }, need to be equal. ": "CPU value is { cpu }, NUMA CPU value is { totalCpu }, need to be equal. ", "CPU(Core)": "CPU(Core)", - "CPU/memory can only be increased or expanded online, and cannot be decreased or reduced online.": "CPU/memory can only be increased or expanded online, and cannot be decreased or reduced online.", "CREATE COMPLETE": "CREATE COMPLETE", "CREATE FAILED": "CREATE FAILED", "CREATE IN PROGRESS": "CREATE IN PROGRESS", @@ -2210,7 +2209,6 @@ "The container memory size in MiB": "The container memory size in MiB", "The creation instruction has been issued, please refresh to see the actual situation in the list.": "The creation instruction has been issued, please refresh to see the actual situation in the list.", "The creation instruction was issued successfully, instance: {name}. \n You can wait for a few seconds to follow the changes of the list data or manually refresh the data to get the final display result.": "The creation instruction was issued successfully, instance: {name}. \n You can wait for a few seconds to follow the changes of the list data or manually refresh the data to get the final display result.", - "The current operation can be performed when the instance is online:": "The current operation can be performed when the instance is online:", "The current operation requires the instance to be shut down:": "The current operation requires the instance to be shut down:", "The description can be up to 255 characters long.": "The description can be up to 255 characters long.", "The disk size in GiB for per container": "The disk size in GiB for per container", @@ -2698,7 +2696,6 @@ "networks": "networks", "neutron agent": "neutron agent", "neutron agents": "neutron agents", - "online resize": "online resize", "open external gateway": "open external gateway", "out": "out", "paste files to folder": "paste files to folder", diff --git a/src/locales/zh.json b/src/locales/zh.json index 969b620b..38050ff7 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -278,7 +278,6 @@ "CPU usage Num (Core)": "CPU使用量 (核)", "CPU value is { cpu }, NUMA CPU value is { totalCpu }, need to be equal. ": "CPU核数是 { cpu },NUMA节点的CPU核数是{ totalCpu },需要一致。", "CPU(Core)": "CPU(核数)", - "CPU/memory can only be increased or expanded online, and cannot be decreased or reduced online.": "CPU/内存均只能在线增或扩展,不能在线减少或缩小。", "CREATE COMPLETE": "创建完成", "CREATE FAILED": "创建失败", "CREATE IN PROGRESS": "创建中", @@ -2210,7 +2209,6 @@ "The container memory size in MiB": "以 MiB 为单位的容器内存大小", "The creation instruction has been issued, please refresh to see the actual situation in the list.": "创建指令已下发,请刷新查看云主机列表中的实际情况。", "The creation instruction was issued successfully, instance: {name}. \n You can wait for a few seconds to follow the changes of the list data or manually refresh the data to get the final display result.": "创建指令下发成功,实例名称:{name}。 \n 您可等待几秒关注列表数据的变更或是手动刷新数据,以获取最终展示结果。", - "The current operation can be performed when the instance is online:": "当前操作可在云主机在线状态下进行:", "The current operation requires the instance to be shut down:": "当前操作需要云主机在关机状态下进行:", "The description can be up to 255 characters long.": "描述最长为255字符", "The disk size in GiB for per container": "以 GiB 为单位的容器磁盘大小", @@ -2698,7 +2696,6 @@ "networks": "网络", "neutron agent": "网络服务", "neutron agents": "网络服务", - "online resize": "在线修改配置", "open external gateway": "开启公网网关", "out": "出", "paste files to folder": "粘贴文件到文件夹下", diff --git a/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx b/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx index 57acf39d..14ca9948 100644 --- a/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx +++ b/src/pages/compute/containers/Flavor/actions/StepCreate/index.jsx @@ -94,7 +94,7 @@ export class StepCreate extends StepAction { return type === 'custom' ? value : type; } - onSubmit = (values) => { + getSubmitData(values) { const { architecture, category, @@ -179,7 +179,6 @@ export class StepCreate extends StepAction { memPageSizeMore, memPageSizeValueMore ); - extraSpecs['hw:live_resize'] = 'True'; } if (isBareMetal(architecture)) { resourceProps.forEach((it) => { @@ -191,11 +190,16 @@ export class StepCreate extends StepAction { extraSpecs[`trait:${value}`] = 'required'; }); } - return this.store.create( + return { body, extraSpecs, - !isPublic && (accessControl.selectedRowKeys || []) - ); + accessControl: !isPublic && (accessControl.selectedRowKeys || []), + }; + } + + onSubmit = (data) => { + const { body, extraSpecs, accessControl } = data; + return this.store.create(body, extraSpecs, accessControl); }; } diff --git a/src/pages/compute/containers/Instance/actions/ResizeOnline.jsx b/src/pages/compute/containers/Instance/actions/ResizeOnline.jsx deleted file mode 100644 index 56ca4469..00000000 --- a/src/pages/compute/containers/Instance/actions/ResizeOnline.jsx +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2021 99cloud -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import globalFlavorStore from 'stores/nova/flavor'; -import globalServerStore from 'stores/nova/instance'; -import { ModalAction } from 'containers/Action'; -import { - isNotLockedOrAdmin, - checkStatus, - isIronicInstance, - hasOnlineResizeFlavor, -} from 'resources/nova/instance'; -import FlavorSelectTable from '../components/FlavorSelectTable'; - -export class ResizeOnline extends ModalAction { - static id = 'resize-online'; - - static title = t('Online Resize'); - - static isDanger = true; - - init() { - this.store = globalFlavorStore; - } - - get name() { - return t('online resize'); - } - - static get modalSize() { - return 'large'; - } - - get isAsyncAction() { - return true; - } - - getModalSize() { - return 'large'; - } - - get tips() { - return ( -
-

- {t( - 'The current operation can be performed when the instance is online:' - )} -

-

- {t( - 'CPU/memory can only be increased or expanded online, and cannot be decreased or reduced online.' - )} -

-
- ); - } - - get defaultValue() { - const { name, flavor } = this.item; - const value = { - instance: name, - flavor, - }; - return value; - } - - static policy = 'os_compute_api:servers:resize'; - - static isActive = (item) => checkStatus(['active'], item); - - static allowed = (item, containerProps) => { - const { isAdminPage } = containerProps; - return Promise.resolve( - !this.isAdminPage && - this.isActive(item) && - isNotLockedOrAdmin(item, isAdminPage) && - !isIronicInstance(item) && - hasOnlineResizeFlavor(item) - ); - }; - - get formItems() { - const { flavor } = this.item; - return [ - { - name: 'instance', - label: t('Instance'), - type: 'label', - iconType: 'instance', - }, - { - name: 'flavor', - label: t('Current Flavor'), - type: 'label', - iconType: 'flavor', - }, - { - name: 'newFlavor', - label: t('Flavor'), - type: 'select-table', - component: ( - - ), - required: true, - wrapperCol: { - xs: { - span: 24, - }, - sm: { - span: 18, - }, - }, - }, - ]; - } - - onSubmit = (values) => { - const { id } = this.item; - const { newFlavor } = values; - const flavor = newFlavor.selectedRowKeys[0]; - return globalServerStore.liveResize({ id, flavor }); - }; -} - -export default inject('rootStore')(observer(ResizeOnline)); diff --git a/src/pages/compute/containers/Instance/actions/index.jsx b/src/pages/compute/containers/Instance/actions/index.jsx index 8747a96c..b17701c5 100644 --- a/src/pages/compute/containers/Instance/actions/index.jsx +++ b/src/pages/compute/containers/Instance/actions/index.jsx @@ -33,7 +33,6 @@ import ResumeAction from './Resume'; import AttachVolume from './AttachVolume'; import DetachVolume from './DetachVolume'; import Resize from './Resize'; -import ResizeOnline from './ResizeOnline'; import MigrateAction from './Migrate'; import Console from './Console'; import Edit from './Edit'; @@ -79,7 +78,6 @@ const configActions = [ ConfirmResize, RevertResize, Resize, - ResizeOnline, ChangePassword, Rebuild, ]; diff --git a/src/resources/nova/instance.jsx b/src/resources/nova/instance.jsx index e8d76f39..889c5252 100644 --- a/src/resources/nova/instance.jsx +++ b/src/resources/nova/instance.jsx @@ -433,13 +433,6 @@ export const instanceStatusFilter = { ], }; -export const hasOnlineResizeFlavor = (item) => { - const { - extra_specs: { 'hw:live_resize': liveResize = false }, - } = (item || {}).flavor_info || {}; - return !!liveResize; -}; - export const actionMap = { attach_interface: t('Attach Interface'), detach_interface: t('Detach Interface'),