mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-31 18:10:50 +01:00
refactor: updated task related grpc proto
This commit is contained in:
@@ -365,6 +365,10 @@ func PostTaskRestart(c *gin.Context) {
|
||||
}
|
||||
|
||||
func PostTaskCancel(c *gin.Context) {
|
||||
type Payload struct {
|
||||
Force bool `json:"force,omitempty"`
|
||||
}
|
||||
|
||||
// id
|
||||
id, err := primitive.ObjectIDFromHex(c.Param("id"))
|
||||
if err != nil {
|
||||
@@ -372,6 +376,13 @@ func PostTaskCancel(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// payload
|
||||
var p Payload
|
||||
if err := c.ShouldBindJSON(&p); err != nil {
|
||||
HandleErrorBadRequest(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
// task
|
||||
t, err := service.NewModelServiceV2[models.TaskV2]().GetById(id)
|
||||
if err != nil {
|
||||
@@ -393,7 +404,7 @@ func PostTaskCancel(c *gin.Context) {
|
||||
HandleErrorInternalServerError(c, err)
|
||||
return
|
||||
}
|
||||
if err := schedulerSvc.Cancel(id, u.Id); err != nil {
|
||||
if err := schedulerSvc.Cancel(id, u.Id, p.Force); err != nil {
|
||||
HandleErrorInternalServerError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user