|
4 | 4 | package admin
|
5 | 5 |
|
6 | 6 | import (
|
7 |
| - "net/url" |
8 |
| - |
9 |
| - actions_model "code.gitea.io/gitea/models/actions" |
10 |
| - "code.gitea.io/gitea/models/db" |
11 |
| - "code.gitea.io/gitea/modules/base" |
12 | 7 | "code.gitea.io/gitea/modules/context"
|
13 | 8 | "code.gitea.io/gitea/modules/setting"
|
14 |
| - actions_shared "code.gitea.io/gitea/routers/web/shared/actions" |
15 |
| -) |
16 |
| - |
17 |
| -const ( |
18 |
| - tplRunners base.TplName = "admin/runners/base" |
19 |
| - tplRunnerEdit base.TplName = "admin/runners/edit" |
20 | 9 | )
|
21 | 10 |
|
22 |
| -// Runners show all the runners |
23 |
| -func Runners(ctx *context.Context) { |
24 |
| - ctx.Data["Title"] = ctx.Tr("actions.runners") |
25 |
| - ctx.Data["PageIsAdmin"] = true |
26 |
| - ctx.Data["PageIsAdminRunners"] = true |
27 |
| - |
28 |
| - page := ctx.FormInt("page") |
29 |
| - if page <= 1 { |
30 |
| - page = 1 |
31 |
| - } |
32 |
| - |
33 |
| - opts := actions_model.FindRunnerOptions{ |
34 |
| - ListOptions: db.ListOptions{ |
35 |
| - Page: page, |
36 |
| - PageSize: 100, |
37 |
| - }, |
38 |
| - Sort: ctx.Req.URL.Query().Get("sort"), |
39 |
| - Filter: ctx.Req.URL.Query().Get("q"), |
40 |
| - } |
41 |
| - |
42 |
| - actions_shared.RunnersList(ctx, tplRunners, opts) |
43 |
| -} |
44 |
| - |
45 |
| -// EditRunner show editing runner page |
46 |
| -func EditRunner(ctx *context.Context) { |
47 |
| - ctx.Data["Title"] = ctx.Tr("actions.runners.edit_runner") |
48 |
| - ctx.Data["PageIsAdmin"] = true |
49 |
| - ctx.Data["PageIsAdminRunners"] = true |
50 |
| - |
51 |
| - page := ctx.FormInt("page") |
52 |
| - if page <= 1 { |
53 |
| - page = 1 |
54 |
| - } |
55 |
| - |
56 |
| - actions_shared.RunnerDetails(ctx, tplRunnerEdit, page, ctx.ParamsInt64(":runnerid"), 0, 0) |
57 |
| -} |
58 |
| - |
59 |
| -// EditRunnerPost response for editing runner |
60 |
| -func EditRunnerPost(ctx *context.Context) { |
61 |
| - ctx.Data["Title"] = ctx.Tr("actions.runners.edit") |
62 |
| - ctx.Data["PageIsAdmin"] = true |
63 |
| - ctx.Data["PageIsAdminRunners"] = true |
64 |
| - actions_shared.RunnerDetailsEditPost(ctx, ctx.ParamsInt64(":runnerid"), 0, 0, |
65 |
| - setting.AppSubURL+"/admin/runners/"+url.PathEscape(ctx.Params(":runnerid"))) |
66 |
| -} |
67 |
| - |
68 |
| -// DeleteRunnerPost response for deleting a runner |
69 |
| -func DeleteRunnerPost(ctx *context.Context) { |
70 |
| - actions_shared.RunnerDeletePost(ctx, ctx.ParamsInt64(":runnerid"), |
71 |
| - setting.AppSubURL+"/admin/runners/", |
72 |
| - setting.AppSubURL+"/admin/runners/"+url.PathEscape(ctx.Params(":runnerid")), |
73 |
| - ) |
74 |
| -} |
75 |
| - |
76 |
| -func ResetRunnerRegistrationToken(ctx *context.Context) { |
77 |
| - actions_shared.RunnerResetRegistrationToken(ctx, 0, 0, setting.AppSubURL+"/admin/runners/") |
| 11 | +func RedirectToDefaultSetting(ctx *context.Context) { |
| 12 | + ctx.Redirect(setting.AppSubURL + "/admin/actions/runners") |
78 | 13 | }
|
0 commit comments