feature: Update instance batch action error hint
Update instance batch action error hint: delete, start, stop, soft delete, reboot, soft reboot Change-Id: I58e3b9ed224370df78fef0b0271d1a0e6c51c7a3
This commit is contained in:
parent
fdaf0ac24b
commit
558b2d56a3
@ -134,6 +134,7 @@
|
|||||||
"Auto": "Auto",
|
"Auto": "Auto",
|
||||||
"Auto Inspect": "Auto Inspect",
|
"Auto Inspect": "Auto Inspect",
|
||||||
"Auto allocate mac address": "Auto allocate mac address",
|
"Auto allocate mac address": "Auto allocate mac address",
|
||||||
|
"Automatic backup": "Automatic backup",
|
||||||
"Automatically Assigned Address": "Automatically Assigned Address",
|
"Automatically Assigned Address": "Automatically Assigned Address",
|
||||||
"Availability Zone": "Availability Zone",
|
"Availability Zone": "Availability Zone",
|
||||||
"Availability Zone Hints": "Availability Zone Hints",
|
"Availability Zone Hints": "Availability Zone Hints",
|
||||||
@ -808,6 +809,7 @@
|
|||||||
"Instance Info": "Instance Info",
|
"Instance Info": "Instance Info",
|
||||||
"Instance Status": "Instance Status",
|
"Instance Status": "Instance Status",
|
||||||
"Instances": "Instances",
|
"Instances": "Instances",
|
||||||
|
"Instances \"{ name }\" are locked, can not delete them.": "Instances \"{ name }\" are locked, can not delete them.",
|
||||||
"Interface": "Interface",
|
"Interface": "Interface",
|
||||||
"Interface Info": "Interface Info",
|
"Interface Info": "Interface Info",
|
||||||
"Interface Name:": "Interface Name:",
|
"Interface Name:": "Interface Name:",
|
||||||
@ -932,6 +934,7 @@
|
|||||||
"Manager user": "Manager user",
|
"Manager user": "Manager user",
|
||||||
"Manager user group": "Manager user group",
|
"Manager user group": "Manager user group",
|
||||||
"Manu": "Manu",
|
"Manu": "Manu",
|
||||||
|
"Manual backup": "Manual backup",
|
||||||
"Manual input": "Manual input",
|
"Manual input": "Manual input",
|
||||||
"Manually Assigned Address": "Manually Assigned Address",
|
"Manually Assigned Address": "Manually Assigned Address",
|
||||||
"Manually Specify": "Manually Specify",
|
"Manually Specify": "Manually Specify",
|
||||||
@ -1720,15 +1723,12 @@
|
|||||||
"X86 Architecture": "X86 Architecture",
|
"X86 Architecture": "X86 Architecture",
|
||||||
"YAML File": "YAML File",
|
"YAML File": "YAML File",
|
||||||
"Yes": "Yes",
|
"Yes": "Yes",
|
||||||
"You are not allowed to delete instance \"{ name }\".": "You are not allowed to delete instance \"{ name }\".",
|
|
||||||
"You are not allowed to delete router \"{ name }\".": "You are not allowed to delete router \"{ name }\".",
|
"You are not allowed to delete router \"{ name }\".": "You are not allowed to delete router \"{ name }\".",
|
||||||
"You are not allowed to delete snapshot \"{ name }\", which is used by creating volume \"{volumes}\".": "You are not allowed to delete snapshot \"{ name }\", which is used by creating volume \"{volumes}\".",
|
"You are not allowed to delete snapshot \"{ name }\", which is used by creating volume \"{volumes}\".": "You are not allowed to delete snapshot \"{ name }\", which is used by creating volume \"{volumes}\".",
|
||||||
"You are not allowed to delete snapshot \"{ name }\".": "You are not allowed to delete snapshot \"{ name }\".",
|
"You are not allowed to delete snapshot \"{ name }\".": "You are not allowed to delete snapshot \"{ name }\".",
|
||||||
"You are not allowed to jump to the console.": "You are not allowed to jump to the console.",
|
"You are not allowed to jump to the console.": "You are not allowed to jump to the console.",
|
||||||
"You are not allowed to stop instance \"{ name }\".": "You are not allowed to stop instance \"{ name }\".",
|
|
||||||
"You are not allowed to { action } \"{ name }\".": "You are not allowed to { action } \"{ name }\".",
|
"You are not allowed to { action } \"{ name }\".": "You are not allowed to { action } \"{ name }\".",
|
||||||
"You are not allowed to { action } {name}.": "You are not allowed to { action } {name}.",
|
"You are not allowed to { action } {name}.": "You are not allowed to { action } {name}.",
|
||||||
"You are not allowed to {action} \"{ name }\".": "You are not allowed to {action} \"{ name }\".",
|
|
||||||
"You are not allowed to {action}, instance: {name}.": "You are not allowed to {action}, instance: {name}.",
|
"You are not allowed to {action}, instance: {name}.": "You are not allowed to {action}, instance: {name}.",
|
||||||
"You are not allowed to {action}.": "You are not allowed to {action}.",
|
"You are not allowed to {action}.": "You are not allowed to {action}.",
|
||||||
"You are trying to edit a network that not belong to current project. Please do not continue unless you are quit sure what you are doing.": "You are trying to edit a network that not belong to current project. Please do not continue unless you are quit sure what you are doing.",
|
"You are trying to edit a network that not belong to current project. Please do not continue unless you are quit sure what you are doing.": "You are trying to edit a network that not belong to current project. Please do not continue unless you are quit sure what you are doing.",
|
||||||
|
@ -134,6 +134,7 @@
|
|||||||
"Auto": "自动",
|
"Auto": "自动",
|
||||||
"Auto Inspect": "自动检测",
|
"Auto Inspect": "自动检测",
|
||||||
"Auto allocate mac address": "自动分配MAC地址",
|
"Auto allocate mac address": "自动分配MAC地址",
|
||||||
|
"Automatic backup": "自动备份",
|
||||||
"Automatically Assigned Address": "自动分配地址",
|
"Automatically Assigned Address": "自动分配地址",
|
||||||
"Availability Zone": "可用域",
|
"Availability Zone": "可用域",
|
||||||
"Availability Zone Hints": "预期可用域",
|
"Availability Zone Hints": "预期可用域",
|
||||||
@ -808,6 +809,7 @@
|
|||||||
"Instance Info": "云主机信息",
|
"Instance Info": "云主机信息",
|
||||||
"Instance Status": "云主机状态",
|
"Instance Status": "云主机状态",
|
||||||
"Instances": "云主机",
|
"Instances": "云主机",
|
||||||
|
"Instances \"{ name }\" are locked, can not delete them.": "云主机\"{ name }\"被锁定,无法删除。",
|
||||||
"Interface": "网卡",
|
"Interface": "网卡",
|
||||||
"Interface Info": "接口信息",
|
"Interface Info": "接口信息",
|
||||||
"Interface Name:": "网卡ID:",
|
"Interface Name:": "网卡ID:",
|
||||||
@ -932,6 +934,7 @@
|
|||||||
"Manager user": "管理用户",
|
"Manager user": "管理用户",
|
||||||
"Manager user group": "管理用户组",
|
"Manager user group": "管理用户组",
|
||||||
"Manu": "手动",
|
"Manu": "手动",
|
||||||
|
"Manual backup": "手动备份",
|
||||||
"Manual input": "手动输入",
|
"Manual input": "手动输入",
|
||||||
"Manually Assigned Address": "手动分配地址",
|
"Manually Assigned Address": "手动分配地址",
|
||||||
"Manually Specify": "手动指定",
|
"Manually Specify": "手动指定",
|
||||||
@ -1720,15 +1723,12 @@
|
|||||||
"X86 Architecture": "X86架构",
|
"X86 Architecture": "X86架构",
|
||||||
"YAML File": "YAML文件",
|
"YAML File": "YAML文件",
|
||||||
"Yes": "是",
|
"Yes": "是",
|
||||||
"You are not allowed to delete instance \"{ name }\".": "无法删除云主机\"{ name }\"。",
|
|
||||||
"You are not allowed to delete router \"{ name }\".": "无法删除路由器\"{ name }\"。",
|
"You are not allowed to delete router \"{ name }\".": "无法删除路由器\"{ name }\"。",
|
||||||
"You are not allowed to delete snapshot \"{ name }\", which is used by creating volume \"{volumes}\".": "无法删除创建了云硬盘 \"{volumes}\" 的快照 \"{ name }\"。",
|
"You are not allowed to delete snapshot \"{ name }\", which is used by creating volume \"{volumes}\".": "无法删除创建了云硬盘 \"{volumes}\" 的快照 \"{ name }\"。",
|
||||||
"You are not allowed to delete snapshot \"{ name }\".": "无法删除快照\"{ name }\"。",
|
"You are not allowed to delete snapshot \"{ name }\".": "无法删除快照\"{ name }\"。",
|
||||||
"You are not allowed to jump to the console.": "无法跳转到控制台。",
|
"You are not allowed to jump to the console.": "无法跳转到控制台。",
|
||||||
"You are not allowed to stop instance \"{ name }\".": "无法关闭云主机\"{ name }\"。",
|
|
||||||
"You are not allowed to { action } \"{ name }\".": "无法{ action }\"{ name }\"。",
|
"You are not allowed to { action } \"{ name }\".": "无法{ action }\"{ name }\"。",
|
||||||
"You are not allowed to { action } {name}.": "无法{ action }{ name }。",
|
"You are not allowed to { action } {name}.": "无法{ action }{ name }。",
|
||||||
"You are not allowed to {action} \"{ name }\".": "无法{ action }\"{ name }\"。",
|
|
||||||
"You are not allowed to {action}, instance: {name}.": "无法{ action }, 实例名称:{ name }。",
|
"You are not allowed to {action}, instance: {name}.": "无法{ action }, 实例名称:{ name }。",
|
||||||
"You are not allowed to {action}.": "无法{ action }。",
|
"You are not allowed to {action}.": "无法{ action }。",
|
||||||
"You are trying to edit a network that not belong to current project. Please do not continue unless you are quit sure what you are doing.": "你正在尝试编辑非当前 project 的 network 资源,除非你非常确认自己在做什么,否则请不要继续。",
|
"You are trying to edit a network that not belong to current project. Please do not continue unless you are quit sure what you are doing.": "你正在尝试编辑非当前 project 的 network 资源,除非你非常确认自己在做什么,否则请不要继续。",
|
||||||
|
@ -76,13 +76,14 @@ export default class DeleteAction extends ConfirmAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
performErrorMsg = (failedItems) => {
|
performErrorMsg = (failedItems) => {
|
||||||
const instance = isArray(failedItems) ? failedItems[0] : failedItems;
|
const instances = isArray(failedItems) ? failedItems : [failedItems];
|
||||||
let errorMsg = t('You are not allowed to delete instance "{ name }".', {
|
const names = this.getName(instances);
|
||||||
name: instance.name,
|
let errorMsg = t('Instance "{ name }" is locked, can not delete it.', {
|
||||||
|
names,
|
||||||
});
|
});
|
||||||
if (!isNotLocked(instance)) {
|
if (names.length > 1) {
|
||||||
errorMsg = t('Instance "{ name }" is locked, can not delete it.', {
|
errorMsg = t('Instances "{ name }" are locked, can not delete them.', {
|
||||||
name: instance.name,
|
names,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
import { ConfirmAction } from 'containers/Action';
|
import { ConfirmAction } from 'containers/Action';
|
||||||
import { isArray } from 'lodash';
|
import { isArray } from 'lodash';
|
||||||
import { isNotLockedOrAdmin, checkStatus } from 'resources/instance';
|
import { isNotLockedOrAdmin, checkStatus } from 'resources/instance';
|
||||||
@ -52,22 +53,28 @@ export default class RebootAction extends ConfirmAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
performErrorMsg = (failedItems) => {
|
performErrorMsg = (failedItems) => {
|
||||||
const instance = isArray(failedItems) ? failedItems[0] : failedItems;
|
const items = isArray(failedItems) ? failedItems : [failedItems];
|
||||||
let errorMsg = t('You are not allowed to { action } "{ name }".', {
|
const statusErrorItems = items.filter((it) => !this.canReboot(it));
|
||||||
action: this.actionName,
|
const lockedItems = items.filter(
|
||||||
name: instance.name,
|
(it) => !isNotLockedOrAdmin(it, this.isAdminPage)
|
||||||
});
|
);
|
||||||
if (!this.canReboot(instance)) {
|
const msgs = [];
|
||||||
errorMsg = t(
|
if (statusErrorItems.length) {
|
||||||
'Instance "{ name }" status is not in active or shutoff, can not reboot it.',
|
msgs.push(
|
||||||
{ name: instance.name }
|
t(
|
||||||
|
'Instance "{ name }" status is not in active or shutoff, can not reboot it.',
|
||||||
|
{ name: this.getName(statusErrorItems) }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
} else if (!isNotLockedOrAdmin(instance, this.isAdminPage)) {
|
|
||||||
errorMsg = t('Instance "{ name }" is locked, can not reboot it.', {
|
|
||||||
name: instance.name,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return errorMsg;
|
if (lockedItems.length) {
|
||||||
|
msgs.push(
|
||||||
|
t('Instance "{ name }" is locked, can not reboot it.', {
|
||||||
|
name: this.getName(lockedItems),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return msgs.map((it) => <p>{it}</p>);
|
||||||
};
|
};
|
||||||
|
|
||||||
onSubmit = (item) => {
|
onSubmit = (item) => {
|
||||||
|
@ -126,19 +126,19 @@ export default class SoftDelete extends ConfirmAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
performErrorMsg = (failedItems) => {
|
performErrorMsg = (failedItems) => {
|
||||||
const instance = isArray(failedItems) ? failedItems[0] : failedItems;
|
const items = isArray(failedItems) ? failedItems : [failedItems];
|
||||||
let errorMsg = t('You are not allowed to delete instance "{ name }".', {
|
const name = this.getName(items);
|
||||||
name: instance.name,
|
let errorMsg = t('Instance "{ name }" is locked, can not delete it.', {
|
||||||
|
name,
|
||||||
});
|
});
|
||||||
if (!isNotLockedOrAdmin(instance, this.isAdminPage)) {
|
if (items.length > 1) {
|
||||||
errorMsg = t('Instance "{ name }" is locked, can not delete it.', {
|
errorMsg = t('Instances "{ name }" are locked, can not delete them.', {
|
||||||
name: instance.name,
|
name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
onSubmit = (item) => {
|
onSubmit = (item) => {
|
||||||
const { id, isHardDeleted = false, expiredTime } = item || this.item;
|
const { id, isHardDeleted = false, expiredTime } = item || this.item;
|
||||||
if (isHardDeleted) {
|
if (isHardDeleted) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
import { ConfirmAction } from 'containers/Action';
|
import { ConfirmAction } from 'containers/Action';
|
||||||
import { isArray } from 'lodash';
|
import { isArray } from 'lodash';
|
||||||
import {
|
import {
|
||||||
@ -56,22 +57,27 @@ export default class SoftRebootAction extends ConfirmAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
performErrorMsg = (failedItems) => {
|
performErrorMsg = (failedItems) => {
|
||||||
const instance = isArray(failedItems) ? failedItems[0] : failedItems;
|
const items = isArray(failedItems) ? failedItems : [failedItems];
|
||||||
let errorMsg = t('You are not allowed to { action } "{ name }".', {
|
const notActiveItems = items.filter((it) => !this.isActive(it));
|
||||||
action: this.actionName,
|
const lockedItems = items.filter(
|
||||||
name: instance.name,
|
(it) => !isNotLockedOrAdmin(it, this.isAdminPage)
|
||||||
});
|
);
|
||||||
if (!this.isActive(instance)) {
|
const msgs = [];
|
||||||
errorMsg = t(
|
if (notActiveItems.length) {
|
||||||
'Instance "{ name }" status is not active, can not soft reboot it.',
|
msgs.push(
|
||||||
{ name: instance.name }
|
t('Instance "{ name }" status is not active, can not soft reboot it.', {
|
||||||
|
name: this.getName(notActiveItems),
|
||||||
|
})
|
||||||
);
|
);
|
||||||
} else if (!isNotLockedOrAdmin(instance, this.isAdminPage)) {
|
|
||||||
errorMsg = t('Instance "{ name }" is locked, can not soft reboot it.', {
|
|
||||||
name: instance.name,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return errorMsg;
|
if (lockedItems.length) {
|
||||||
|
msgs.push(
|
||||||
|
t('Instance "{ name }" is locked, can not soft reboot it.', {
|
||||||
|
name: this.getName(lockedItems),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return msgs.map((it) => <p>{it}</p>);
|
||||||
};
|
};
|
||||||
|
|
||||||
onSubmit = (item) => {
|
onSubmit = (item) => {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
import { ConfirmAction } from 'containers/Action';
|
import { ConfirmAction } from 'containers/Action';
|
||||||
import { isArray } from 'lodash';
|
import { isArray } from 'lodash';
|
||||||
import { isNotLockedOrAdmin, checkStatus } from 'resources/instance';
|
import { isNotLockedOrAdmin, checkStatus } from 'resources/instance';
|
||||||
@ -56,22 +57,25 @@ export default class StartAction extends ConfirmAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
performErrorMsg = (failedItems) => {
|
performErrorMsg = (failedItems) => {
|
||||||
const instance = isArray(failedItems) ? failedItems[0] : failedItems;
|
const items = isArray(failedItems) ? failedItems : [failedItems];
|
||||||
let errorMsg = t('You are not allowed to {action} "{ name }".', {
|
const lockedItems = items.filter((it) => !isNotLockedOrAdmin(it));
|
||||||
action: this.actionName,
|
const statusErrorItems = items.filter((it) => !this.canStart(it));
|
||||||
name: instance.name,
|
const msgs = [];
|
||||||
});
|
if (lockedItems.length) {
|
||||||
if (!isNotLockedOrAdmin(instance, this.isAdminPage)) {
|
msgs.push(
|
||||||
errorMsg = t('Instance "{ name }" is locked, can not start it.', {
|
t('Instance "{ name }" is locked, can not start it.', {
|
||||||
name: instance.name,
|
name: this.getName(lockedItems),
|
||||||
});
|
})
|
||||||
} else if (!this.canStart(instance)) {
|
|
||||||
errorMsg = t(
|
|
||||||
'Instance "{ name }" status is not shutoff, can not start it.',
|
|
||||||
{ name: instance.name }
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return errorMsg;
|
if (statusErrorItems.length) {
|
||||||
|
msgs.push(
|
||||||
|
t('Instance "{ name }" status is not shutoff, can not start it.', {
|
||||||
|
name: this.getName(statusErrorItems),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return msgs.map((it) => <p>{it}</p>);
|
||||||
};
|
};
|
||||||
|
|
||||||
onSubmit = (item) => {
|
onSubmit = (item) => {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
import { ConfirmAction } from 'containers/Action';
|
import { ConfirmAction } from 'containers/Action';
|
||||||
import { isArray } from 'lodash';
|
import { isArray } from 'lodash';
|
||||||
import { isNotLockedOrAdmin, checkStatus } from 'resources/instance';
|
import { isNotLockedOrAdmin, checkStatus } from 'resources/instance';
|
||||||
@ -56,21 +57,28 @@ export default class Stop extends ConfirmAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
performErrorMsg = (failedItems) => {
|
performErrorMsg = (failedItems) => {
|
||||||
const instance = isArray(failedItems) ? failedItems[0] : failedItems;
|
const items = isArray(failedItems) ? failedItems : [failedItems];
|
||||||
let errorMsg = t('You are not allowed to stop instance "{ name }".', {
|
const notRunningItems = items.filter((it) => !this.isRunning(it));
|
||||||
name: instance.name,
|
const lockedItems = items.filter(
|
||||||
});
|
(it) => !isNotLockedOrAdmin(it, this.isAdminPage)
|
||||||
if (!this.isRunning(instance)) {
|
);
|
||||||
errorMsg = t(
|
const msgs = [];
|
||||||
'Instance "{ name }" status is not in active or suspended, can not stop it.',
|
if (notRunningItems.length) {
|
||||||
{ name: instance.name }
|
msgs.push(
|
||||||
|
t(
|
||||||
|
'Instance "{ name }" status is not in active or suspended, can not stop it.',
|
||||||
|
{ name: this.getName(notRunningItems) }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
} else if (!isNotLockedOrAdmin(instance, this.isAdminPage)) {
|
|
||||||
errorMsg = t('Instance "{ name }" is locked, can not stop it.', {
|
|
||||||
name: instance.name,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return errorMsg;
|
if (lockedItems.length) {
|
||||||
|
msgs.push(
|
||||||
|
t('Instance "{ name }" is locked, can not stop it.', {
|
||||||
|
name: this.getName(lockedItems),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return msgs.map((it) => <p>{it}</p>);
|
||||||
};
|
};
|
||||||
|
|
||||||
onSubmit = (item) => {
|
onSubmit = (item) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user