aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/actions/view.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-06-19 06:32:45 +0800
committerGitHub <noreply@github.com>2024-06-19 06:32:45 +0800
commit43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2 (patch)
treec98c2e1159ee02eb52282811f28a4c31ad222c67 /routers/web/repo/actions/view.go
parent17baf1af10de025a47ade1f16f1e5c51646d7fcf (diff)
downloadgitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.tar.gz
gitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.zip
Refactor names (#31405)
This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
Diffstat (limited to 'routers/web/repo/actions/view.go')
-rw-r--r--routers/web/repo/actions/view.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index 7cc12c90e6..2c62c8d9ec 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -35,8 +35,8 @@ import (
func View(ctx *context_module.Context) {
ctx.Data["PageIsActions"] = true
- runIndex := ctx.ParamsInt64("run")
- jobIndex := ctx.ParamsInt64("job")
+ runIndex := ctx.PathParamInt64("run")
+ jobIndex := ctx.PathParamInt64("job")
ctx.Data["RunIndex"] = runIndex
ctx.Data["JobIndex"] = jobIndex
ctx.Data["ActionsURL"] = ctx.Repo.RepoLink + "/actions"
@@ -130,8 +130,8 @@ type ViewStepLogLine struct {
func ViewPost(ctx *context_module.Context) {
req := web.GetForm(ctx).(*ViewRequest)
- runIndex := ctx.ParamsInt64("run")
- jobIndex := ctx.ParamsInt64("job")
+ runIndex := ctx.PathParamInt64("run")
+ jobIndex := ctx.PathParamInt64("job")
current, jobs := getRunJobs(ctx, runIndex, jobIndex)
if ctx.Written() {
@@ -268,8 +268,8 @@ func ViewPost(ctx *context_module.Context) {
// Rerun will rerun jobs in the given run
// If jobIndexStr is a blank string, it means rerun all jobs
func Rerun(ctx *context_module.Context) {
- runIndex := ctx.ParamsInt64("run")
- jobIndexStr := ctx.Params("job")
+ runIndex := ctx.PathParamInt64("run")
+ jobIndexStr := ctx.PathParam("job")
var jobIndex int64
if jobIndexStr != "" {
jobIndex, _ = strconv.ParseInt(jobIndexStr, 10, 64)
@@ -358,8 +358,8 @@ func rerunJob(ctx *context_module.Context, job *actions_model.ActionRunJob, shou
}
func Logs(ctx *context_module.Context) {
- runIndex := ctx.ParamsInt64("run")
- jobIndex := ctx.ParamsInt64("job")
+ runIndex := ctx.PathParamInt64("run")
+ jobIndex := ctx.PathParamInt64("job")
job, _ := getRunJobs(ctx, runIndex, jobIndex)
if ctx.Written() {
@@ -407,7 +407,7 @@ func Logs(ctx *context_module.Context) {
}
func Cancel(ctx *context_module.Context) {
- runIndex := ctx.ParamsInt64("run")
+ runIndex := ctx.PathParamInt64("run")
_, jobs := getRunJobs(ctx, runIndex, -1)
if ctx.Written() {
@@ -448,7 +448,7 @@ func Cancel(ctx *context_module.Context) {
}
func Approve(ctx *context_module.Context) {
- runIndex := ctx.ParamsInt64("run")
+ runIndex := ctx.PathParamInt64("run")
current, jobs := getRunJobs(ctx, runIndex, -1)
if ctx.Written() {
@@ -529,7 +529,7 @@ type ArtifactsViewItem struct {
}
func ArtifactsView(ctx *context_module.Context) {
- runIndex := ctx.ParamsInt64("run")
+ runIndex := ctx.PathParamInt64("run")
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
if err != nil {
if errors.Is(err, util.ErrNotExist) {
@@ -567,8 +567,8 @@ func ArtifactsDeleteView(ctx *context_module.Context) {
return
}
- runIndex := ctx.ParamsInt64("run")
- artifactName := ctx.Params("artifact_name")
+ runIndex := ctx.PathParamInt64("run")
+ artifactName := ctx.PathParam("artifact_name")
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
if err != nil {
@@ -585,8 +585,8 @@ func ArtifactsDeleteView(ctx *context_module.Context) {
}
func ArtifactsDownloadView(ctx *context_module.Context) {
- runIndex := ctx.ParamsInt64("run")
- artifactName := ctx.Params("artifact_name")
+ runIndex := ctx.PathParamInt64("run")
+ artifactName := ctx.PathParam("artifact_name")
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
if err != nil {