summaryrefslogtreecommitdiffstats
path: root/templates/admin
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-01-07 11:23:09 +0000
committerAntoine GIRARD <sapk@users.noreply.github.com>2020-01-07 12:23:09 +0100
commit62eb1b0f2530a5ae1ce9b729378c0c8066174215 (patch)
treee567b2a9d91e69c0f2bccfeaf1a7341b4dda2706 /templates/admin
parentf71e1c8e796b099f4634bcd358e48189a97dcbad (diff)
downloadgitea-62eb1b0f2530a5ae1ce9b729378c0c8066174215.tar.gz
gitea-62eb1b0f2530a5ae1ce9b729378c0c8066174215.zip
Graceful Queues: Issue Indexing and Tasks (#9363)
* Queue: Add generic graceful queues with settings * Queue & Setting: Add worker pool implementation * Queue: Add worker settings * Queue: Make resizing worker pools * Queue: Add name variable to queues * Queue: Add monitoring * Queue: Improve logging * Issues: Gracefulise the issues indexer Remove the old now unused specific queues * Task: Move to generic queue and gracefulise * Issues: Standardise the issues indexer queue settings * Fix test * Queue: Allow Redis to connect to unix * Prevent deadlock during early shutdown of issue indexer * Add MaxWorker settings to queues * Merge branch 'master' into graceful-queues * Update modules/indexer/issues/indexer.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/indexer/issues/indexer.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/queue/queue_channel.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/queue/queue_disk.go * Update modules/queue/queue_disk_channel.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Rename queue.Description to queue.ManagedQueue as per @guillep2k * Cancel pool workers when removed * Remove dependency on queue from setting * Update modules/queue/queue_redis.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * As per @guillep2k add mutex locks on shutdown/terminate * move unlocking out of setInternal * Add warning if number of workers < 0 * Small changes as per @guillep2k * No redis host specified not found * Clean up documentation for queues * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md * Update modules/indexer/issues/indexer_test.go * Ensure that persistable channel queue is added to manager * Rename QUEUE_NAME REDIS_QUEUE_NAME * Revert "Rename QUEUE_NAME REDIS_QUEUE_NAME" This reverts commit 1f83b4fc9b9dabda186257b38c265fe7012f90df. Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'templates/admin')
-rw-r--r--templates/admin/monitor.tmpl28
-rw-r--r--templates/admin/queue.tmpl147
2 files changed, 175 insertions, 0 deletions
diff --git a/templates/admin/monitor.tmpl b/templates/admin/monitor.tmpl
index 38402fece2..0f9c2150b6 100644
--- a/templates/admin/monitor.tmpl
+++ b/templates/admin/monitor.tmpl
@@ -32,6 +32,34 @@
</div>
<h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queues"}}
+ </h4>
+ <div class="ui attached table segment">
+ <table class="ui very basic striped table">
+ <thead>
+ <tr>
+ <th>{{.i18n.Tr "admin.monitor.queue.name"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.type"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.exemplar"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.numberworkers"}}</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{range .Queues}}
+ <tr>
+ <td>{{.Name}}</td>
+ <td>{{.Type}}</td>
+ <td>{{.ExemplarType}}</td>
+ <td>{{$sum := .NumberOfWorkers}}{{if lt $sum 0}}-{{else}}{{$sum}}{{end}}</td>
+ <td><a href="{{$.Link}}/queue/{{.QID}}" class="button">{{if lt $sum 0}}{{$.i18n.Tr "admin.monitor.queue.review"}}{{else}}{{$.i18n.Tr "admin.monitor.queue.review_add"}}{{end}}</a>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ </div>
+
+ <h4 class="ui top attached header">
{{.i18n.Tr "admin.monitor.process"}}
</h4>
<div class="ui attached table segment">
diff --git a/templates/admin/queue.tmpl b/templates/admin/queue.tmpl
new file mode 100644
index 0000000000..4f422210e7
--- /dev/null
+++ b/templates/admin/queue.tmpl
@@ -0,0 +1,147 @@
+{{template "base/head" .}}
+<div class="admin monitor">
+ {{template "admin/navbar" .}}
+ <div class="ui container">
+ {{template "base/alert" .}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queue" .Queue.Name}}
+ </h4>
+ <div class="ui attached table segment">
+ <table class="ui very basic striped table">
+ <thead>
+ <tr>
+ <th>{{.i18n.Tr "admin.monitor.queue.name"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.type"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.exemplar"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.numberworkers"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.maxnumberworkers"}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{.Queue.Name}}</td>
+ <td>{{.Queue.Type}}</td>
+ <td>{{.Queue.ExemplarType}}</td>
+ <td>{{$sum := .Queue.NumberOfWorkers}}{{if lt $sum 0}}-{{else}}{{$sum}}{{end}}</td>
+ <td>{{if lt $sum 0}}-{{else}}{{.Queue.MaxNumberOfWorkers}}{{end}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ {{if lt $sum 0 }}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queue.nopool.title"}}
+ </h4>
+ <div class="ui attached segment">
+ {{if eq .Queue.Type "wrapped" }}
+ <p>{{.i18n.Tr "admin.monitor.queue.wrapped.desc"}}</p>
+ {{else if eq .Queue.Type "persistable-channel"}}
+ <p>{{.i18n.Tr "admin.monitor.queue.persistable-channel.desc"}}</p>
+ {{else}}
+ <p>{{.i18n.Tr "admin.monitor.queue.nopool.desc"}}</p>
+ {{end}}
+ </div>
+ {{else}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queue.settings.title"}}
+ </h4>
+ <div class="ui attached segment">
+ <p>{{.i18n.Tr "admin.monitor.queue.settings.desc"}}</p>
+ <form method="POST" action="{{.Link}}/set">
+ {{$.CsrfTokenHtml}}
+ <div class="ui form">
+ <div class="inline field">
+ <label for="max-number">{{.i18n.Tr "admin.monitor.queue.settings.maxnumberworkers"}}</label>
+ <input name="max-number" type="text" placeholder="{{.i18n.Tr "admin.monitor.queue.settings.maxnumberworkers.placeholder" .Queue.MaxNumberOfWorkers}}">
+ </div>
+ <div class="inline field">
+ <label for="timeout">{{.i18n.Tr "admin.monitor.queue.settings.timeout"}}</label>
+ <input name="timeout" type="text" placeholder="{{.i18n.Tr "admin.monitor.queue.settings.timeout.placeholder" .Queue.BoostTimeout }}">
+ </div>
+ <div class="inline field">
+ <label for="number">{{.i18n.Tr "admin.monitor.queue.settings.numberworkers"}}</label>
+ <input name="number" type="text" placeholder="{{.i18n.Tr "admin.monitor.queue.settings.numberworkers.placeholder" .Queue.BoostWorkers}}">
+ </div>
+ <div class="inline field">
+ <label>{{.i18n.Tr "admin.monitor.queue.settings.blocktimeout"}}</label>
+ <span>{{.i18n.Tr "admin.monitor.queue.settings.blocktimeout.value" .Queue.BlockTimeout}}</span>
+ </div>
+ <button class="ui submit button">{{.i18n.Tr "admin.monitor.queue.settings.submit"}}</button>
+ </div>
+ </form>
+ </div>
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queue.pool.addworkers.title"}}
+ </h4>
+ <div class="ui attached segment">
+ <p>{{.i18n.Tr "admin.monitor.queue.pool.addworkers.desc"}}</p>
+ <form method="POST" action="{{.Link}}/add">
+ {{$.CsrfTokenHtml}}
+ <div class="ui form">
+ <div class="fields">
+ <div class="field">
+ <label>{{.i18n.Tr "admin.monitor.queue.numberworkers"}}</label>
+ <input name="number" type="text" placeholder="{{.i18n.Tr "admin.monitor.queue.pool.addworkers.numberworkers.placeholder"}}">
+ </div>
+ <div class="field">
+ <label>{{.i18n.Tr "admin.monitor.queue.pool.timeout"}}</label>
+ <input name="timeout" type="text" placeholder="{{.i18n.Tr "admin.monitor.queue.pool.addworkers.timeout.placeholder"}}">
+ </div>
+ </div>
+ <button class="ui submit button">{{.i18n.Tr "admin.monitor.queue.pool.addworkers.submit"}}</button>
+ </div>
+ </form>
+ </div>
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queue.pool.workers.title"}}
+ </h4>
+ <div class="ui attached table segment">
+ <table class="ui very basic striped table">
+ <thead>
+ <tr>
+ <th>{{.i18n.Tr "admin.monitor.queue.numberworkers"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.start"}}</th>
+ <th>{{.i18n.Tr "admin.monitor.queue.pool.timeout"}}</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{range .Queue.Workers}}
+ <tr>
+ <td>{{.Workers}}</td>
+ <td>{{DateFmtLong .Start}}</td>
+ <td>{{if .HasTimeout}}{{DateFmtLong .Timeout}}{{else}}-{{end}}</td>
+ <td>
+ <a class="delete-button" href="" data-url="{{$.Link}}/cancel/{{.PID}}" data-id="{{.PID}}" data-name="{{.Workers}}"><i class="close icon text red" title="{{$.i18n.Tr "remove"}}"></i></a>
+ </td>
+ </tr>
+ {{else}}
+ <tr>
+ <td colspan="4">{{.i18n.Tr "admin.monitor.queue.pool.workers.none" }}
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ </div>
+ {{end}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "admin.monitor.queue.configuration"}}
+ </h4>
+ <div class="ui attached segment">
+ <pre>{{.Queue.Configuration | JsonPrettyPrint}}
+ </div>
+ </div>
+</div>
+<div class="ui small basic delete modal">
+ <div class="ui icon header">
+ <i class="close icon"></i>
+ {{.i18n.Tr "admin.monitor.queue.pool.cancel"}}
+ </div>
+ <div class="content">
+ <p>{{$.i18n.Tr "admin.monitor.queue.pool.cancel_notices" `<span class="name"></span>` | Safe}}</p>
+ <p>{{$.i18n.Tr "admin.monitor.queue.pool.cancel_desc"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>
+
+{{template "base/footer" .}}