From b6bc988c76dc28f405627f26a68b27ee1fbd1522 Mon Sep 17 00:00:00 2001 From: cuigh Date: Fri, 19 Jan 2018 15:50:18 +0800 Subject: [PATCH] Show update status --- config/i18n/en.yml | 1 + config/i18n/zh.yml | 1 + main.go | 2 +- model/docker.go | 18 +++++++++++------- views/service/detail.jet | 4 ++++ views/service/list.jet | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/config/i18n/en.yml b/config/i18n/en.yml index 82afbe9..5bc0022 100644 --- a/config/i18n/en.yml +++ b/config/i18n/en.yml @@ -126,6 +126,7 @@ network.description: Networks are user-defined networks that containers can be a service.title: Service service.description: Services are the definitions of tasks to run on a swarm. service.edit.warning: "NOTE: This service belong to '%s' stack, usually you should modify original compose instead of updating it directly." +service.field.update-status: "Update status" # service template pages service.template.title: Service Template diff --git a/config/i18n/zh.yml b/config/i18n/zh.yml index 3c83d60..744998f 100644 --- a/config/i18n/zh.yml +++ b/config/i18n/zh.yml @@ -126,6 +126,7 @@ network.description: 能够连接到容器的 Docker 预置和用户自定义的 service.title: 服务 service.description: 服务是在 Swarm 集群中运行的任务定义。 service.edit.warning: "注意: 这个服务属于编排 %s,通常你应该修改原始的编排而不是直接修改此服务信息,否则后续重新部署编排时这些修改将会丢失。" +service.field.update-status: "更新状态" # service template pages service.template.title: 服务模板 diff --git a/main.go b/main.go index db92f0f..400bbf5 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ func main() { misc.BindOptions() app.Name = "Swirl" - app.Version = "0.6.5" + app.Version = "0.6.6" app.Desc = "A web management UI for Docker, focused on swarm cluster" app.Action = func(ctx *app.Context) { misc.LoadOptions() diff --git a/model/docker.go b/model/docker.go index 7410818..375145e 100644 --- a/model/docker.go +++ b/model/docker.go @@ -93,13 +93,14 @@ type StackListInfo struct { } type ServiceListInfo struct { - Name string - Image string - Mode string - Actives uint64 - Replicas uint64 - UpdatedAt time.Time - Rollback bool + Name string + Image string + Mode string + Actives uint64 + Replicas uint64 + Rollback bool + UpdatedAt time.Time + UpdateStatus string } func NewServiceListInfo(service swarm.Service, actives uint64) *ServiceListInfo { @@ -110,6 +111,9 @@ func NewServiceListInfo(service swarm.Service, actives uint64) *ServiceListInfo UpdatedAt: service.UpdatedAt.Local(), Rollback: service.PreviousSpec != nil, } + if service.UpdateStatus != nil { + info.UpdateStatus = string(service.UpdateStatus.State) + } if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil { info.Mode = "replicated" info.Replicas = *service.Spec.Mode.Replicated.Replicas diff --git a/views/service/detail.jet b/views/service/detail.jet index 301b092..16fca1c 100644 --- a/views/service/detail.jet +++ b/views/service/detail.jet @@ -72,6 +72,10 @@
{{ time(.Service.CreatedAt) }}
{{ i18n("field.updated-at") }}
{{ time(.Service.UpdatedAt) }}
+ {{ if .Service.UpdateStatus }} +
{{ i18n("service.field.update-status") }}
+
{{ .Service.UpdateStatus.State }}({{ .Service.UpdateStatus.Message }})
+ {{ end }} diff --git a/views/service/list.jet b/views/service/list.jet index bd5d6d2..d5f2a2a 100644 --- a/views/service/list.jet +++ b/views/service/list.jet @@ -58,7 +58,7 @@ {{.Actives}}/{{.Replicas}} - {{time(.UpdatedAt)}} + {{time(.UpdatedAt)}}{{ if .UpdateStatus }}{{ end }}