job.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package http
  2. import (
  3. "go-common/app/admin/ep/melloi/model"
  4. bm "go-common/library/net/http/blademaster"
  5. "go-common/library/net/http/blademaster/binding"
  6. )
  7. func addJob(c *bm.Context) {
  8. job := model.Job{}
  9. if err := c.BindWith(&job, binding.JSON); nil != err {
  10. c.JSON(nil, err)
  11. return
  12. }
  13. c.JSON(srv.AddJob(c, job))
  14. }
  15. func deleteJob(c *bm.Context) {
  16. name := c.Request.Form.Get("name")
  17. c.JSON(srv.DeleteJob(c, name))
  18. }
  19. func deleteJobBatch(c *bm.Context) {
  20. JobBatch := model.JobBatch{}
  21. if err := c.BindWith(&JobBatch, binding.JSON); nil != err {
  22. c.JSON(nil, err)
  23. return
  24. }
  25. c.JSON(srv.DeleteJobBatch(c, JobBatch), nil)
  26. }
  27. //Job get job info
  28. func Job(c *bm.Context) {
  29. name := c.Request.Form.Get("name")
  30. c.JSON(srv.Job(c, name))
  31. }
  32. func forceDelete(c *bm.Context) {
  33. ptestJob := model.PtestJob{}
  34. if err := c.BindWith(&ptestJob, binding.Form); err != nil {
  35. c.JSON(nil, err)
  36. return
  37. }
  38. c.JSON(srv.ForceDeleteJob(c, ptestJob.ReportSuID))
  39. }
  40. func queryClearnableDocker(c *bm.Context) {
  41. c.JSON(srv.QueryCleanableDocker(c))
  42. }
  43. func cleanNotRunningJob(c *bm.Context) {
  44. c.JSON(nil, srv.CleanJob(c))
  45. }