refactor: rename to actions

This commit is contained in:
Jason Song
2022-12-06 15:16:25 +08:00
parent 56368f3963
commit 223782ca4c
50 changed files with 247 additions and 247 deletions

View File

@@ -18,33 +18,33 @@ import (
)
const (
tplListBots base.TplName = "repo/bots/list"
tplViewBuild base.TplName = "repo/bots/view"
tplListActions base.TplName = "repo/actions/list"
tplViewActions base.TplName = "repo/actions/view"
)
// MustEnableBots check if bots are enabled in settings
func MustEnableBots(ctx *context.Context) {
if !setting.Bots.Enabled {
ctx.NotFound("MustEnableBots", nil)
// MustEnableActions check if actions are enabled in settings
func MustEnableActions(ctx *context.Context) {
if !setting.Actions.Enabled {
ctx.NotFound("MustEnableActions", nil)
return
}
if unit.TypeBots.UnitGlobalDisabled() {
ctx.NotFound("MustEnableBots", nil)
if unit.TypeActions.UnitGlobalDisabled() {
ctx.NotFound("MustEnableActions", nil)
return
}
if ctx.Repo.Repository != nil {
if !ctx.Repo.CanRead(unit.TypeBots) {
ctx.NotFound("MustEnableBots", nil)
if !ctx.Repo.CanRead(unit.TypeActions) {
ctx.NotFound("MustEnableActions", nil)
return
}
}
}
func List(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.bots")
ctx.Data["PageIsBots"] = true
ctx.Data["Title"] = ctx.Tr("repo.actions")
ctx.Data["PageIsActions"] = true
defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
if err != nil {
@@ -129,5 +129,5 @@ func List(ctx *context.Context) {
pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, tplListBots)
ctx.HTML(http.StatusOK, tplListActions)
}

View File

@@ -24,7 +24,7 @@ import (
)
func View(ctx *context_module.Context) {
ctx.Data["PageIsBots"] = true
ctx.Data["PageIsActions"] = true
runIndex := ctx.ParamsInt64("run")
jobIndex := ctx.ParamsInt64("job")
ctx.Data["RunIndex"] = runIndex
@@ -37,7 +37,7 @@ func View(ctx *context_module.Context) {
run := job.Run
ctx.Data["Build"] = run
ctx.HTML(http.StatusOK, tplViewBuild)
ctx.HTML(http.StatusOK, tplViewActions)
}
type ViewRequest struct {