Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple small admin dashboard fixes #12153

Merged
merged 1 commit into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/auth/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions modules/queue/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1867,12 +1867,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
Expand Down
9 changes: 6 additions & 3 deletions routers/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
})
}

Expand Down
10 changes: 5 additions & 5 deletions templates/admin/dashboard.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<h4 class="ui top attached header">
{{.i18n.Tr "admin.dashboard.operations"}}
</h4>
<div class="ui attached table segment">
<form method="post" action="{{AppSubUrl}}/admin">
{{.CsrfTokenHtml}}
<form method="post" action="{{AppSubUrl}}/admin">
{{.CsrfTokenHtml}}
<div class="ui attached table segment">
<table class="ui very basic table">
<tbody>
<tr>
Expand Down Expand Up @@ -62,8 +62,8 @@
</tr>
</tbody>
</table>
</form>
</div>
</div>
</form>

<h4 class="ui top attached header">
{{.i18n.Tr "admin.dashboard.system_status"}}
Expand Down
1 change: 1 addition & 0 deletions templates/admin/monitor.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down