Add API endpoint to pause a worker

This commit is contained in:
simon987
2019-05-05 19:09:45 -04:00
parent 8f10567bd0
commit 72c8e18044
8 changed files with 378 additions and 231 deletions

View File

@@ -200,6 +200,14 @@ func (api *WebAPI) GetTaskFromProject(r *Request) {
return
}
if worker.Paused {
r.Json(JsonResponse{
Ok: false,
Message: "A manager has paused you",
}, 400)
return
}
project, err := strconv.ParseInt(r.Ctx.UserValue("project").(string), 10, 64)
if err != nil || project <= 0 {
r.Json(JsonResponse{