aboutsummaryrefslogtreecommitdiffstats
path: root/templates/admin/queue.tmpl
blob: a7ea4c602a3027f14172a587ef8b28db85ca86c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{{template "base/head" .}}
<div 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>{{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}}"><span class="text red" title="{{$.locale.Tr "remove"}}">{{svg "octicon-trash"}}</span></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 small basic delete modal">
	<div class="ui icon header">
		{{svg "octicon-x" 16 "close inside"}}
		{{.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/delete_modal_actions" .}}
</div>

{{template "base/footer" .}}