mirror of
https://github.com/cuigh/swirl
synced 2025-06-26 18:16:50 +00:00
Support restarting service
This commit is contained in:
@@ -24,6 +24,7 @@ type ServiceController struct {
|
||||
Delete web.HandlerFunc `path:"/:name/delete" method:"post" name:"service.delete" authorize:"!" perm:"write,service,name"`
|
||||
Scale web.HandlerFunc `path:"/:name/scale" method:"post" name:"service.scale" authorize:"!" perm:"write,service,name"`
|
||||
Rollback web.HandlerFunc `path:"/:name/rollback" method:"post" name:"service.rollback" authorize:"!" perm:"write,service,name"`
|
||||
Restart web.HandlerFunc `path:"/:name/restart" method:"post" name:"service.restart" authorize:"!" perm:"write,service,name"`
|
||||
New web.HandlerFunc `path:"/new" name:"service.new" authorize:"!" desc:"new service page"`
|
||||
Create web.HandlerFunc `path:"/new" method:"post" name:"service.create" authorize:"!" desc:"create service"`
|
||||
Edit web.HandlerFunc `path:"/:name/edit" name:"service.edit" authorize:"!" perm:"write,service,name"`
|
||||
@@ -47,6 +48,7 @@ func Service() (c *ServiceController) {
|
||||
Update: serviceUpdate,
|
||||
Scale: serviceScale,
|
||||
Rollback: serviceRollback,
|
||||
Restart: serviceRestart,
|
||||
PermEdit: servicePermEdit,
|
||||
PermUpdate: permUpdate("service", "name"),
|
||||
Stats: serviceStats,
|
||||
@@ -271,6 +273,15 @@ func serviceRollback(ctx web.Context) error {
|
||||
return ajaxResult(ctx, err)
|
||||
}
|
||||
|
||||
func serviceRestart(ctx web.Context) error {
|
||||
name := ctx.F("name")
|
||||
err := docker.ServiceRestart(name)
|
||||
if err == nil {
|
||||
biz.Event.CreateService(model.EventActionRestart, name, ctx.User())
|
||||
}
|
||||
return ajaxResult(ctx, err)
|
||||
}
|
||||
|
||||
func servicePermEdit(ctx web.Context) error {
|
||||
name := ctx.P("name")
|
||||
m := newModel(ctx).Set("Name", name)
|
||||
|
||||
Reference in New Issue
Block a user