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 @@