frontend: only pass runner to MakeFrontend, add Runner.GetSubmitQueue()
This commit is contained in:
parent
fecbf8b3e2
commit
40b2f11543
3 changed files with 9 additions and 2 deletions
|
@ -42,9 +42,11 @@ func loadTemplate(templateName string, funcMap template.FuncMap) (*template.Temp
|
|||
}
|
||||
|
||||
// MakeFrontend configures the router and returns a new Frontend struct
|
||||
func MakeFrontend(runner *submitqueue.Runner, submitQueue *submitqueue.SubmitQueue) *Frontend {
|
||||
func MakeFrontend(runner *submitqueue.Runner) *Frontend {
|
||||
router := gin.Default()
|
||||
|
||||
submitQueue := runner.GetSubmitQueue()
|
||||
|
||||
funcMap := template.FuncMap{
|
||||
"isAutoSubmittable": func(serie *submitqueue.Serie) bool {
|
||||
return submitQueue.IsAutoSubmittable(serie)
|
||||
|
|
2
main.go
2
main.go
|
@ -91,7 +91,7 @@ func main() {
|
|||
submitQueue := submitqueue.MakeSubmitQueue(gerritClient, projectName, branchName, submitQueueTag)
|
||||
runner := submitqueue.NewRunner(submitQueue)
|
||||
|
||||
handler := frontend.MakeFrontend(runner, submitQueue)
|
||||
handler := frontend.MakeFrontend(runner)
|
||||
|
||||
// fetch only on first run
|
||||
runner.Trigger(true)
|
||||
|
|
|
@ -28,6 +28,11 @@ func (r *Runner) GetResults() (*time.Time, []*Result) {
|
|||
return r.currentlyRunning, r.results
|
||||
}
|
||||
|
||||
// GetSubmitQueue returns the submit queue object, to be consumed by the frontend
|
||||
func (r *Runner) GetSubmitQueue() (*SubmitQueue) {
|
||||
return r.SubmitQueue
|
||||
}
|
||||
|
||||
// Trigger starts a new batch job
|
||||
// TODO: make sure only one batch job is started at the same time
|
||||
// if a batch job is already started, ignore the newest request
|
||||
|
|
Loading…
Reference in a new issue