476a043a5f
Co-Author: @wxiaoguang
This PR is to fix
https://github.com/go-gitea/gitea/issues/23318#issuecomment-1506275446 .
The way to fix this in this PR is to use `delete_modal_actions.tmpl`
here both to fix this issue and keep ui consistency (as suggested by
[TODO
here](4299c3b7db/templates/projects/view.tmpl (L161)
))
And this PR also refactors `delete_modal_actions.tmpl` and its related
styles, and use the template for more modal actions:
1. Added template attributes:
* locale
* ModalButtonStyle: "yes" (default) or "confirm"
* ModalButtonCancelText
* ModalButtonOkText
2. Rename `delete_modal_actions.tmpl` template to
`modal_actions_confirm.tmpl` because it is not only used for action
modals deletion now.
3. Refactored css related to modals into `web_src/css/modules/modal.css`
and improved the styles.
4. Also use the template for PR deletion modal and remove issue
dependency modal.
5. Some modals should also use the template, but not sure how to open
them, so mark these modal actions by `{{/* TODO: Convert to
base/modal_actions_confirm */}}`
After (Also tested on arc green):
Hovering on the left buttons
<img width="711" alt="Screen Shot 2023-04-23 at 15 17 12"
src="https://user-images.githubusercontent.com/17645053/233825650-76307e65-9255-44bb-80e8-7062f58ead1b.png">
<img width="786" alt="Screen Shot 2023-04-23 at 15 17 21"
src="https://user-images.githubusercontent.com/17645053/233825652-4dc6f7d1-a180-49fb-a468-d60950eaee0d.png">
Test for functionalities:
https://user-images.githubusercontent.com/17645053/233826857-76376fda-022c-42d0-b0f3-339c17ca4e59.mov
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
195 lines
7.6 KiB
Handlebars
195 lines
7.6 KiB
Handlebars
{{template "base/head" .}}
|
|
<div role="main" aria-label="{{.Title}}" class="page-content admin monitor">
|
|
{{template "admin/navbar" .}}
|
|
<div class="ui container">
|
|
{{template "base/alert" .}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue" .Queue.Name}}
|
|
</h4>
|
|
<div class="ui attached table segment">
|
|
<table class="ui very basic striped table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{.locale.Tr "admin.monitor.queue.name"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.queue.type"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.queue.exemplar"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.queue.numberworkers"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.queue.maxnumberworkers"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.queue.numberinqueue"}}</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>
|
|
<td>{{$sum := .Queue.NumberInQueue}}{{if lt $sum 0}}-{{else}}{{$sum}}{{end}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{if lt $sum 0}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.nopool.title"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
{{if eq .Queue.Type "wrapped"}}
|
|
<p>{{.locale.Tr "admin.monitor.queue.wrapped.desc"}}</p>
|
|
{{else if eq .Queue.Type "persistable-channel"}}
|
|
<p>{{.locale.Tr "admin.monitor.queue.persistable-channel.desc"}}</p>
|
|
{{else}}
|
|
<p>{{.locale.Tr "admin.monitor.queue.nopool.desc"}}</p>
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.settings.title"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p>{{.locale.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">{{.locale.Tr "admin.monitor.queue.settings.maxnumberworkers"}}</label>
|
|
<input name="max-number" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.settings.maxnumberworkers.placeholder" .Queue.MaxNumberOfWorkers}}">
|
|
</div>
|
|
<div class="inline field">
|
|
<label for="timeout">{{.locale.Tr "admin.monitor.queue.settings.timeout"}}</label>
|
|
<input name="timeout" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.settings.timeout.placeholder" .Queue.BoostTimeout}}">
|
|
</div>
|
|
<div class="inline field">
|
|
<label for="number">{{.locale.Tr "admin.monitor.queue.settings.numberworkers"}}</label>
|
|
<input name="number" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.settings.numberworkers.placeholder" .Queue.BoostWorkers}}">
|
|
</div>
|
|
<div class="inline field">
|
|
<label>{{.locale.Tr "admin.monitor.queue.settings.blocktimeout"}}</label>
|
|
<span>{{.locale.Tr "admin.monitor.queue.settings.blocktimeout.value" .Queue.BlockTimeout}}</span>
|
|
</div>
|
|
<button class="ui submit button">{{.locale.Tr "admin.monitor.queue.settings.submit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.pool.addworkers.title"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p>{{.locale.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>{{.locale.Tr "admin.monitor.queue.numberworkers"}}</label>
|
|
<input name="number" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.pool.addworkers.numberworkers.placeholder"}}">
|
|
</div>
|
|
<div class="field">
|
|
<label>{{.locale.Tr "admin.monitor.queue.pool.timeout"}}</label>
|
|
<input name="timeout" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.pool.addworkers.timeout.placeholder"}}">
|
|
</div>
|
|
</div>
|
|
<button class="ui submit button">{{.locale.Tr "admin.monitor.queue.pool.addworkers.submit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{{if .Queue.Pausable}}
|
|
{{if .Queue.IsPaused}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.pool.resume.title"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p>{{.locale.Tr "admin.monitor.queue.pool.resume.desc"}}</p>
|
|
<form method="POST" action="{{.Link}}/resume">
|
|
{{$.CsrfTokenHtml}}
|
|
<div class="ui form">
|
|
<button class="ui submit button">{{.locale.Tr "admin.monitor.queue.pool.resume.submit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{{else}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.pool.pause.title"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p>{{.locale.Tr "admin.monitor.queue.pool.pause.desc"}}</p>
|
|
<form method="POST" action="{{.Link}}/pause">
|
|
{{$.CsrfTokenHtml}}
|
|
<div class="ui form">
|
|
<button class="ui submit button">{{.locale.Tr "admin.monitor.queue.pool.pause.submit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.pool.flush.title"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p>{{.locale.Tr "admin.monitor.queue.pool.flush.desc"}}</p>
|
|
<form method="POST" action="{{.Link}}/flush">
|
|
{{$.CsrfTokenHtml}}
|
|
<div class="ui form">
|
|
<div class="fields">
|
|
<div class="field">
|
|
<label>{{.locale.Tr "admin.monitor.queue.pool.timeout"}}</label>
|
|
<input name="timeout" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.pool.addworkers.timeout.placeholder"}}">
|
|
</div>
|
|
</div>
|
|
<button class="ui submit button">{{.locale.Tr "admin.monitor.queue.pool.flush.submit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.pool.workers.title"}}
|
|
</h4>
|
|
<div class="ui attached table segment">
|
|
<table class="ui very basic striped table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{.locale.Tr "admin.monitor.queue.numberworkers"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.start"}}</th>
|
|
<th>{{.locale.Tr "admin.monitor.queue.pool.timeout"}}</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Queue.Workers}}
|
|
<tr>
|
|
<td>{{.Workers}}{{if .IsFlusher}}<span title="{{$.locale.Tr "admin.monitor.queue.flush"}}">{{svg "octicon-sync"}}</span>{{end}}</td>
|
|
<td>{{template "shared/datetime/full" (dict "Datetime" (DateFmtLong .Start) "Fallback" (DateFmtLong .Start) )}}</td>
|
|
<td>{{if .HasTimeout}}{{template "shared/datetime/full" (dict "Datetime" (DateFmtLong .Timeout) "Fallback" (DateFmtLong .Timeout) )}}{{else}}-{{end}}</td>
|
|
<td>
|
|
<a class="delete-button" href="" data-url="{{$.Link}}/cancel/{{.PID}}" data-id="{{.PID}}" data-name="{{.Workers}}" title="{{$.locale.Tr "remove"}}">{{svg "octicon-trash"}}</a>
|
|
</td>
|
|
</tr>
|
|
{{else}}
|
|
<tr>
|
|
<td colspan="4">{{.locale.Tr "admin.monitor.queue.pool.workers.none"}}
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{end}}
|
|
<h4 class="ui top attached header">
|
|
{{.locale.Tr "admin.monitor.queue.configuration"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<pre>{{.Queue.Configuration | JsonPrettyPrint}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="ui gitea-confirm-modal delete modal">
|
|
<div class="header">
|
|
{{.locale.Tr "admin.monitor.queue.pool.cancel"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{$.locale.Tr "admin.monitor.queue.pool.cancel_notices" `<span class="name"></span>` | Safe}}</p>
|
|
<p>{{$.locale.Tr "admin.monitor.queue.pool.cancel_desc"}}</p>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" .}}
|
|
</div>
|
|
|
|
{{template "base/footer" .}}
|