diff --git a/README.md b/README.md index 276657e97b..73e08363ec 100644 --- a/README.md +++ b/README.md @@ -81,5 +81,5 @@ yarn build ### Make docker image ```bash -REGISTRY=registry.cn-beijing.aliyuncs.com/yunionio TAG=your-tag ./scripts/docker-push.sh +REGISTRY=registry.cn-beijing.aliyuncs.com/yunionio TAG=your-tag ./scripts/docker_push.sh ``` diff --git a/containers/Compute/locales/en.json b/containers/Compute/locales/en.json index 2edb402e9b..3af73822fa 100644 --- a/containers/Compute/locales/en.json +++ b/containers/Compute/locales/en.json @@ -1708,5 +1708,9 @@ "compute.storage.check_status.host_status": "Host service or status is abnormal", "compute.vmware.transfer.message": "Prompt message: The migration host must belong to the same Layer 2 network and the target host must be in normal state", "compute.storage.check_status.status": "The block storage status is abnormal", - "compute.storage.check_status.enabled": "Block storage is not enabled" + "compute.storage.check_status.enabled": "Block storage is not enabled", + "compute.start_rescue": "Start Rescue", + "compute.stop_rescue": "Stop Rescue", + "compute.start_rescue_tips": "Use the account password below to access the rescue system. After exiting Rescue Mode, use the original account password to access. Instance memory requires 2GB or more.", + "compute.start_rescue_default_config": "Account:root Password:mosbaremetal" } diff --git a/containers/Compute/locales/zh-CN.json b/containers/Compute/locales/zh-CN.json index 40267faf87..58cd93a578 100644 --- a/containers/Compute/locales/zh-CN.json +++ b/containers/Compute/locales/zh-CN.json @@ -1711,5 +1711,9 @@ "compute.storage.check_status.host_status": "宿主机服务或状态异常", "compute.vmware.transfer.message": "提示信息:迁移宿主机需属于同一个二层网络且目标宿主机状态正常", "compute.storage.check_status.status": "块存储状态异常", - "compute.storage.check_status.enabled": "块存储未启用" + "compute.storage.check_status.enabled": "块存储未启用", + "compute.start_rescue": "启动救援", + "compute.stop_rescue": "退出救援", + "compute.start_rescue_tips": "使用下面的账号密码进入救援系统。退出救援模式后,使用原账号密码访问。实例内存需要2GB以上。", + "compute.start_rescue_default_config": "账号:root 密码:mosbaremetal" } diff --git a/containers/Compute/views/vminstance/constants/actions.js b/containers/Compute/views/vminstance/constants/actions.js index a0dfaa3a1d..13021eb2b6 100644 --- a/containers/Compute/views/vminstance/constants/actions.js +++ b/containers/Compute/views/vminstance/constants/actions.js @@ -476,6 +476,38 @@ const getSingleActions = function () { }, hidden: () => !(hasSetupKey(['onecloud'])) || this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_sync_config'), }, + // 启动救援模式 + { + label: i18n.t('compute.start_rescue'), + permission: 'server_perform_start_rescue', + action: () => { + this.createDialog('VmStartRescueDialog', { + data: [obj], + columns: this.columns, + onManager: this.onManager, + }) + }, + meta: () => { + return { validate: cloudEnabled('startRescue', obj) } + }, + hidden: () => this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_start_rescue'), + }, + // 退出救援模式 TODO + { + label: i18n.t('compute.stop_rescue'), + permission: 'server_perform_stop_rescue', + action: () => { + this.createDialog('VmStopRescueDialog', { + data: [obj], + columns: this.columns, + onManager: this.onManager, + }) + }, + meta: () => { + return { validate: cloudEnabled('stopRescue', obj) } + }, + hidden: () => this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_stop_rescue'), + }, ], }, // * 属性设置 diff --git a/containers/Compute/views/vminstance/dialogs/VmStartRescueDialog.vue b/containers/Compute/views/vminstance/dialogs/VmStartRescueDialog.vue new file mode 100644 index 0000000000..bc2043da68 --- /dev/null +++ b/containers/Compute/views/vminstance/dialogs/VmStartRescueDialog.vue @@ -0,0 +1,63 @@ + + + diff --git a/containers/Compute/views/vminstance/dialogs/VmStopRescueDialog.vue b/containers/Compute/views/vminstance/dialogs/VmStopRescueDialog.vue new file mode 100644 index 0000000000..5efa12d21f --- /dev/null +++ b/containers/Compute/views/vminstance/dialogs/VmStopRescueDialog.vue @@ -0,0 +1,57 @@ + + + diff --git a/containers/Compute/views/vminstance/utils.js b/containers/Compute/views/vminstance/utils.js index 377acb7834..0bacff5049 100644 --- a/containers/Compute/views/vminstance/utils.js +++ b/containers/Compute/views/vminstance/utils.js @@ -631,6 +631,19 @@ const actionEableMap = { onecloud: ['ready'], }, }, + startRescue: { + cn: i18n.t('compute.start_rescue'), + brand: { + onecloud: ['ready', 'running'], + }, + }, + stopRescue: { + cn: i18n.t('compute.stop_rescue'), + brand: { + // TODO: Add rescue status in frontend. + onecloud: true, + }, + }, } export const commonEnabled = (value, statusArr = ['ready']) => { diff --git a/src/constants/permission.js b/src/constants/permission.js index f6f7682433..dc6e2591d3 100644 --- a/src/constants/permission.js +++ b/src/constants/permission.js @@ -434,6 +434,8 @@ export const PERMISSION = { server_get_cpuset_cores: ['compute', 'servers', 'get', 'cpuset-cores'], server_perform_cpuset: ['compute', 'servers', 'perform', 'cpuset'], server_perform_make_sshable: ['compute', 'servers', 'perform', 'make-sshable'], + server_perform_start_rescue: ['compute', 'servers', 'perform', 'start-rescue'], + server_perform_stop_rescue: ['compute', 'servers', 'perform', 'stop-rescue'], /** * images 相关操作 */ diff --git a/src/locales/en.json b/src/locales/en.json index a391396471..fd492b6361 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -170,7 +170,10 @@ "on": "On", "off": "Off", "qga_exec_command_failed": "QGA execution failed", - "convert_failed": "Convert Failed" + "convert_failed": "Convert Failed", + "start_rescue": "Start Rescue", + "rescuing": "Rescuing", + "stop_rescue": "Stop Rescue" }, "network": { "init": "Initialize", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 6267b096ba..78465c9bba 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -170,7 +170,10 @@ "on": "运行中", "off": "关机", "qga_exec_command_failed": "QGA执行失败", - "convert_failed": "转换失败" + "convert_failed": "转换失败", + "start_rescue": "启动救援", + "rescuing": "救援中", + "stop_rescue": "退出救援" }, "network": { "init": "初始化",