add runners management ui

This commit is contained in:
Lunny Xiao
2022-06-20 16:31:54 +08:00
committed by Jason Song
parent 2ea693cdd2
commit 931d8c2c21
13 changed files with 779 additions and 123 deletions

View File

@@ -24,7 +24,7 @@ func PushToQueue(task *bots_model.Build) {
// Dispatch assign a task to a runner
func Dispatch(task *bots_model.Build) (*bots_model.Runner, error) {
runner, err := bots_model.GetUsableRunner(bots_model.GetRunnerOptions{
runner, err := bots_model.GetUsableRunner(bots_model.FindRunnerOptions{
RepoID: task.RepoID,
})
if err != nil {

View File

@@ -71,3 +71,27 @@ func (f *AdminDashboardForm) Validate(req *http.Request, errs binding.Errors) bi
ctx := context.GetContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}
// AdminCreateRunnerForm form for admin to create runner
type AdminCreateRunnerForm struct {
Name string `binding:"Required"`
Type string
}
// Validate validates form fields
func (f *AdminCreateRunnerForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}
// AdminEditRunnerForm form for admin to create runner
type AdminEditRunnerForm struct {
Name string `binding:"Required"`
Type string
}
// Validate validates form fields
func (f *AdminEditRunnerForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}