mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-30 12:32:49 +09:00
feat(runner): begin runner view ui
This commit is contained in:
@ -19,6 +19,7 @@ import (
|
||||
|
||||
// ErrRunnerNotExist represents an error for bot runner not exist
|
||||
type ErrRunnerNotExist struct {
|
||||
ID int64
|
||||
UUID string
|
||||
Token string
|
||||
}
|
||||
@ -79,6 +80,7 @@ type FindRunnerOptions struct {
|
||||
db.ListOptions
|
||||
RepoID int64
|
||||
OwnerID int64
|
||||
Sort string
|
||||
}
|
||||
|
||||
func (opts FindRunnerOptions) toCond() builder.Cond {
|
||||
@ -140,6 +142,20 @@ func GetRunnerByUUID(uuid string) (*Runner, error) {
|
||||
return &runner, nil
|
||||
}
|
||||
|
||||
// GetRunnerByID returns a bot runner via id
|
||||
func GetRunnerByID(id int64) (*Runner, error) {
|
||||
var runner Runner
|
||||
has, err := db.GetEngine(db.DefaultContext).Where("id=?", id).Get(&runner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrRunnerNotExist{
|
||||
ID: id,
|
||||
}
|
||||
}
|
||||
return &runner, nil
|
||||
}
|
||||
|
||||
// GetRunnerByToken returns a bot runner via token
|
||||
func GetRunnerByToken(token string) (*Runner, error) {
|
||||
var runner Runner
|
||||
|
Reference in New Issue
Block a user