-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathadmin_machines.html.ep
More file actions
364 lines (344 loc) · 20 KB
/
admin_machines.html.ep
File metadata and controls
364 lines (344 loc) · 20 KB
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<!DOCTYPE html>
<html ng-app="ravada.app">
%= include 'bootstrap/header'
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top" role="document">
<div id="wrapper">
<div ng-controller="machinesPage" ng-init="subscribe_all('<%= url_for('ws_subscribe')->to_abs %>');n_clones_hide=<%= $n_clones_hide %>;check_netdata='<%= $check_netdata %>'"
id="controller"
>
%= include 'bootstrap/navigation'
<div id="page-wrapper">
<div id="admin-content">
<div class="panel-body">
<div class="col-lg-12">
<div ng-show="pingbe_fail" class="alert alert-danger" ng-cloak>
<strong><%=l 'Error!' %></strong><%=l 'Backend not available!' %>
</div>
% if ($USER->is_operator || $USER->is_admin) {
%= include 'main/check_ws'
% }
%= include 'main/connection_lost'
<div class="row">
<div style="margin-right: 10px;" data-netdata="system.swap"
data-dimensions="used"
data-append-options="percentage"
data-chart-library="easypiechart"
data-title="Used Swap"
data-units="%"
data-easypiechart-max-value="100"
data-width="9%"
data-before="0"
data-after="- duration.toString()"
data-points="duration.toString()"
data-colors="#DD4400"
role="application"></div>
<div style="margin-right: 10px;" data-netdata="system.io"
data-dimensions="in"
data-chart-library="easypiechart"
data-title="Disk Read"
data-width="11%"
data-before="0"
data-after="- duration.toString()"
data-points="duration.toString()"
data-common-units="system.io.mainhead"
role="application"></div>
<div style="margin-right: 10px;" data-netdata="system.io"
data-dimensions="out"
data-chart-library="easypiechart"
data-title="Disk Write"
data-width="11%"
data-before="0"
data-after="- duration.toString()"
data-points="duration.toString()"
data-common-units="system.io.mainhead"
role="application"></div>
<div style="margin-right: 10px;" data-netdata="system.cpu"
data-chart-library="gauge"
data-title="CPU"
data-units="%"
data-gauge-max-value="100"
data-width="20%"
data-after="- duration.toString()"
data-points="duration.toString()"
role="application"></div>
<div style="margin-right: 10px;" data-netdata="system.net"
data-dimensions="received"
data-chart-library="easypiechart"
data-title="Net Inbound"
data-width="11%"
data-before="0"
data-after="- duration.toString()"
data-points="duration.toString()"
data-common-units="system.net.mainhead"
role="application"></div>
<div style="margin-right: 10px;" data-netdata="system.net"
data-dimensions="sent"
data-chart-library="easypiechart"
data-title="Net Outbound"
data-width="11%"
data-before="0"
data-after="- duration.toString()"
data-points="duration.toString()"
data-common-units="system.net.mainhead"
role="application"></div>
<div style="margin-right: 10px;" data-netdata="system.ram"
data-dimensions="used|buffers"
data-append-options="percentage"
data-chart-library="easypiechart"
data-title="Used RAM"
data-units="%"
data-easypiechart-max-value="100"
data-width="9%"
data-after="- duration.toString()"
data-points="duration.toString()"
role="application"></div>
</div>
<div class="row">
<div class="col-md-5"><h2><%=l 'Virtual Machines' %></h2></div>
</div>
%= include 'bootstrap/requests'
<div ng-show="!list_machines"><%=l 'Loading ...' %> </div>
<table id="list_machines" class="table admin-cont-body" border="1"
ng-show="list_machines" ng-cloak="1">
<thead>
<tr>
<th ><div class="lgMachName machine-button" style="display:inline;float:down">
<%=l 'Machine Name' %></div>
</th>
<th class="lgMachToggle">
<span
ng-click="hideClones()"
title="<%=l 'Show/Hide clones' %>">
<%=l 'Base' %></span></th>
<th class="lgMachToggle"><%=l 'Public'%></th>
% if ($USER->can_create_base && $autostart) {
<th class="lgMachToggle"><%=l 'Autostart'%></th>
% }
<th class="lgMachToggle machine-button">
<div style="float:right">
<%=l 'Status' %></div></th>
<th class="lgMachActions"><%=l 'Actions' %></th>
% if ($_n_nodes>1 ) {
<th class="lgMachNode"><%=l 'Node' %></th>
% }
</tr>
</thead>
<tbody>
<tr ng-repeat="machine in list_machines" ng-show="machine.show" class="bg-light">
<td class="lgMachName" style="padding-left: {{1+machine._level*2}}em">
<i class="far fa-clone" title="Cloned" ng-show="!machine.is_pool && machine.id_base>0"></i>
<i class="far fa-file-alt" title="Pool" ng-show="machine.is_pool"></i>
<a align="right" href="/machine/manage/{{machine.id}}.html"
class="machine"
ng-class="{
disabled: !machine.can_manage
,base: machine.is_base
,active_machine: machine.status == 'active'
}"
title ="<%=l 'Manage machine' %>">{{machine.name}}</a> {{machine.comment}}
<button ng-show="machine.has_clones && !filter"
type="button"
class="badge badge-light text-blue"
ng-click="toggle_show_clones(machine.id)"
title="<%=l 'Show/Hide clones' %>">
<b ng-show="show_clones[machine.id]" >-</b>
<b ng-show="!show_clones[machine.id]">+</b>
</button>
<i class="fas fa-sync-alt fa-spin" ng-show="show_clones[machine.id] && !n_clones"></i>
</td>
<td class="lgMachToggle" >
% if ($_user->can_create_base ) {
<i ng-show="machine.has_clones" class="fa fa-check" aria-hidden="true"
title ="<%=l 'Cannot remove base, machine has clones' %>" ng-cloak></i>
<input type="checkbox"
ng-model="machine.is_base"
ng-true-value="1" ng-false-value="0"
ng-show="can_manage_base(machine)"
ng-disabled="list_machines_time<2 || machine.is_volatile"
ng-click="open_modal('mb_',machine)"/>
<div class="modal fade" tabindex="-1" role="dialog" id="mb_{{machine.id}}">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><%=l 'Changing Base State' %></h4>
<button type="button" class="close"
data-dismiss="modal" aria-label="Close"
ng-click="cancel_modal(machine,'is_base')"
><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body" ng-show="!machine.is_base">
<p><%=l 'Are you sure you want to remove the base of' %> {{machine.name}}?</p>
</div>
<div class="modal-body" ng-show="machine.is_base">
<div ng-show="machine.info.cdrom">
<p>
<%=l 'This machine has a CD-ROM' %>
</p>
<ul>
<li ng-repeat="cdrom in machine.info.cdrom">{{cdrom}}</li>
</ul>
<input type="checkbox" ng-model="with_cd" name="with_cd"/>
<label for="with_cd"><%=l 'Keep the CD for the clones' %></label>
</div>
<p><%=l 'Are you sure you want to prepare the base of' %> {{machine.name}}?</p>
</div>
<div ng-show="!machine.info">
<i class="fas fa-sync-alt fa-spin"></i>
</div>
<div class="modal-footer" ng-show="machine.info">
<button type="button" class="btn btn-secondary" data-dismiss="modal" ng-click="cancel_modal(machine,'is_base')"><%=l 'No' %></button>
<button type="button" class="btn btn-primary" ng-click="cancel_modal(machine);action('machine','remove_base',machine)" ng-show="!machine.is_base" data-dismiss="modal"><%=l 'Yes' %></button>
<button type="button" class="btn btn-primary" ng-click="cancel_modal();request('prepare_base',{ 'id_domain': machine.id, 'with_cd': with_cd })" ng-show="machine.is_base" data-dismiss="modal"><%=l 'Yes' %></button>
</div>
</div>
</div>
</div>
% }
</td>
<td class="lgMachToggle">
% if ($_user->can_create_base ) {
<input type="checkbox"
ng-click="open_modal('mp_',machine)"
title="<%=l 'Make public'%>"
ng-disabled="list_machines_time<2" ng-model="machine.is_public"
ng-true-value="1" ng-false-value="0"
ng-show="machine.is_base"
>
<div class="modal fade" tabindex="-1" role="dialog" id="mp_{{machine.id}}">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><%=l 'Changing Public State' %></h4>
<button type="button" class="close"
data-dismiss="modal"
aria-label="Close"
ng-click="cancel_modal(machine,'is_public')"
><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<p><%=l 'Are you sure you want to change the Public state of' %> {{machine.name}} <%=l 'to' %> {{!(machine.is_public==0)}}?</p>
<div ng-show="machine.is_public==0" class="ml-4">
<input type="checkbox" name="show_clones" ng-model="machine.show_clones"
ng-true-value="1" ng-false-value="0"
>
<label for="show_clones"><%=l 'Show already created clones' %></label>
<button type="button" class="badge" ng-click="help_show_clones=!help_show_clones">?</button>
<div ng-show="help_show_clones">
<span class="info"><%=l 'The user will be able to access the clone, even when the base is hidden.' %> <%=l 'But no new clones can be created.' %></span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" ng-click="cancel_modal(machine,'is_public')"><%=l 'No' %></button>
<button type="button" class="btn btn-primary" ng-click="cancel_modal();set_public(machine.id, machine.is_public, machine.show_clones)" data-dismiss="modal"><%=l 'Yes' %></button>
</div>
</div>
</div>
</div>
</td>
% if ($autostart) {
<td class="lgMachToggle">
<input type="checkbox" ng-hide="machine.has_clones || machine.is_base" ng-model="machine.autostart" ng-true-value="1" ng-false-value="0" ng-change="set_autostart(machine.id,machine.autostart)" title="{{ machine.autostart ? 'Disable' : 'Enable'}} autostart">
</td>
% }
% }
<td class="lgMachActions">
<span style="float:right;" ng-show="machine.is_paused && machine.is_active" class="badge label-warning" ng-cloak><%=l 'Paused' %></span>
<span style="float:right;" ng-show="!machine.is_paused && machine.is_active && !machine.is_volatile" class="badge badge-success" ng-cloak><%=l 'Running' %></span>
<span style="float:right;" ng-show="!machine.is_paused && machine.is_active && machine.is_volatile" class="badge badge-success volatile" ng-cloak><%=l 'Volatile' %></span>
<span style="float:right;" ng-show="!machine.is_active && !machine.is_hibernated" class="badge badge-danger" ng-cloak><%=l 'Down' %></span>
<span style="float:right;" ng-show="machine.is_hibernated" class="badge badge-warning" ng-cloak><%=l 'Hibernated' %></span>
<br><span style="float:right;" ng-show="machine.is_active" class="badge badge-secondary">{{machine.remote_ip}}</span>
<button style="float:right;"
title="{{machine.date_status_change.date_txt}}"
ng-hide="machine.is_active || machine.is_base || !machine.date_status_change.date_txt"
class="badge badge-light border border-secondary info"
>
<span class="info">
{{machine.date_status_change.duration[0]}}
{{machine.date_status_change.duration[1]}}
</span>
</button>
</td>
<td class="lgMachToggle" style="white-space:nowrap">
<div ng-hide="machine.is_locked||machine.is_base">
<button type="button" class="btn btn-success btn-sm"
ng-click="action('machine','start',machine)"
ng-disabled="machine.is_active"
ng-show="machine.can_start"
title="<%=l 'Start' %>">
<i class="fa fa-play"></i>
</button>
<button
type="button" class="btn btn-warning btn-sm"
ng-click="action('machine','hibernate',machine)"
ng-disabled="!machine.is_active"
ng-show="machine.can_hibernate"
title="<%=l 'Hibernate' %>">
<i class="fa fa-pause"></i>
</button>
<button
type="button" class="btn btn-danger btn-sm"
ng-click="action('machine','shutdown',machine, false)"
ng-disabled="!machine.is_active"
ng-show="machine.can_shutdown"
title="<%=l 'ShutDown' %>">
<i class="fa fa-power-off"></i>
</button>
<!-- Pop-up window confirming the shutdown action and force shutdown. #issue 2185 -->
<div id="afc_{{machine.id}}" class="modal fade">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><%=l 'Shutdown confirmation' %></h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p><%=l 'Attention this machine has the autostart option activated !' %> </p>
<p><%=l 'Are you sure you want to shutdown the machine ?' %> </p>
</div>
<div class="modal-footer">
<button type="button" ng-click="action('machine', 'shutdown', machine, true)" class="btn btn-danger" data-dismiss="modal"><%=l 'Yes' %></button>
<button type="button" ng-click="cancel_modal(machine, undefined)" class="btn btn-secondary" data-dismiss="modal"
><%=l 'No' %></button>
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-primary btn-sm"
ng-click="action('machine','view-new-tab',machine)"
ng-show="machine.can_view"
title="<%=l 'View' %>">
<i class="fa fa-desktop"></i>
</button>
</div>
<div ng-show="machine.is_locked" ng-cloak>Machine <a href="/request/{{machine.is_locked}}.html"><%=l 'locked' %></a></div>
<div ng-show="machine.is_base && !machine.is_locked"
ng-cloak><span class="badge badge-pill badge-light"><%=l 'This Machine is a base' %></span></div>
</td>
% if ($_n_nodes>1 ) {
<td class="lgMachNode">
<span class="badge badge-info" title="<%=l 'Node'%>">{{machine.node}}</span>
</td>
% }
</tr>
</tbody>
</table>
<div ng-cloak="1"
ng-show="list_machines && list_machines_time > 2 && ( show_active || filter) && !n_show">
<span ng-show="show_active"><%=l 'There are no active virtual machines'%></span>
<span ng-show="filter"><%=l 'There are no machines that match the selection' %></span>
<button ng-click="reload_list()"><%=l 'reload list' %></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
%= include 'bootstrap/scripts'
%= include $footer
%= include 'bootstrap/messages'
</body>
</html>