-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
393 lines (342 loc) · 12.4 KB
/
index.html
File metadata and controls
393 lines (342 loc) · 12.4 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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<html>
<head>
<style>
:root {
--fail-color: #a52020;
--genlock-color: #808020;
--training-color: #156565;
--background-color: #222222;
--background-color-heading: #333333;
--text-color: #ececec;
background-color: var(--background-color);
color: var(--text-color);
}
a {
color: white;
}
.disconnected {
background-color: var(--fail-color);
}
.notgenlocked {
background-color: var(--genlock-color);
}
.trainingfail {
background-color: var(--training-color);
}
div.heading {
font-size: 24px;
font-variant: small-caps;
}
div.date {
font-size: 14px;
font-variant: small-caps;
}
div.legend {
border: 1px solid black;
position: fixed;
right: 25;
top: 15;
text-align: left;
font-size: 14px;
}
div.legend * {
padding: 5px 10px;
}
table {
width: 100%;
font-size: 14px;
}
th {
font-size: 16px;
text-align: left;
font-variant: small-caps;
}
tr.spacing {
font-size: 18px;
background-color: var(--background-color-heading);
}
td {
border-bottom: 1px solid #999999;
}
</style>
<title>DisplayPort ENA-340 Status</title>
<meta http-equiv="refresh" content="60"/>
</head>
<script type="text/javascript">
function readTextFile(file) {
var content;
const f = new XMLHttpRequest();
f.open("GET", file, false);
f.onreadystatechange = function () {
if (f.readyState === 4 && (f.status === 200 || f.status == 0)) {
content = f.responseText;
}
}
f.send(null);
return {
content: content,
date: f.getResponseHeader('Last-Modified')
}
}
function createEntry(value) {
var td = document.createElement('td');
td.innerHTML = value;
return td;
}
function createEntryLink(value) {
var td = document.createElement('td');
td.innerHTML = '<a href="//172.19.7.' + value + '" target="_blank">' + value + '</a>';;
return td;
}
function createSpacing(text) {
const row = document.createElement('tr');
row.className = 'spacing';
const td = document.createElement('td');
td.colSpan = 10;
td.innerHTML = text;
row.appendChild(td);
return row;
}
function addEncoder(encoder, data, table, checkTraining) {
const row = document.createElement('tr');
row.appendChild(createEntry(encoder.id));
row.appendChild(createEntryLink(encoder.unit));
row.appendChild(createEntry(encoder.name));
const device = data.Sources.find(e => e.id == encoder.id);
const TestString = 'Link trained; Bit per color component : 8; Current LaneCount: 4; Current LinkRate : 20 (HBR2);';
if (device) {
if (checkTraining) {
if (device.config.traininginfo.substring(0, TestString.length) !== TestString) {
row.className = 'trainingfail';
}
}
if (device.config.connected != null && !device.config.connected) {
row.className = 'disconnected';
}
row.appendChild(createEntry(device.config.resolution));
row.appendChild(createEntry(device.deviceId));
if(row.className == 'disconnected'){
row.appendChild(createEntry(device.config.traininginfo.substring(0, TestString.length+47)));
}
else{
row.appendChild(createEntry(device.config.traininginfo.substring(0, TestString.length)));
}
}
else {
row.className = 'disconnected';
const td = document.createElement('td');
td.colspan = 3;
td.innerHTML = 'Not Found in List';
row.appendChild(td);
}
table.appendChild(row);
}
function createActiveClusterTable(data) {
let sources = JSON.parse(readTextFile('encoders.json').content);
// Bravo system
const bravos = sources.filter(d => d.system === 'Bravo');
sources = sources.filter(d => d.system !== 'Bravo');
// Atlas system
const atlases = sources.filter(d => d.system === 'Atlas');
sources = sources.filter(d => d.system !== 'Atlas');
// Draco system
const dracos = sources.filter(d => d.system === 'Draco');
sources = sources.filter(d => d.system !== 'Draco');
// Sushi/Fishy system
const sushis = sources.filter(d => d.system === 'Sushi');
sources = sources.filter(d => d.system !== 'Sushi');
// vMix system
const vmix = sources.filter(d => d.system === 'vMix');
sources = sources.filter(d => d.system !== 'vMix');
// Barco stuff
const barcos = sources.filter(d => d.system === 'Barco');
sources = sources.filter(d => d.system !== 'Barco');
const table = document.getElementById('clustertable');
table.appendChild(createSpacing('Bravo'));
bravos.forEach(d => addEncoder(d, data, table, true));
table.appendChild(createSpacing('Atlas'));
atlases.forEach(d => addEncoder(d, data, table, true));
table.appendChild(createSpacing('Draco'));
dracos.forEach(d => addEncoder(d, data, table, true));
table.appendChild(createSpacing('Sushi & Fishy'));
sushis.forEach(d => addEncoder(d, data, table));
}
function createOtherEncoderTable(data) {
let sources = JSON.parse(readTextFile('encoders.json').content);
// Bravo system
const bravos = sources.filter(d => d.system === 'Bravo');
sources = sources.filter(d => d.system !== 'Bravo');
// Atlas system
const atlases = sources.filter(d => d.system === 'Atlas');
sources = sources.filter(d => d.system !== 'Atlas');
// Draco system
const dracos = sources.filter(d => d.system === 'Draco');
sources = sources.filter(d => d.system !== 'Draco');
// Sushi/Fishy system
const sushis = sources.filter(d => d.system === 'Sushi');
sources = sources.filter(d => d.system !== 'Sushi');
// vMix system
const vmix = sources.filter(d => d.system === 'vMix');
sources = sources.filter(d => d.system !== 'vMix');
// Barco stuff
const barcos = sources.filter(d => d.system === 'Barco');
sources = sources.filter(d => d.system !== 'Barco');
const table = document.getElementById('sourcetable');
table.appendChild(createSpacing('vMix'));
vmix.forEach(d => addEncoder(d, data, table));
table.appendChild(createSpacing('Barco'));
barcos.forEach(d => addEncoder(d, data, table));
if (sources.length > 0) {
table.appendChild(createSpacing('Other'));
sources.forEach(d => addEncoder(d, data, table));
}
}
function addDecoder(decoder, data, table) {
const row = document.createElement('tr');
row.appendChild(createEntry(decoder.id));
row.appendChild(createEntryLink(decoder.unit));
row.appendChild(createEntry(decoder.name));
const device = data.Destinations.find(e => e.id == decoder.id);
if (device) {
if (device.config.genlocked != null && !device.config.genlocked) {
row.className = 'notgenlocked';
}
if (device.config.connected != null && !device.config.connected) {
row.className = 'disconnected';
}
row.appendChild(createEntry(device.config.resolution));
row.appendChild(createEntry(device.deviceId));
row.appendChild(createEntry(device.config.state, device.config.genlocked));
row.appendChild(createEntry(device.config['Edid preferred Timing']));
row.appendChild(createEntry(device.config.display[0].model));
row.appendChild(createEntry(device.config['genlock source']));
row.appendChild(createEntry(device.config.traininginfo));
}
else {
const td = document.createElement('td');
td.colspan = 7;
td.innerHTML = 'Not Found in List';
row.appendChild(td);
}
table.appendChild(row);
}
function createProjectorTable(data) {
let destinations = JSON.parse(readTextFile('decoders.json').content);
// Projectors
const projectors = destinations.filter(d => d.group === 'projector');
destinations = destinations.filter(d => d.group !== 'projector');
const table = document.getElementById('projectortable');
table.appendChild(createSpacing(''));
projectors.forEach(d => addDecoder(d, data, table));
}
function createMonitorTable(data) {
let destinations = JSON.parse(readTextFile('decoders.json').content);
// Booth monitors
const booths = destinations.filter(d => d.group === 'booth');
destinations = destinations.filter(d => d.group !== 'booth');
// Serverroom monitors
const serverroom = destinations.filter(d => d.group === 'serverroom');
destinations = destinations.filter(d => d.group !== 'serverroom');
// Offices
const offices = destinations.filter(d => d.group === 'offices');
destinations = destinations.filter(d => d.group !== 'offices');
const table = document.getElementById('monitortable');
table.appendChild(createSpacing('Booth Monitors'));
booths.forEach(d => addDecoder(d, data, table));
table.appendChild(createSpacing('Serverroom Monitors'));
serverroom.forEach(d => addDecoder(d, data, table));
table.appendChild(createSpacing('Office Monitors'));
offices.forEach(d => addDecoder(d, data, table));
}
function updatePage() {
// Setting the active cluster part of the page
const encodersText = readTextFile('.sources.txt');
const encodersData = JSON.parse(encodersText.content);
createActiveClusterTable(encodersData);
var clusterDate = document.createElement('p');
clusterDate.innerHTML = encodersText.date;
document.getElementById('clusterdate').appendChild(clusterDate);
// Setting the other encoders part of the page
createOtherEncoderTable(encodersData);
var encoderDate = document.createElement('p');
encoderDate.innerHTML = encodersText.date;
document.getElementById('sourcedate').appendChild(encoderDate);
// Settings the projector decoders part of the page
const decodersText = readTextFile('.destinations.txt');
const decodersData = JSON.parse(decodersText.content);
createProjectorTable(decodersData);
var projectorDate = document.createElement('p');
projectorDate.innerHTML = decodersText.date;
document.getElementById('projectordate').appendChild(projectorDate);
// Settings the monitor decoders part of the page
createMonitorTable(decodersData);
var monitorDate = document.createElement('p');
monitorDate.innerHTML = decodersText.date;
document.getElementById('monitordate').appendChild(monitorDate);
}
</script>
<body onLoad="updatePage()">
<div class="legend">
<div class="disconnected">Not connected</div>
<div class="notgenlocked">No genlock</div>
<div class="trainingfail">Training failure</div>
</div>
<div class="heading">Projector Decoders Status</div>
<div class="date" id="projectordate"></div>
<table id="projectortable">
<tr>
<th><p>ID</p></th>
<th><p>IP (Unit)</p></th>
<th><p>Name</p></th>
<th><p>Resolution/Connected</p></th>
<th><p>Device ID</p></th>
<th><p>State/Genlocked</p></th>
<th><p>Preferred EDID</p></th>
<th><p>Display Model</p></th>
<th><p>Genlock Source</p></th>
<th><p>Training Info</p></th>
</tr>
</table>
<br />
<div class="heading">Active Cluster Encoders Status</div>
<div class="date" id="clusterdate"></div>
<table id="clustertable">
<tr>
<th><p>ID</p></th>
<th><p>IP (Unit)</p></th>
<th><p>Name</p></th>
<th><p>Resolution/Connected</p></th>
<th><p>Device ID</p></th>
<th><p>Training Info</p></th>
</table>
<br />
<div class="heading">Monitor Decoders Status</div>
<div class="date" id="monitordate"></div>
<table id="monitortable">
<tr>
<th><p>ID</p></th>
<th><p>IP (Unit)</p></th>
<th><p>Name</p></th>
<th><p>Resolution/Connected</p></th>
<th><p>Device ID</p></th>
<th><p>State/Genlocked</p></th>
<th><p>Preferred EDID</p></th>
<th><p>Display Model</p></th>
<th><p>Genlock Source</p></th>
<th><p>Training Info</p></th>
</tr>
</table>
<br />
<div class="heading">Other Encoders Status</div>
<div class="date" id="sourcedate"></div>
<table id="sourcetable">
<tr>
<th><p>ID</p></th>
<th><p>IP (Unit)</p></th>
<th><p>Name</p></th>
<th><p>Resolution/Connected</p></th>
<th><p>Device ID</p></th>
<th><p>Training Info</p></th>
</table>
</body>
</html>