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
|
{#
/*
* Spring Signage Ltd - http://www.springsignage.com
* Copyright (C) 2015 Spring Signage Ltd
* (${FILE_NAME})
*/
#}
{% extends "authed.twig" %}
{% import "inline.twig" as inline %}
{% block pageContent %}
{% set displayName = display.display %}
{% set displayLastAccessed = display.lastAccessed %}
{% if display.loggedIn == 1 %}
{% set title %}{% trans %}Display {{ displayName }} is currently logged-in, seen {{ timeAgo }}.{% endtrans %}{% endset %}
{% else %}
{% set title %}{% trans %}Display {{ displayName }} is not logged in at the moment and last accessed at <span class="unixDate">{{ displayLastAccessed }}</span>{% endtrans %}{% endset %}
{% endif %}
<h1 class="text-center">{{ title }}</h1>
{% if display.mediaInventoryStatus == 3 %}
<p class="text-center">{% trans "This Display hasn't connected since updates have been made in the CMS. The below information will be updated when it has." %}</p>
{% endif %}
<div class="row">
<div class="col-lg-6">
<div class="widget">
<div class="widget-title">{% trans "File Status - Count of Files" %}</div>
<div class="widget-body">
<canvas id="downloadedCountPie" style="clear:both; margin-top:25px;" width="230"></canvas>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="widget">
<div class="widget-title">{% trans "File Status - Size of Files" %}</div>
<div class="widget-body">
<canvas id="downloadedSizePie" style="clear:both; margin-top:25px;" width="230"></canvas>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="widget">
<div class="widget-title">
<button id="refreshLog" class="btn btn-sm pull-right"><span class="fa fa-refresh"></span></button>
{% trans "Errors in the Last 12 hours" %}
</div>
<div class="widget-body medium no-padding">
<table id="logs" class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Date" %}</th>
<th>{% trans "Message" %}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="widget">
<div class="widget-title">{% trans "Layouts" %}</div>
<div class="widget-body medium no-padding">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Size" %}</th>
<th>{% trans "Complete" %}</th>
<th>{% trans "Downloaded" %}</th>
</tr>
</thead>
<tbody>
{% for item in inventory.layouts %}
<tr>
<td>{{ item.itemId }}</td>
<td>{{ item.layout }}</td>
<td>{{ item.size|byteFormat }}</td>
<td>
<span class="fa {% if item.complete == 1 %}fa-check{% else %}fa-download{% endif %}"></span>
</td>
<td>{{ item.bytesRequested|byteFormat }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="widget">
<div class="widget-title">
{% trans "Media" %}
</div>
<div class="widget-body medium no-padding">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "File Name" %}</th>
<th>{% trans "Size" %}</th>
<th>{% trans "Complete" %}</th>
<th>{% trans "Downloaded" %}</th>
</tr>
</thead>
<tbody>
{% for item in inventory.media %}
<tr>
<td>{{ item.itemId }}</td>
<td>{{ item.name }}</td>
<td>{{ item.type }}</td>
<td>{{ item.storedAs }}</td>
<td>{{ item.size|byteFormat }}</td>
<td title="{% if item.lastUsed == 0 %}{{ nonceNotUsed }}{% else %}{{ nonceUsed }}{% endif %}">
<span class="fa {% if item.complete == 1 %}fa-check{% else %}fa-download{% endif %}"></span>
</td>
<td>{{ item.bytesRequested|byteFormat }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="widget">
<div class="widget-title">{% trans "Widgets" %}</div>
<div class="widget-body medium no-padding">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Complete" %}</th>
<th>{% trans "Downloaded" %}</th>
</tr>
</thead>
<tbody>
{% for item in inventory.widgets %}
<tr>
<td>{{ item.itemId }}</td>
<td>{{ item.widgetName }}</td>
<td>{{ item.type }}</td>
<td title="{% if item.lastUsed == 0 %}{{ nonceNotUsed }}{% else %}{{ nonceUsed }}{% endif %}">
<span class="fa {% if item.complete == 1 %}fa-check{% else %}fa-download{% endif %}"></span>
</td>
<td>{{ item.bytesRequested|byteFormat }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% if currentUser.routeViewable("/stats") %}
<div class="row">
<div class="col-lg-12">
<div class="widget">
<div class="widget-title">{% trans "Bandwidth" %}</div>
<div class="widget-body">
<div class="XiboGrid" id="{{ random() }}">
<div class="XiboFilter">
<div class="FilterDiv" id="bandwidthFilter">
<form class="form-inline">
{{ inline.date("fromDt", "From Date", defaults.fromDate, "", "", "", "") }}
{{ inline.date("toDt", "To Date", defaults.toDate, "", "", "", "") }}
{{ inline.hidden("displayId", display.displayId) }}
</form>
</div>
</div>
<div class="XiboData">
<canvas id="bandwidthChart" style="clear:both; margin-top:25px;" height="330"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block javaScript %}
<script type="text/javascript">
$(document).ready(function() {
var table = $("#logs").DataTable({
"language": dataTablesLanguage,
serverSide: true, stateSave: true, stateDuration: 0,
filter: false,
searchDelay: 3000,
"order": [[0, "desc"]],
ajax: {
url: "{{ urlFor("log.search") }}?{{ errorSearch|raw }}",
},
"columns": [
{"data": "logId"},
{"data": "logDate", "render": dataTableDateFromIso},
{"data": "message"}
]
});
table.on('draw', dataTableDraw);
table.on('processing.dt', dataTableProcessing);
$("#refreshLog").click(function () {
table.ajax.reload();
});
});
var bandwidthChart = null;
function setBandwidthChart() {
$.ajax({
type: "get",
url: "{{ urlFor("stats.bandwidth.data") }}",
cache: false,
dataType: "json",
data: $("#bandwidthFilter").find("form").serialize(),
success: function(response) {
if (bandwidthChart !== undefined && bandwidthChart !== null) {
console.log('Destroying Chart');
bandwidthChart.destroy();
}
if (response.extra.data.length <= 0) {
return;
}
// Create our chart
bandwidthChart = new Chart($("#bandwidthChart"), {
type: "bar",
data: {
labels: response.extra.labels,
datasets: [{
label: "{% trans "Bandwidth" %}",
backgroundColor: "rgb(11, 98, 164)",
data: response.extra.data
}]
},
options: {
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: response.extra.postUnits,
}
}]
},
legend: {
display: false
},
maintainAspectRatio: false,
}
});
}
});
}
$(document).ready(function() {
{% if currentUser.routeViewable("/stats") %}
setBandwidthChart();
// Bind to form change
$("#bandwidthFilter input, #bandwidthFilter select").change(function() {
setBandwidthChart();
});
{% endif %}
// Find all Unix Dates and sort them out
$("span.unixDate").each(function() {
$(this).html(moment($(this).html(), "X").format(jsDateFormat));
});
// Find all ISO Dates and sort them out
$("span.isoDate").each(function() {
$(this).html(moment($(this).html()).format(jsDateFormat));
});
// Handle the Pie chart for download status
var downloadedCountPie = new Chart($("#downloadedCountPie"), {
type: 'pie',
data: {
datasets: [{
data: [{{ status.countComplete }}, {{ status.countRemaining }}],
backgroundColor: ["#00CC00", "#FF0000"]
}],
labels: [
"{% trans "Downloaded" %}", "{% trans "Pending" %}"
]
}
});
var downloadedSizePie = new Chart($("#downloadedSizePie"), {
type: 'pie',
data: {
datasets: [{
data: [{{ status.sizeComplete }}, {{ status.sizeRemaining }}],
backgroundColor: ["#00CC00", "#FF0000"]
}],
labels: [
"{% trans "Downloaded" %}" + " {{ status.units }}", "{% trans "Pending" %}" + " {{ status.units }}"
]
},
});
});
</script>
{% endblock %}
|