1
1
mirror of https://github.com/go-gitea/gitea synced 2025-10-26 08:58:24 +00:00
Files
gitea/services/forms/runner.go
Jason Song 066097a0fb Update services/forms/runner.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 20:38:24 +08:00

38 lines
960 B
Go

// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
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 // comma-separated
}
// 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)
}