From 0dcf7bd0e3fe6b8961f05b96d9192700bcd7ffd9 Mon Sep 17 00:00:00 2001 From: xusongfu Date: Mon, 21 Feb 2022 18:47:15 +0800 Subject: [PATCH] fix: Fix the status list of volume Administrators can reset the volume status to in-use If the volume status is 'error', the volume can not be deleted or detached, we need to change the status to 'in-use' then do this Change-Id: Ia250a449fea4dc96186bd1440eadfc0c791f48ac --- src/locales/en.json | 1 + src/locales/zh.json | 1 + .../containers/Volume/actions/UpdateStatus.jsx | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/src/locales/en.json b/src/locales/en.json index a5061dcf..b5270ce7 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1924,6 +1924,7 @@ "The user has been disabled, please contact the administrator": "The user has been disabled, please contact the administrator", "The user needs to ensure that the input is a shell script that can run completely and normally.": "The user needs to ensure that the input is a shell script that can run completely and normally.", "The volume associated with the backup is not available, unable to restore.": "The volume associated with the backup is not available, unable to restore.", + "The volume status can be reset to in-use only when the previous status is in-use.": "The volume status can be reset to in-use only when the previous status is in-use.", "The volume type needs to be consistent with the volume type when the snapshot is created.": "The volume type needs to be consistent with the volume type when the snapshot is created.", "The volume type needs to set \"multiattach\" in the metadata to support shared volume attributes.": "The volume type needs to set \"multiattach\" in the metadata to support shared volume attributes.", "The {action} instruction has been issued, 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 {action} instruction has been issued, 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.", diff --git a/src/locales/zh.json b/src/locales/zh.json index 4b545dda..ac637e8b 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -1924,6 +1924,7 @@ "The user has been disabled, please contact the administrator": "用户已被禁用,请联系管理员", "The user needs to ensure that the input is a shell script that can run completely and normally.": "请确保输入的是能完整正常运行的 shell 脚本。", "The volume associated with the backup is not available, unable to restore.": "云硬盘不处于可用状态,不支持恢复备份操作。", + "The volume status can be reset to in-use only when the previous status is in-use.": "只有当之前的状态为使用中时,才将云硬盘状态重置为使用中。", "The volume type needs to be consistent with the volume type when the snapshot is created.": "创建云硬盘的云硬盘类型需要和创建快照时间点的云硬盘类型保持一致。", "The volume type needs to set \"multiattach\" in the metadata to support shared volume attributes.": "云硬盘类型需在元数据中设置\"multiattach\",才可支持共享盘属性。", "The {action} instruction has been issued, 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.": "{action}指令已下发,实例名称:{name}。 \n 您可等待几秒关注列表数据的变更或是手动刷新数据,以获取最终展示结果。", diff --git a/src/pages/storage/containers/Volume/actions/UpdateStatus.jsx b/src/pages/storage/containers/Volume/actions/UpdateStatus.jsx index 2c8e594d..d7002a3d 100644 --- a/src/pages/storage/containers/Volume/actions/UpdateStatus.jsx +++ b/src/pages/storage/containers/Volume/actions/UpdateStatus.jsx @@ -47,10 +47,12 @@ export default class UpdateStatus extends ModalAction { } get formItems() { + const { status } = this.state; const statusList = [ { value: 'available', label: t('Available') }, { value: 'maintenance', label: t('Maintained') }, { value: 'error', label: t('Error') }, + { value: 'in-use', label: t('In Use') }, ]; return [ { @@ -64,10 +66,23 @@ export default class UpdateStatus extends ModalAction { label: t('Status'), type: 'select', options: statusList, + onChange: this.handleStatusChange, + extra: + status === 'in-use' + ? t( + 'The volume status can be reset to in-use only when the previous status is in-use.' + ) + : '', }, ]; } + handleStatusChange = (status) => { + this.setState({ + status, + }); + }; + init() { this.store = globalVolumeStore; }