From f801b77f830fe272e1e244ddf89658276d294c18 Mon Sep 17 00:00:00 2001 From: xusongfu Date: Thu, 4 Aug 2022 10:08:22 +0800 Subject: [PATCH] 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 --- src/locales/en.json | 2 + src/locales/zh.json | 2 + .../Containers/actions/ForceDelete.jsx | 4 ++ .../containers/Containers/actions/index.jsx | 50 +++++++++++++------ 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 539fe6a4..0da791c8 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -428,6 +428,7 @@ "Container Rebooting": "Container Rebooting", "Container Rebuilding": "Container Rebuilding", "Container Starting": "Container Starting", + "Container Status": "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: 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.": "Quota: Insufficient { name } quota to create resources.", "Quota: Project quotas sufficient resources can be created": "Quota: Project quotas sufficient resources can be created", "RAM": "RAM", "RAM(MiB)": "RAM(MiB)", diff --git a/src/locales/zh.json b/src/locales/zh.json index daec8ace..f7db102e 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -428,6 +428,7 @@ "Container Rebooting": "容器重启中", "Container Rebuilding": "容器重建中", "Container Starting": "容器启动中", + "Container Status": "容器状态", "Container Stopping": "容器关闭中", "Container Version": "容器版本", "Containers": "容器", @@ -1846,6 +1847,7 @@ "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 { 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": "配额:项目配额充足,可创建资源", "RAM": "内存", "RAM(MiB)": "内存(MiB)", diff --git a/src/pages/container-service/containers/Containers/actions/ForceDelete.jsx b/src/pages/container-service/containers/Containers/actions/ForceDelete.jsx index 8651ec6d..666558e6 100644 --- a/src/pages/container-service/containers/Containers/actions/ForceDelete.jsx +++ b/src/pages/container-service/containers/Containers/actions/ForceDelete.jsx @@ -31,6 +31,10 @@ export default class ForceDeleteContainer extends ConfirmAction { return t('Force Delete'); } + get isDanger() { + return true; + } + policy = 'container:delete_force'; aliasPolicy = 'zun:container:delete_force'; diff --git a/src/pages/container-service/containers/Containers/actions/index.jsx b/src/pages/container-service/containers/Containers/actions/index.jsx index 651c90e2..117c4f43 100644 --- a/src/pages/container-service/containers/Containers/actions/index.jsx +++ b/src/pages/container-service/containers/Containers/actions/index.jsx @@ -24,24 +24,33 @@ import KillContainer from './Kill'; import ForceDeleteContainer from './ForceDelete'; import ExecuteCommandContainer from './ExecuteCommand'; -const moreActions = [ - { action: StartContainer }, - { action: StopContainer }, - { action: RebootContainer }, - { action: KillContainer }, - { action: RebuildContainer }, - { action: DeleteContainer }, - { action: ForceDeleteContainer }, +const statusActions = [ + StartContainer, + StopContainer, + RebootContainer, + KillContainer, + RebuildContainer, ]; const actionConfigs = { rowActions: { - firstAction: EditContainer, + firstAction: DeleteContainer, moreActions: [ - { action: PauseContainer }, - { action: UnpauseContainer }, - { action: ExecuteCommandContainer }, - ...moreActions, + { + title: t('Container Status'), + actions: [ + ...statusActions, + PauseContainer, + UnpauseContainer, + ExecuteCommandContainer, + ], + }, + { + action: EditContainer, + }, + { + action: ForceDeleteContainer, + }, ], }, batchActions: [DeleteContainer], @@ -49,8 +58,19 @@ const actionConfigs = { }; const actionConfigsAdmin = { rowActions: { - firstAction: EditContainer, - moreActions, + firstAction: DeleteContainer, + moreActions: [ + { + title: t('Container Status'), + actions: statusActions, + }, + { + action: EditContainer, + }, + { + action: ForceDeleteContainer, + }, + ], }, batchActions: [DeleteContainer], primaryActions: [],