Multiple small admin dashboard fixes (#12153) (#12156)

* Prevent (EXTRA string) comments in Task headers
* Redirect tasks started from monitor page back to monitor
* Fix #12107 - redirects from process cancel should use AppSubUrl
* When wrapping queues set the name correctly

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2020-07-05 21:19:53 +01:00 committed by GitHub
parent f984a7e6c6
commit 2bf987229a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 10 deletions

View File

@ -51,7 +51,8 @@ func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors)
// AdminDashboardForm form for admin dashboard operations
type AdminDashboardForm struct {
Op string `binding:"required"`
Op string `binding:"required"`
From string
}
// Validate validates form fields

View File

@ -75,6 +75,7 @@ func CreateQueue(name string, handle HandlerFunc, exemplar interface{}) Queue {
MaxAttempts: q.MaxAttempts,
Config: cfg,
QueueLength: q.Length,
Name: name,
}, exemplar)
}
if err != nil {

View File

@ -1843,12 +1843,12 @@ dashboard.operation_switch = Switch
dashboard.operation_run = Run
dashboard.clean_unbind_oauth = Clean unbound OAuth connections
dashboard.clean_unbind_oauth_success = All unbound OAuth connections have been deleted.
dashboard.task.started=Started Task: %s
dashboard.task.process=Task: %s
dashboard.task.cancelled=Task: %s cancelled: %[3]s
dashboard.task.error=Error in Task: %s: %[3]s
dashboard.task.finished=Task: %s started by %s has finished
dashboard.task.unknown=Unknown task: %s
dashboard.task.started=Started Task: %[1]s
dashboard.task.process=Task: %[1]s
dashboard.task.cancelled=Task: %[1]s cancelled: %[3]s
dashboard.task.error=Error in Task: %[1]s: %[3]s
dashboard.task.finished=Task: %[1]s started by %[2]s has finished
dashboard.task.unknown=Unknown task: %[1]s
dashboard.cron.started=Started Cron: %[1]s
dashboard.cron.process=Cron: %[1]s
dashboard.cron.cancelled=Cron: %s cancelled: %[3]s

View File

@ -153,8 +153,11 @@ func DashboardPost(ctx *context.Context, form auth.AdminDashboardForm) {
ctx.Flash.Error(ctx.Tr("admin.dashboard.task.unknown", form.Op))
}
}
ctx.Redirect(setting.AppSubURL + "/admin")
if form.From == "monitor" {
ctx.Redirect(setting.AppSubURL + "/admin/monitor")
} else {
ctx.Redirect(setting.AppSubURL + "/admin")
}
}
// SendTestMail send test mail to confirm mail service is OK
@ -331,7 +334,7 @@ func MonitorCancel(ctx *context.Context) {
pid := ctx.ParamsInt64("pid")
process.GetManager().Cancel(pid)
ctx.JSON(200, map[string]interface{}{
"redirect": ctx.Repo.RepoLink + "/admin/monitor",
"redirect": setting.AppSubURL + "/admin/monitor",
})
}

View File

@ -8,6 +8,7 @@
</h4>
<div class="ui attached table segment">
<form method="post" action="{{AppSubUrl}}/admin">
<input type="hidden" name="from" value="monitor"/>
{{.CsrfTokenHtml}}
<table class="ui very basic striped table">
<thead>