mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Add warning when editing a service belongs to a stack
This commit is contained in:
parent
b0c0d3a0d9
commit
ec76dbc318
@ -120,6 +120,7 @@ network.description: Networks are user-defined networks that containers can be a
|
||||
# service pages
|
||||
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 template pages
|
||||
service.template.title: Service Template
|
||||
|
@ -120,6 +120,7 @@ network.description: 能够连接到容器的 Docker 预置和用户自定义的
|
||||
# service pages
|
||||
service.title: 服务
|
||||
service.description: 服务是在 Swarm 集群中运行的任务定义。
|
||||
service.edit.warning: "注意: 这个服务属于编排 %s,通常你应该修改原始的编排而不是直接修改此服务信息,否则后续重新部署编排时这些修改将会丢失。"
|
||||
|
||||
# service template pages
|
||||
service.template.title: 服务模板
|
||||
|
@ -222,9 +222,10 @@ func serviceEdit(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
stack := service.Spec.Labels["com.docker.stack.namespace"]
|
||||
checkedNetworks := set.FromSlice(service.Endpoint.VirtualIPs, func(i int) interface{} { return service.Endpoint.VirtualIPs[i].NetworkID })
|
||||
|
||||
m := newModel(ctx).Add("Service", model.NewServiceInfo(service)).
|
||||
m := newModel(ctx).Add("Service", model.NewServiceInfo(service)).Add("Stack", stack).
|
||||
Add("Networks", networks).Add("CheckedNetworks", checkedNetworks).
|
||||
Add("Secrets", secrets).Add("Configs", configs)
|
||||
return ctx.Render("service/edit", m)
|
||||
|
@ -53,7 +53,10 @@ func Message(lang string) func(key string, args ...interface{}) string {
|
||||
}
|
||||
|
||||
return func(key string, args ...interface{}) string {
|
||||
return t.Format(key, args...)
|
||||
if s := t.Format(key, args...); s != "" {
|
||||
return s
|
||||
}
|
||||
return "[" + key + "]"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,9 @@
|
||||
{{ yield form_others() }}
|
||||
{{ yield form_submit(url="/service/") }}
|
||||
</form>
|
||||
{{ if .Stack }}
|
||||
<div class="notification is-warning" style="margin-top: 1.5em">{{ i18n("service.edit.warning", .Stack) }}</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
{{ yield dialog(name="secret", items=.Secrets) }}
|
||||
|
Loading…
Reference in New Issue
Block a user