Esempio n. 1
0
func (w *WebGrabberController) StartService(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.Process([]interface{}{o})
	if err != nil {
		return helper.CreateResult(false, nil, err.Error())
	}

	return helper.CreateResult(isRun, nil, "")
}
Esempio n. 2
0
func (a *DashboardController) Startservice(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)
	// fmt.Println(ds)
	er, isRun := modules.Process(ds)
	if er != nil {
		return er.Error()
	}

	return isRun
}