feat(runner): make admin runner template as common template, use for org runners setting

This commit is contained in:
fuxiaohei
2022-10-20 22:41:41 +08:00
committed by Jason Song
parent dca2ca2f47
commit 25fe4f6d9e
11 changed files with 414 additions and 214 deletions

33
services/forms/runner.go Normal file
View File

@ -0,0 +1,33 @@
package forms
import (
"net/http"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/web/middleware"
"gitea.com/go-chi/binding"
)
// EditRunnerForm form for admin to create runner
type EditRunnerForm struct {
Description string
CustomLabels string
}
// Validate validates form fields
func (f *EditRunnerForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}
// CreateRunnerForm form for admin to create runner
type CreateRunnerForm struct {
Name string `binding:"Required"`
Type string
}
// Validate validates form fields
func (f *CreateRunnerForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}