fix: fix the action collection of zun container

1. Put the status operations in one collection
2. Add danger style to force delete

Change-Id: Ic0d18fe0e5b2148b78e1c7d24e1948160d1c43c5
This commit is contained in:
xusongfu 2022-08-04 10:08:22 +08:00
parent 88d877cde2
commit f801b77f83
4 changed files with 43 additions and 15 deletions

View File

@ -428,6 +428,7 @@
"Container Rebooting": "Container Rebooting", "Container Rebooting": "Container Rebooting",
"Container Rebuilding": "Container Rebuilding", "Container Rebuilding": "Container Rebuilding",
"Container Starting": "Container Starting", "Container Starting": "Container Starting",
"Container Status": "Container Status",
"Container Stopping": "Container Stopping", "Container Stopping": "Container Stopping",
"Container Version": "Container Version", "Container Version": "Container Version",
"Containers": "Containers", "Containers": "Containers",
@ -1846,6 +1847,7 @@
"Quota of key pair means: the number of allowed key pairs for each user.": "Quota of key pair means: the number of allowed key pairs for each user.", "Quota of key pair means: the number of allowed key pairs for each user.": "Quota of key pair means: the number of allowed key pairs for each user.",
"Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).", "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).",
"Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).": "Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).", "Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).": "Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).",
"Quota: Insufficient { name } quota to create resources.": "Quota: Insufficient { name } quota to create resources.",
"Quota: Project quotas sufficient resources can be created": "Quota: Project quotas sufficient resources can be created", "Quota: Project quotas sufficient resources can be created": "Quota: Project quotas sufficient resources can be created",
"RAM": "RAM", "RAM": "RAM",
"RAM(MiB)": "RAM(MiB)", "RAM(MiB)": "RAM(MiB)",

View File

@ -428,6 +428,7 @@
"Container Rebooting": "容器重启中", "Container Rebooting": "容器重启中",
"Container Rebuilding": "容器重建中", "Container Rebuilding": "容器重建中",
"Container Starting": "容器启动中", "Container Starting": "容器启动中",
"Container Status": "容器状态",
"Container Stopping": "容器关闭中", "Container Stopping": "容器关闭中",
"Container Version": "容器版本", "Container Version": "容器版本",
"Containers": "容器", "Containers": "容器",
@ -1846,6 +1847,7 @@
"Quota of key pair means: the number of allowed key pairs for each user.": "密钥的配额表示:每个用户允许创建的密钥数量。", "Quota of key pair means: the number of allowed key pairs for each user.": "密钥的配额表示:每个用户允许创建的密钥数量。",
"Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "配额:项目配额不足,无法创建资源,请进行资源数量或配额的调整(剩余{ quota },输入{ input })。", "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "配额:项目配额不足,无法创建资源,请进行资源数量或配额的调整(剩余{ quota },输入{ input })。",
"Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).": "配额:{ name } 配额不足,无法创建资源,请进行资源数量或配额的调整(剩余{ left },输入{ input })。", "Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).": "配额:{ name } 配额不足,无法创建资源,请进行资源数量或配额的调整(剩余{ left },输入{ input })。",
"Quota: Insufficient { name } quota to create resources.": "配额:{ name } 配额不足,无法创建资源。",
"Quota: Project quotas sufficient resources can be created": "配额:项目配额充足,可创建资源", "Quota: Project quotas sufficient resources can be created": "配额:项目配额充足,可创建资源",
"RAM": "内存", "RAM": "内存",
"RAM(MiB)": "内存MiB", "RAM(MiB)": "内存MiB",

View File

@ -31,6 +31,10 @@ export default class ForceDeleteContainer extends ConfirmAction {
return t('Force Delete'); return t('Force Delete');
} }
get isDanger() {
return true;
}
policy = 'container:delete_force'; policy = 'container:delete_force';
aliasPolicy = 'zun:container:delete_force'; aliasPolicy = 'zun:container:delete_force';

View File

@ -24,24 +24,33 @@ import KillContainer from './Kill';
import ForceDeleteContainer from './ForceDelete'; import ForceDeleteContainer from './ForceDelete';
import ExecuteCommandContainer from './ExecuteCommand'; import ExecuteCommandContainer from './ExecuteCommand';
const moreActions = [ const statusActions = [
{ action: StartContainer }, StartContainer,
{ action: StopContainer }, StopContainer,
{ action: RebootContainer }, RebootContainer,
{ action: KillContainer }, KillContainer,
{ action: RebuildContainer }, RebuildContainer,
{ action: DeleteContainer },
{ action: ForceDeleteContainer },
]; ];
const actionConfigs = { const actionConfigs = {
rowActions: { rowActions: {
firstAction: EditContainer, firstAction: DeleteContainer,
moreActions: [ moreActions: [
{ action: PauseContainer }, {
{ action: UnpauseContainer }, title: t('Container Status'),
{ action: ExecuteCommandContainer }, actions: [
...moreActions, ...statusActions,
PauseContainer,
UnpauseContainer,
ExecuteCommandContainer,
],
},
{
action: EditContainer,
},
{
action: ForceDeleteContainer,
},
], ],
}, },
batchActions: [DeleteContainer], batchActions: [DeleteContainer],
@ -49,8 +58,19 @@ const actionConfigs = {
}; };
const actionConfigsAdmin = { const actionConfigsAdmin = {
rowActions: { rowActions: {
firstAction: EditContainer, firstAction: DeleteContainer,
moreActions, moreActions: [
{
title: t('Container Status'),
actions: statusActions,
},
{
action: EditContainer,
},
{
action: ForceDeleteContainer,
},
],
}, },
batchActions: [DeleteContainer], batchActions: [DeleteContainer],
primaryActions: [], primaryActions: [],