aboutsummaryrefslogtreecommitdiffstats
path: root/templates/admin
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-05-17 00:31:38 +0100
committerGitHub <noreply@github.com>2020-05-16 19:31:38 -0400
commit9a2e47b23a6d460acfce9b1b77e6f9fb06ca1b75 (patch)
treeb1852472e1ecf6bdb1822b41655bdaf8afd87c1b /templates/admin
parentc18144086f9d4a06adbd4a7c08cfa6dab91224ec (diff)
downloadgitea-9a2e47b23a6d460acfce9b1b77e6f9fb06ca1b75.tar.gz
gitea-9a2e47b23a6d460acfce9b1b77e6f9fb06ca1b75.zip
Refactor Cron and merge dashboard tasks (#10745)
* Refactor Cron and merge dashboard tasks * Merge Cron and Dashboard tasks * Make every cron task report a system notice on completion * Refactor the creation of these tasks * Ensure that execution counts of tasks is correct * Allow cron tasks to be started from the cron page * golangci-lint fixes * Enforce that only one task with the same name can be registered Signed-off-by: Andrew Thornton <art27@cantab.net> * fix name check Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k * as per @lafriks Signed-off-by: Andrew Thornton <art27@cantab.net> * Add git.CommandContext variants Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'templates/admin')
-rw-r--r--templates/admin/dashboard.tmpl27
-rw-r--r--templates/admin/monitor.tmpl45
2 files changed, 39 insertions, 33 deletions
diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl
index 151b489710..affed1634f 100644
--- a/templates/admin/dashboard.tmpl
+++ b/templates/admin/dashboard.tmpl
@@ -15,49 +15,50 @@
{{.i18n.Tr "admin.dashboard.operations"}}
</h4>
<div class="ui attached table segment">
- <form method="post" action="{{AppSubUrl}}/admin">
+ <form method="post" action="{{.AppSubUrl}}/admin">
{{.CsrfTokenHtml}}
<table class="ui very basic table">
<tbody>
<tr>
- <td>{{.i18n.Tr "admin.dashboard.delete_inactivate_accounts"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="1">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td>{{.i18n.Tr "admin.dashboard.delete_inactive_accounts"}}</td>
+ <td><button type="submit" class="ui green button" name="op" value="delete_inactive_accounts">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.delete_repo_archives"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="2">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="delete_repo_archives">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.delete_missing_repos"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="3">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="delete_missing_repos">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.git_gc_repos"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="4">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="git_gc_repos">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
- <td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="5">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}<br/>
+ {{.i18n.Tr "admin.dashboard.resync_all_sshkeys.desc"}}</td>
+ <td><button type="submit" class="ui green button" name="op" value="resync_all_sshkeys">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.resync_all_hooks"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="6">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="resync_all_hooks">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.reinit_missing_repos"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="7">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="reinit_missing_repos">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.sync_external_users"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="8">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="sync_external_users">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.git_fsck"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="9">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="git_fsck">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.delete_generated_repository_avatars"}}</td>
- <td><button type="submit" class="ui green button" name="op" value="10">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
+ <td><button type="submit" class="ui green button" name="op" value="delete_generated_repository_avatars">{{svg "octicon-triangle-right" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
</tr>
</tbody>
</table>
diff --git a/templates/admin/monitor.tmpl b/templates/admin/monitor.tmpl
index 0f9c2150b6..26fbcb60ac 100644
--- a/templates/admin/monitor.tmpl
+++ b/templates/admin/monitor.tmpl
@@ -7,28 +7,33 @@
{{.i18n.Tr "admin.monitor.cron"}}
</h4>
<div class="ui attached table segment">
- <table class="ui very basic striped table">
- <thead>
- <tr>
- <th>{{.i18n.Tr "admin.monitor.name"}}</th>
- <th>{{.i18n.Tr "admin.monitor.schedule"}}</th>
- <th>{{.i18n.Tr "admin.monitor.next"}}</th>
- <th>{{.i18n.Tr "admin.monitor.previous"}}</th>
- <th>{{.i18n.Tr "admin.monitor.execute_times"}}</th>
- </tr>
- </thead>
- <tbody>
- {{range .Entries}}
+ <form method="post" action="{{.AppSubUrl}}/admin">
+ {{.CsrfTokenHtml}}
+ <table class="ui very basic striped table">
+ <thead>
<tr>
- <td>{{.Description}}</td>
- <td>{{.Spec}}</td>
- <td>{{DateFmtLong .Next}}</td>
- <td>{{if gt .Prev.Year 1 }}{{DateFmtLong .Prev}}{{else}}N/A{{end}}</td>
- <td>{{.ExecTimes}}</td>
+ <th></th>
+ <th>{{.i18n.Tr "admin.monitor.name"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.schedule"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.next"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.previous"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.execute_times"}}</th>
</tr>
- {{end}}
- </tbody>
- </table>
+ </thead>
+ <tbody>
+ {{range .Entries}}
+ <tr>
+ <td><button type="submit" class="ui green button" name="op" value="{{.Name}}" title="{{$.i18n.Tr "admin.dashboard.operation_run"}}">{{svg "octicon-triangle-right" 16}}</button></td>
+ <td>{{$.i18n.Tr (printf "admin.dashboard.%s" .Name)}}</td>
+ <td>{{.Spec}}</td>
+ <td>{{DateFmtLong .Next}}</td>
+ <td>{{if gt .Prev.Year 1 }}{{DateFmtLong .Prev}}{{else}}N/A{{end}}</td>
+ <td>{{.ExecTimes}}</td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ </form>
</div>
<h4 class="ui top attached header">