From 85058fe7ba76976a4b28b68567c335c4aadb028f Mon Sep 17 00:00:00 2001 From: ssongliu Date: Fri, 17 Feb 2023 17:59:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20compose=20=E5=88=9B=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E7=A6=81=E7=94=A8=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/container.go | 2 ++ backend/app/service/container.go | 19 ++++++++++++------- frontend/src/api/interface/container.ts | 2 ++ .../views/container/compose/detail/index.vue | 11 +---------- .../src/views/container/container/index.vue | 3 +++ 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/backend/app/dto/container.go b/backend/app/dto/container.go index 650425dae..f387b989e 100644 --- a/backend/app/dto/container.go +++ b/backend/app/dto/container.go @@ -21,6 +21,8 @@ type ContainerInfo struct { CreateTime string `json:"createTime"` State string `json:"state"` RunTime string `json:"runTime"` + + IsFromCompose bool `json:"isFromCompose"` } type ContainerCreate struct { diff --git a/backend/app/service/container.go b/backend/app/service/container.go index f9fe4d2dc..9faaca360 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -94,14 +94,19 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro } for _, container := range records { + IsFromCompose := false + if _, ok := container.Labels[composeProjectLabel]; ok { + IsFromCompose = true + } backDatas = append(backDatas, dto.ContainerInfo{ - ContainerID: container.ID, - CreateTime: time.Unix(container.Created, 0).Format("2006-01-02 15:04:05"), - Name: container.Names[0][1:], - ImageId: strings.Split(container.ImageID, ":")[1], - ImageName: container.Image, - State: container.State, - RunTime: container.Status, + ContainerID: container.ID, + CreateTime: time.Unix(container.Created, 0).Format("2006-01-02 15:04:05"), + Name: container.Names[0][1:], + ImageId: strings.Split(container.ImageID, ":")[1], + ImageName: container.Image, + State: container.State, + RunTime: container.Status, + IsFromCompose: IsFromCompose, }) } diff --git a/frontend/src/api/interface/container.ts b/frontend/src/api/interface/container.ts index fefb58a8e..6126b0207 100644 --- a/frontend/src/api/interface/container.ts +++ b/frontend/src/api/interface/container.ts @@ -42,6 +42,8 @@ export namespace Container { createTime: string; state: string; runTime: string; + + isFromCompose: string; } export interface ContainerStats { cpuPercent: number; diff --git a/frontend/src/views/container/compose/detail/index.vue b/frontend/src/views/container/compose/detail/index.vue index bff5d4d96..b517dad29 100644 --- a/frontend/src/views/container/compose/detail/index.vue +++ b/frontend/src/views/container/compose/detail/index.vue @@ -6,7 +6,7 @@
{{ composeName }}
-
+
{{ $t('container.start') }} @@ -111,7 +111,6 @@ - @@ -124,7 +123,6 @@