rename builds -> bots
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package builds
|
||||
package bots
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
@@ -18,28 +18,28 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
tplListBuilds base.TplName = "repo/builds/list"
|
||||
tplViewBuild base.TplName = "repo/builds/view"
|
||||
tplListBots base.TplName = "repo/bots/list"
|
||||
tplViewBuild base.TplName = "repo/bots/view"
|
||||
)
|
||||
|
||||
// MustEnableBuilds check if builds are enabled in settings
|
||||
func MustEnableBuilds(ctx *context.Context) {
|
||||
if unit.TypeBuilds.UnitGlobalDisabled() {
|
||||
ctx.NotFound("EnableTypeBuilds", nil)
|
||||
// MustEnableBots check if bots are enabled in settings
|
||||
func MustEnableBots(ctx *context.Context) {
|
||||
if unit.TypeBots.UnitGlobalDisabled() {
|
||||
ctx.NotFound("MustEnableBots", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.Repository != nil {
|
||||
if !ctx.Repo.CanRead(unit.TypeBuilds) {
|
||||
ctx.NotFound("MustEnableBuilds", nil)
|
||||
if !ctx.Repo.CanRead(unit.TypeBots) {
|
||||
ctx.NotFound("MustEnableBots", nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func List(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.builds")
|
||||
ctx.Data["PageIsBuilds"] = true
|
||||
ctx.Data["Title"] = ctx.Tr("repo.bots")
|
||||
ctx.Data["PageIsBots"] = true
|
||||
|
||||
defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
|
||||
if err != nil {
|
||||
@@ -118,11 +118,11 @@ func List(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Builds"] = runs
|
||||
ctx.Data["Runs"] = runs
|
||||
|
||||
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplListBuilds)
|
||||
ctx.HTML(http.StatusOK, tplListBots)
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
package builds
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package bots
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -18,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func View(ctx *context_module.Context) {
|
||||
ctx.Data["PageIsBuilds"] = true
|
||||
ctx.Data["PageIsBots"] = true
|
||||
runIndex := ctx.ParamsInt64("run")
|
||||
jobIndex := ctx.ParamsInt64("job")
|
||||
ctx.Data["RunIndex"] = runIndex
|
||||
@@ -31,7 +35,6 @@ func View(ctx *context_module.Context) {
|
||||
run := job.Run
|
||||
ctx.Data["Build"] = run
|
||||
|
||||
// ctx.Data["Build"] = &bots_model.Run{Title: "test", Index: 123, Status: bots_model.StatusRunning}
|
||||
ctx.HTML(http.StatusOK, tplViewBuild)
|
||||
}
|
||||
|
||||
@@ -490,13 +490,13 @@ func SettingsPost(ctx *context.Context) {
|
||||
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePackages)
|
||||
}
|
||||
|
||||
if form.EnableBuilds && !unit_model.TypeBuilds.UnitGlobalDisabled() {
|
||||
if form.EnableBots && !unit_model.TypeBots.UnitGlobalDisabled() {
|
||||
units = append(units, repo_model.RepoUnit{
|
||||
RepoID: repo.ID,
|
||||
Type: unit_model.TypeBuilds,
|
||||
Type: unit_model.TypeBots,
|
||||
})
|
||||
} else if !unit_model.TypeBuilds.UnitGlobalDisabled() {
|
||||
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeBuilds)
|
||||
} else if !unit_model.TypeBots.UnitGlobalDisabled() {
|
||||
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeBots)
|
||||
}
|
||||
|
||||
if form.EnablePulls && !unit_model.TypePullRequests.UnitGlobalDisabled() {
|
||||
|
||||
Reference in New Issue
Block a user