mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-31 04:52:52 +09:00
feat(runner): make admin runner template as common template, use for org runners setting
This commit is contained in:
33
services/forms/runner.go
Normal file
33
services/forms/runner.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user