Merge "feat: add confirm & revert resize action"

This commit is contained in:
Zuul 2021-09-30 09:28:31 +00:00 committed by Gerrit Code Review
commit 205dc9c7ca
5 changed files with 125 additions and 1 deletions

View File

@ -275,6 +275,7 @@
"Confirm": "Confirm",
"Confirm Config": "Confirm Config",
"Confirm Password": "Confirm Password",
"Confirm Resize or Migrate": "Confirm Resize or Migrate",
"Confirm Shared Key": "Confirm Shared Key",
"Confirming Resize or Migrate": "Confirming Resize or Migrate",
"Connect Subnet": "Connect Subnet",
@ -1344,6 +1345,7 @@
"Resume Instance": "Resume Instance",
"Resuming": "Resuming",
"Retyping": "Retyping",
"Revert Resize or Migrate": "Revert Resize or Migrate",
"Revert Resize/Migrate": "Revert Resize/Migrate",
"Reverting": "Reverting",
"Reverting Resize or Migrate": "Reverting Resize or Migrate",
@ -1789,6 +1791,7 @@
"cinder services": "cinder services",
"compute hosts": "compute hosts",
"compute services": "compute services",
"confirm resize or migrate": "confirm resize or migrate",
"connect subnet": "connect subnet",
"create DSCP marking rule": "create DSCP marking rule",
"create a new network/subnet": "create a new network/subnet",
@ -1930,6 +1933,7 @@
"remove router": "remove router",
"resize": "resize",
"resume instance": "resume instance",
"revert resize or migrate": "revert resize or migrate",
"role": "role",
"roles": "roles",
"router": "router",

View File

@ -275,6 +275,7 @@
"Confirm": "确定",
"Confirm Config": "确认配置",
"Confirm Password": "确认密码",
"Confirm Resize or Migrate": "确认修改配置/迁移",
"Confirm Shared Key": "确认共享密钥",
"Confirming Resize or Migrate": "确认修改配置/迁移",
"Connect Subnet": "连接子网",
@ -1344,6 +1345,7 @@
"Resume Instance": "恢复云主机",
"Resuming": "恢复中",
"Retyping": "修改类型中",
"Revert Resize or Migrate": "回滚修改配置/迁移",
"Revert Resize/Migrate": "回滚修改配置/迁移",
"Reverting": "恢复中",
"Reverting Resize or Migrate": "正在回滚修改配置/迁移",
@ -1789,6 +1791,7 @@
"cinder services": "存储服务",
"compute hosts": "计算节点",
"compute services": "计算服务",
"confirm resize or migrate": "确认修改配置/迁移",
"connect subnet": "连接子网",
"create DSCP marking rule": "创建DSCP标记规则",
"create a new network/subnet": "新建网络/子网",
@ -1930,6 +1933,7 @@
"remove router": "移除路由器",
"resize": "更改配置",
"resume instance": "恢复云主机",
"revert resize or migrate": "回滚修改配置/迁移",
"role": "角色",
"roles": "角色",
"router": "路由器",

View File

@ -0,0 +1,57 @@
// 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 { ConfirmAction } from 'containers/Action';
import globalServerStore from 'stores/nova/instance';
export default class ConfirmResizeAction extends ConfirmAction {
get id() {
return 'confirm_resize_migrate';
}
get title() {
return t('Confirm Resize or Migrate');
}
get buttonText() {
return t('Confirm Resize or Migrate');
}
get actionName() {
return t('confirm resize or migrate');
}
policy = 'os_compute_api:servers:resize';
allowedCheckFunc = (item) => {
if (!item) {
return true;
}
return item.status.toLowerCase() === 'verify_resize';
};
confirmContext = (data) => {
const name = this.getName(data);
return t(`${this.actionNameDisplay} (instance: {name})?`, {
name,
});
};
onSubmit = (item) => {
const { id } = item || this.item;
return globalServerStore.update(id, {
confirmResize: null,
});
};
}

View File

@ -0,0 +1,50 @@
// 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 { ConfirmAction } from 'containers/Action';
import globalServerStore from 'stores/nova/instance';
export default class RevertResizeAction extends ConfirmAction {
get id() {
return 'revert_resize_migrate';
}
get title() {
return t('Revert Resize or Migrate');
}
get buttonText() {
return t('Revert Resize or Migrate');
}
get actionName() {
return t('revert resize or migrate');
}
policy = 'os_compute_api:servers:resize';
allowedCheckFunc = (item) => {
if (!item) {
return true;
}
return item.status.toLowerCase() === 'verify_resize';
};
onSubmit = (item) => {
const { id } = item || this.item;
return globalServerStore.update(id, {
revertResize: null,
});
};
}

View File

@ -46,6 +46,8 @@ import LiveMigrate from './LiveMigrate';
import AssociateFip from './AssociateFip';
import ManageSecurityGroup from './ManageSecurityGroup';
import DeleteIronic from './DeleteIronic';
import ConfirmResize from './ConfirmResize';
import RevertResize from './RevertResize';
const statusActions = [
StartAction,
@ -72,7 +74,14 @@ const resourceActions = [
ManageSecurityGroup,
];
const configActions = [Resize, ResizeOnline, ChangePassword, Rebuild];
const configActions = [
ConfirmResize,
RevertResize,
Resize,
ResizeOnline,
ChangePassword,
Rebuild,
];
const batchActions = [
StartAction,