Skip to content

Commit 00b1cf1

Browse files
zeripathYohann Delafollye
authored and
Yohann Delafollye
committed
Multiple small admin dashboard fixes (go-gitea#12153)
* Remove spurious spacing between Maintenance Operations and its table on dashboard * 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 fa15381 commit 00b1cf1

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
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
@@ -1867,12 +1867,12 @@ dashboard.operation_switch = Switch
18671867
dashboard.operation_run = Run
18681868
dashboard.clean_unbind_oauth = Clean unbound OAuth connections
18691869
dashboard.clean_unbind_oauth_success = All unbound OAuth connections have been deleted.
1870-
dashboard.task.started=Started Task: %s
1871-
dashboard.task.process=Task: %s
1872-
dashboard.task.cancelled=Task: %s cancelled: %[3]s
1873-
dashboard.task.error=Error in Task: %s: %[3]s
1874-
dashboard.task.finished=Task: %s started by %s has finished
1875-
dashboard.task.unknown=Unknown task: %s
1870+
dashboard.task.started=Started Task: %[1]s
1871+
dashboard.task.process=Task: %[1]s
1872+
dashboard.task.cancelled=Task: %[1]s cancelled: %[3]s
1873+
dashboard.task.error=Error in Task: %[1]s: %[3]s
1874+
dashboard.task.finished=Task: %[1]s started by %[2]s has finished
1875+
dashboard.task.unknown=Unknown task: %[1]s
18761876
dashboard.cron.started=Started Cron: %[1]s
18771877
dashboard.cron.process=Cron: %[1]s
18781878
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/dashboard.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
<h4 class="ui top attached header">
1515
{{.i18n.Tr "admin.dashboard.operations"}}
1616
</h4>
17-
<div class="ui attached table segment">
18-
<form method="post" action="{{AppSubUrl}}/admin">
19-
{{.CsrfTokenHtml}}
17+
<form method="post" action="{{AppSubUrl}}/admin">
18+
{{.CsrfTokenHtml}}
19+
<div class="ui attached table segment">
2020
<table class="ui very basic table">
2121
<tbody>
2222
<tr>
@@ -62,8 +62,8 @@
6262
</tr>
6363
</tbody>
6464
</table>
65-
</form>
66-
</div>
65+
</div>
66+
</form>
6767

6868
<h4 class="ui top attached header">
6969
{{.i18n.Tr "admin.dashboard.system_status"}}

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)