Skip to content

Commit 0a6e971

Browse files
committed
Multiple small admin dashboard fixes (go-gitea#12153)
* Prevent (EXTRA string) comments in Task headers * Redirect tasks started from monitor page back to monitor * Fix go-gitea#12107 - redirects from process cancel should use AppSubUrl * When wrapping queues set the name correctly Signed-off-by: Andrew Thornton <[email protected]>
1 parent f984a7e commit 0a6e971

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

modules/auth/admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors)
5151

5252
// AdminDashboardForm form for admin dashboard operations
5353
type AdminDashboardForm struct {
54-
Op string `binding:"required"`
54+
Op string `binding:"required"`
55+
From string
5556
}
5657

5758
// Validate validates form fields

modules/queue/setting.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func CreateQueue(name string, handle HandlerFunc, exemplar interface{}) Queue {
7575
MaxAttempts: q.MaxAttempts,
7676
Config: cfg,
7777
QueueLength: q.Length,
78+
Name: name,
7879
}, exemplar)
7980
}
8081
if err != nil {

options/locale/locale_en-US.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,12 +1843,12 @@ dashboard.operation_switch = Switch
18431843
dashboard.operation_run = Run
18441844
dashboard.clean_unbind_oauth = Clean unbound OAuth connections
18451845
dashboard.clean_unbind_oauth_success = All unbound OAuth connections have been deleted.
1846-
dashboard.task.started=Started Task: %s
1847-
dashboard.task.process=Task: %s
1848-
dashboard.task.cancelled=Task: %s cancelled: %[3]s
1849-
dashboard.task.error=Error in Task: %s: %[3]s
1850-
dashboard.task.finished=Task: %s started by %s has finished
1851-
dashboard.task.unknown=Unknown task: %s
1846+
dashboard.task.started=Started Task: %[1]s
1847+
dashboard.task.process=Task: %[1]s
1848+
dashboard.task.cancelled=Task: %[1]s cancelled: %[3]s
1849+
dashboard.task.error=Error in Task: %[1]s: %[3]s
1850+
dashboard.task.finished=Task: %[1]s started by %[2]s has finished
1851+
dashboard.task.unknown=Unknown task: %[1]s
18521852
dashboard.cron.started=Started Cron: %[1]s
18531853
dashboard.cron.process=Cron: %[1]s
18541854
dashboard.cron.cancelled=Cron: %s cancelled: %[3]s

routers/admin/admin.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ func DashboardPost(ctx *context.Context, form auth.AdminDashboardForm) {
153153
ctx.Flash.Error(ctx.Tr("admin.dashboard.task.unknown", form.Op))
154154
}
155155
}
156-
157-
ctx.Redirect(setting.AppSubURL + "/admin")
156+
if form.From == "monitor" {
157+
ctx.Redirect(setting.AppSubURL + "/admin/monitor")
158+
} else {
159+
ctx.Redirect(setting.AppSubURL + "/admin")
160+
}
158161
}
159162

160163
// SendTestMail send test mail to confirm mail service is OK
@@ -331,7 +334,7 @@ func MonitorCancel(ctx *context.Context) {
331334
pid := ctx.ParamsInt64("pid")
332335
process.GetManager().Cancel(pid)
333336
ctx.JSON(200, map[string]interface{}{
334-
"redirect": ctx.Repo.RepoLink + "/admin/monitor",
337+
"redirect": setting.AppSubURL + "/admin/monitor",
335338
})
336339
}
337340

templates/admin/monitor.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</h4>
99
<div class="ui attached table segment">
1010
<form method="post" action="{{AppSubUrl}}/admin">
11+
<input type="hidden" name="from" value="monitor"/>
1112
{{.CsrfTokenHtml}}
1213
<table class="ui very basic striped table">
1314
<thead>

0 commit comments

Comments
 (0)