From 14e2ced3da493efb533d36219335e0f4aeb4e703 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 28 Dec 2023 11:44:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=B9=E5=99=A8=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=87=E6=BB=A4=E5=BA=94=E7=94=A8=E5=95=86?= =?UTF-8?q?=E5=BA=97=E5=AE=B9=E5=99=A8=E5=8A=9F=E8=83=BD=20(#3469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/container.go | 11 ++++++----- backend/app/service/container.go | 13 ++++++++++++- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/views/container/container/index.vue | 11 +++++++++++ 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/backend/app/dto/container.go b/backend/app/dto/container.go index 5ed8280c3..add8e3670 100644 --- a/backend/app/dto/container.go +++ b/backend/app/dto/container.go @@ -4,11 +4,12 @@ import "time" type PageContainer struct { PageInfo - Name string `json:"name"` - State string `json:"state" validate:"required,oneof=all created running paused restarting removing exited dead"` - OrderBy string `json:"orderBy"` - Order string `json:"order"` - Filters string `json:"filters"` + Name string `json:"name"` + State string `json:"state" validate:"required,oneof=all created running paused restarting removing exited dead"` + OrderBy string `json:"orderBy"` + Order string `json:"order"` + Filters string `json:"filters"` + ExcludeAppStore bool `json:"excludeAppStore"` } type InspectReq struct { diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 9796ae822..e77e1930d 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -89,10 +89,21 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro options.Filters = filters.NewArgs() options.Filters.Add("label", req.Filters) } - list, err = client.ContainerList(context.Background(), options) + containers, err := client.ContainerList(context.Background(), options) if err != nil { return 0, nil, err } + if req.ExcludeAppStore { + for _, item := range containers { + if created, ok := item.Labels[composeCreatedBy]; ok && created == "Apps" { + continue + } + list = append(list, item) + } + } else { + list = containers + } + if len(req.Name) != 0 { length, count := len(list), 0 for count < length { diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 5acb1cfed..593bbedb6 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -758,6 +758,7 @@ const message = { 'Saving the Socket Path setting may result in Docker service being unavailable. Do you want to continue?', sockPathErr: 'Please select or enter the correct Docker sock file path', related: 'Related resources', + includeAppstore: 'Show app store container', }, cronjob: { create: 'Create Cronjob', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 3c2ecec7a..a3dfa0748 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -729,6 +729,7 @@ const message = { sockPathMsg: '保存設定 Socket 路徑可能導致 Docker 服務不可用,是否繼續?', sockPathErr: '請選擇或輸入正確的 Docker sock 文件路徑', related: '相關資源', + includeAppstore: '顯示應用程式商店容器', }, cronjob: { create: '創建計劃任務', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index f1442c4eb..8e2fee62a 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -730,6 +730,7 @@ const message = { sockPathMsg: '保存设置 Socket 路径可能导致 Docker 服务不可用,是否继续?', sockPathErr: '请选择或输入正确的 Docker sock 文件路径', related: '关联资源', + includeAppstore: '显示应用商店容器', }, cronjob: { create: '创建计划任务', diff --git a/frontend/src/views/container/container/index.vue b/frontend/src/views/container/container/index.vue index c054872d6..2eb4ded92 100644 --- a/frontend/src/views/container/container/index.vue +++ b/frontend/src/views/container/container/index.vue @@ -6,6 +6,15 @@ {{ $t('container.startIn') }} + + + + + {{ $t('container.includeAppstore') }} + + + + @@ -347,6 +356,7 @@ const searchState = ref('all'); const dialogUpgradeRef = ref(); const dialogPortJumpRef = ref(); const opRef = ref(); +const includeAppStore = ref(true); const dockerStatus = ref('Running'); const loadStatus = async () => { @@ -410,6 +420,7 @@ const search = async (column?: any) => { filters: filterItem, orderBy: paginationConfig.orderBy, order: paginationConfig.order, + excludeAppStore: !includeAppStore.value, }; loading.value = true; loadStats();