Example #1
0
func (w *WebGrabberController) StopService(r *knot.WebContext) interface{} {
	r.Config.OutputType = knot.OutputJson
	w.PrepareHistoryPath()

	payload := new(colonycore.WebGrabber)
	err := r.GetPayload(payload)
	if err != nil {
		return helper.CreateResult(false, nil, err.Error())
	}

	err = colonycore.Get(payload, payload.ID)
	if err != nil {
		return helper.CreateResult(false, nil, err.Error())
	}

	o, err := toolkit.ToM(payload)
	if err != nil {
		return helper.CreateResult(false, nil, err.Error())
	}

	err, isRun := modules.StopProcess([]interface{}{o})
	if err != nil {
		return helper.CreateResult(false, nil, err.Error())
	}

	return helper.CreateResult(isRun, nil, "")
}
Example #2
0
func (a *DashboardController) Stopservice(k *knot.WebContext) interface{} {
	k.Config.OutputType = knot.OutputJson

	a.PrepareHistoryPath()

	t := struct {
		NameId string
	}{}
	e := k.GetPayload(&t)
	if e != nil {
		return e.Error()
	}

	ds, _ := Getquery(t.NameId)
	er, isRun := modules.StopProcess(ds)
	if er != nil {
		return er.Error()
	}

	return isRun
}