mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-30 12:32:49 +09:00
feat(runner): delete runner from admin html page
This commit is contained in:
@ -97,10 +97,11 @@ func init() {
|
||||
|
||||
type FindRunnerOptions struct {
|
||||
db.ListOptions
|
||||
RepoID int64
|
||||
OwnerID int64
|
||||
Sort string
|
||||
Filter string
|
||||
RepoID int64
|
||||
OwnerID int64
|
||||
Sort string
|
||||
Filter string
|
||||
WithDeleted bool
|
||||
}
|
||||
|
||||
func (opts FindRunnerOptions) toCond() builder.Cond {
|
||||
@ -115,6 +116,9 @@ func (opts FindRunnerOptions) toCond() builder.Cond {
|
||||
if opts.Filter != "" {
|
||||
cond = cond.And(builder.Like{"name", opts.Filter})
|
||||
}
|
||||
if !opts.WithDeleted {
|
||||
cond = cond.And(builder.IsNull{"deleted"})
|
||||
}
|
||||
return cond
|
||||
}
|
||||
|
||||
@ -208,9 +212,9 @@ func GetRunnerByToken(token string) (*Runner, error) {
|
||||
}
|
||||
|
||||
// UpdateRunner updates runner's information.
|
||||
func UpdateRunner(ctx context.Context, r *Runner, cols ...string) (err error) {
|
||||
func UpdateRunner(ctx context.Context, r *Runner, cols ...string) error {
|
||||
e := db.GetEngine(ctx)
|
||||
|
||||
var err error
|
||||
if len(cols) == 0 {
|
||||
_, err = e.ID(r.ID).AllCols().Update(r)
|
||||
} else {
|
||||
@ -219,6 +223,12 @@ func UpdateRunner(ctx context.Context, r *Runner, cols ...string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteRunner(ctx context.Context, r *Runner) error {
|
||||
e := db.GetEngine(ctx)
|
||||
_, err := e.Delete(r)
|
||||
return err
|
||||
}
|
||||
|
||||
// FindRunnersByRepoID returns all workers for the repository
|
||||
func FindRunnersByRepoID(repoID int64) ([]*Runner, error) {
|
||||
var runners []*Runner
|
||||
|
Reference in New Issue
Block a user