indicate not functionnal log filters

This commit is contained in:
Vincent BOUQUET
2023-11-25 17:18:58 +01:00
parent 2b199eaf74
commit 2b19c030f8
3 changed files with 93 additions and 238 deletions

View File

@@ -31,14 +31,12 @@
<h1>Device logs</h1> <h1>Device logs</h1>
<div class="row" id="boxes"> <div class="row" id="boxes">
<div class="col-12 box-c"> <div class="col-12 box-c">
<h2 id="sta_err"> <h2 id="sta_err"><button class="btn btn-primary btn-pm" type="button" data-toggle="collapse"
<button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" data-target="#lfb"> data-target="#lfb"><i class="blue"></i></button> Logs filter<a class="cfg"
<i class="blue"></i> onclick="cfgm();"><img src="../files/settings.svg"></a></h2>
</button> Logs filter <a class="cfg" onclick="cfgm();">
<img src="../files/settings.svg">
</a>
</h2>
<div class="box collapse clearfix" id="lfb"> <div class="box collapse clearfix" id="lfb">
<small>Logs filters not functionnal on this simulator.</small>
<br>
<h3> <h3>
<button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" data-target="#f_me"> <button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" data-target="#f_me">
<i></i> <i></i>
@@ -337,8 +335,8 @@
</div> </div>
<div id="ferr"></div> <div id="ferr"></div>
<div class="float-right"> <div class="float-right">
<button type="button" class="btn btn-primary mr06" id="fap">Apply filter</button> <button type="button" class="btn btn-primary mr06" id="fap" onclick="alert('Logs filters not functionnal on this simulator.')">Apply filter</button>
<button type="button" class="btn btn-primary" id="fcl">Clear filter</button> <button type="button" class="btn btn-primary" id="fcl" onclick="alert('Logs filters not functionnal on this simulator.')">Clear filter</button>
</div> </div>
</div> </div>
</div> </div>
@@ -461,219 +459,83 @@
</div> </div>
</div> </div>
<script> <script>
var lfn = 'data'; // CREATES MODAL FOR LOG TOOLS
function cfgm() {
function cfgm() { $('#m-t').html('Logs tools');
$('#m-t').html('Logs tools'); $('#m-f').empty();
$('#m-f').empty(); $('.sb').unbind();
$('.sb').unbind(); var tl = c_btn('Download log file', 0, ' dlog');
var tl = c_btn('Download log file', 0, ' dlog'); tl += c_btn('Start DMX sniff', 0, ' ddmx');
tl += c_btn('Start DMX sniff', 0, ' ddmx'); $('#m-b').html(tl);
$('#m-b').html(tl); $('#cfg-modal').modal();
$('#cfg-modal').modal(); $('.dlog').bind('click', function () {
$('.dlog').bind('click', function() { close_modal()
location = 'file-' + lfn + '.log'; });
close_modal() $('.ddmx').bind('click', function () {
}); close_modal()
$('.ddmx').bind('click', function() { })
do_ajax('/serr', {}, function(json) {
if (json) {
if (json['dmxsnf'] == 1) alert('DMX sniffer is already running on device!');
else {
location = 'dmx_sniffer.log';
close_modal()
}
}
})
})
}
$(document).ready(function() {
$('h1').html('Device logs');
$('#boxes').after(' < div class = "row"
id = "logs" > < /div> < div class = "text-center"
id = "nxtl" > < button class = "btn btn-primary nlb" > < strong > + < /strong> < /button> < /div>');var boxes='';boxes+=' < div class = "col-12 box-c" > ';boxes+=' < h2 id = "sta_err" > < button class = "btn btn-primary btn-pm"
type = "button"
data - toggle = "collapse"
data - target = "#lfb" > < i class = "blue" > < /i> < /button>';boxes+=' Logs filter';boxes+=' < a class = "cfg"
onclick = "cfgm();" > < img src = "../files/settings.svg" > < /a>';boxes+=' < /h2>';boxes+=' < div class = "box collapse clearfix"
id = "lfb" > ';boxes+=c_tit('
f_me ','
Mechanical errors ',true,'
',1);boxes+=c_tit('
f_se ','
System errors ',true,'
',1);boxes+=c_tit('
f_sst ','
Statuses ',true,'
',1);boxes+=c_tit('
f_te ','
Temperatures ',false,'
',1);boxes+=c_ftmp(3,'
PSU ');boxes+=c_ftmp(0,'
LEDs ');boxes+=c_ftmp(1,'
Driver ');boxes+=c_ftmp(2,'
Base ');boxes+=' < /div>';boxes+=c_tit('f_dt','Start date/time
',false,'
',0);boxes+=' < div class = "form-row" > ';boxes+=c_dt('
fsd ','
Date ','
','
col - auto ','
date ');boxes+=c_dt('
fst ','
Time ','
','
col - auto ','
time ');boxes+=' < /div>';boxes+=' < /div>';boxes+=c_tit('f_cfg','Sorting,filter pass',false,'',0);boxes+=' < div class = "form-row" > ';boxes+=c_sil('
fso ','
Sorting ',['
descending ','
ascending ']);boxes+=c_sil('
fpas ','
Filter pass ',['
single groups ','
all groups ']);boxes+=' < /div>';boxes+=' < /div>';boxes+=' < div id = "ferr" > < /div>';boxes+=' < div class = "float-right" > < button type = "button"
class = "btn btn-primary mr06"
id = "fap" > Apply filter < /button> < button type = "button"
class = "btn btn-primary"
id = "fcl" > Clear filter < /button> < /div>';boxes+=' < /div>';boxes+=' < /div>';$('#boxes').html(boxes);var me_lb=[];var se_lb=[];var sst_lb=[];do_ajax('/status_i
',{},function (json){if(json){fill_values(json,['
dmxa ','
dmxp ','
dmxf ','
dmxi ','
pt ','
ip ','
mac ','
rdmu ','
rdmn ']);ptit(json['
pt ']);$('.tu ').html(json['
tu ']);lfn=json['
lfn ']}});do_ajax(' / logst ',{},function (json){if(json){for (i=0;i < json['titles'].length; i++) {
var t = json['titles'][i].trim().split(':');
var ai = [parseInt(t[0]), t[1], parseInt(t[2])];
switch (ai[0]) {
case 0:
$('#f_me').append(c_chb('fe_' + i, ai[1] + ' error', ai[2], ''));
me_lb[ai[2]] = ai[1] + ' error';
break;
case 1:
$('#f_se').append(c_chb('fe_' + i, lfix(ai[1]), ai[2], ''));
se_lb[ai[2]] = ai[1];
break;
case 2:
$('#f_sst').append(c_chb('fe_' + i, lfix(ai[1]), ai[2], ''));
sst_lb[ai[2]] = ai[1];
break
} }
}
} function lfix(l) {
}); return l.charAt(0).toUpperCase() + l.slice(1).toLowerCase().replace('ems', 'EMS')
$('#fap').bind('click', function() { }
var merf = 0;
var sef = 0; function c_chb(id, t, v, ch) {
var stf = 0; var html =
var fps = 0; '<div class="form-check form-check-inline"><input type="checkbox" class="form-check-input" id="' + id +
$('#f_me input').each(function() { '" value="' + v + '"' + ch + '>';
if ($(this).prop('checked')) merf |= (1 << $(this).val()) html += '<label class="form-check-label" for="' + id + '">' + t + '</label></div>';
}); return html
$('#f_se input').each(function() { }
if ($(this).prop('checked')) sef |= (1 << $(this).val())
}); function c_tit(id, t, e, c, p) {
$('#f_sst input').each(function() { var html =
if ($(this).prop('checked')) stf |= (1 << $(this).val()) '<h3><button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" data-target="#' + id +
}); '"><i></i></button>';
var p = 'merf=' + merf + '&sef=' + sef + '&stf=' + stf; html += ' ' + t;
for (i = 0; i < 3; i++) { if (p) html += '<div class="fall"><input type="checkbox" id="' + id + '_p"> all must pass</div>';
p += '&fts' + i + '=' + ($('#fts' + i).val() != undefined ? $('#fts' + i).val() : 0); html += '</h3>';
p += '&ftv' + i + '=' + ($('#ftv' + i).val() != undefined ? $('#ftv' + i).val() : '') html += '<div class="collapse' + c + '" id="' + id + '">';
} if (e) html += '</div>';
var di = $('#fsd').val(); return html
var ti = $('#fst').val(); }
var d = new Date(di + ' ' + ti);
if (!!d.valueOf()) { function c_ftmp(i, t) {
p += '&dty=' + d.getFullYear(); var html = '';
p += '&dtmo=' + (d.getMonth() + 1); html += '<div class="form-row">';
p += '&dtd=' + d.getDate(); html += '<div class="form-group col-auto"><label class="col-form-label" id="tl' + i + '" for="fts' + i +
p += '&dth=' + d.getHours(); '">' + t + '</label></div>';
p += '&dtmi=' + d.getMinutes(); html += '<div class="form-group col-auto"><select class="form-control" id="fts' + i + '">';
p += '&dts=' + d.getSeconds() html += '<option value="0">-</option><option value="1">&lt;=</option><option value="2">&gt;=</option>';
} html += '</select></div>';
p += '&fso=' + $('#fso').val(); html += '<div class="form-group col-auto"><input type="text" class="form-control" size="5" id="ftv' + i +
var fps_ids = ['f_me', 'f_se', 'f_st', 'f_te']; '"></div>';
for (i = 0; i < fps_ids.length; i++) { html += '<div class="form-group col-auto"><label class="col-form-label" for="ftv' + i +
if ($('#' + fps_ids[i] + '_p').prop('checked')) fps |= (1 < < i) '">&deg;<span class="tu" t1_tu_v"></span></label></div>';
} html += '</div>';
fps |= $('#fpas').val() == 1 ? (1 < < 7) : 0; return html
p += '&fps=' + fps; }
do_ajax('/logsf', p, function(json) {
if (json) { function c_dt(n, t, e, c, it) {
if (json['err']) { var html = '<div class="form-group' + c + '">';
$('#ferr').html(' < div class = "alert alert-danger" html += '<label for="' + n + '" class="col-form-label">' + t + '</label>';
role = "alert" > There are some wrong input values in logs filter! < /div>')} else {$('#ferr').html('');$('#logs').html('');llogs()}}})});$('#fap').click();$('#fcl').bind('click',function(){$('#lfb input[type=checkbox]').prop('checked',false);$('#lfb select').val('0');$('#lfb input[type=text]').val('');$('#fap').click()});$('.btn-pm').bind('click',function(){if($(this).attr('aria-expanded')=='true') $(this).removeClass('op');else $(this).addClass('op')});$('#nxtl').bind('click',function(){llogs()});function llogs(){for (i=0;i < 4; i++) { html += '</div><div class="form-group' + c + '">';
do_ajax('/log', '', function(json) { html += '<input type="' + it + '" class="form-control" id="' + n + '" step="1">';
if (json && json['time']) { html += e.length > 0 ? '<div class="invalid-feedback">' + e + '</div>' : '';
var html = ' < div class = "col-md-6 box-c log" > ';html+=' < h2 > Log '+json[' html += '</div>';
time ']+' < /h2> < div class = "box" > ';var c=' return html
';var fi=true;for (i=0;i < 24; }
i++) {
if (!(json['me'] & (1 < < i))) { function c_sil(id, t, o) {
c += (fi ? '' : ',') + me_lb[i]; var html = '<div class="form-group col-auto"><label class="col-form-label" for="' + id + '">' + t +
fi = false '</label></div>';
} html += '<div class="form-group col-auto"><select class="form-control" id="' + id + '">';
} for (i = 0; i < o.length; i++) {
if (!fi) html += ' < div class = "lme" > < h3 > Mechanical errors < /h3>'+c+' < /div>';c='';fi=true;for (i=0;i < 16; html += '<option value="' + i + '">' + o[i] + '</option>'
i++) { }
if (!(json['se'] & (1 < < i))) { html += '</select></div>';
c += (fi ? '' : ',') + se_lb[i]; return html
fi = false }
} </script>
}
if (!fi) html += ' < div class = "lse" > < h3 > System errors < /h3>'+c+' < /div>';c='';fi=true;for (i=0;i < 8; i++) {
if (!(json['st'] & (1 < < i))) {
c += (fi ? '' : ',') + sst_lb[i];
fi = false
}
}
if (!fi) html += ' < div class = "lse" > < h3 > Statuses < /h3>'+c+' < /div>';if(json['st'] & (1< < 7)) {
html += ' < div > < h3 > Temperatures < /h3> < ul class = "group" > ';var tc=4;var t=json['
tmp '];for (j=0;j < tc;
j++) {
if ($('#tl' + j).length == 0) continue;
html += ' < li '+(t[j+1]==' - 32 ' ? '
class = "dn"
':'
')+' > '+$('
#tl '+j).html()+' < /li>'}html+=' < /ul> < ul class = "group vals" > ';var c;for (j=0;j < tc;
j++) {
if ($('#tl' + j).length == 0) continue;
c = '';
if (t[0] & (1 < < j)) c += ' err';
if (t[j + 1] == '-32') c += ' dn';
html += ' < li class = "'+c.trim()+'" > ';html+=t[j+1]+' & deg;
'+json['
tu ']+' < /li>'}html+=' < /ul>';if(json['dor']!='Undefined') html+=' < h3 > Display orientation < /h3>'+json['dor'];html+=' < /div>'}html+=' < /div> < /div>';$('#logs').append(html);$('#nxtl').show()} else $('#nxtl').hide()})}}});function lfix(l){return l.charAt(0).toUpperCase()+l.slice(1).toLowerCase().replace('ems','EMS')}function c_chb(id,t,v,ch){var html=' < div class = "form-check form-check-inline" > < input type = "checkbox"
class = "form-check-input"
id = "'+id+'"
value = "'+v+'"
'+ch+' > ';html+=' < label class = "form-check-label"
for = "'+id+'" > '+t+' < /label> < /div>';return html}function c_tit(id,t,e,c,p){var html=' < h3 > < button class = "btn btn-primary btn-pm"
type = "button"
data - toggle = "collapse"
data - target = "#'+id+'" > < i > < /i> < /button>';html+=' '+t;if(p) html+=' < div class = "fall" > < input type = "checkbox"
id = "'+id+'_p" > all must pass < /div>';html+=' < /h3>';html+=' < div class = "collapse'+c+'"
id = "'+id+'" > ';if(e) html+=' < /div>';return html}function c_ftmp(i,t){var html='';html+=' < div class = "form-row" > ';html+=' < div class = "form-group col-auto" > < label class = "col-form-label"
id = "tl'+i+'"
for = "fts'+i+'" > '+t+' < /label> < /div>';html+=' < div class = "form-group col-auto" > < select class = "form-control"
id = "fts'+i+'" > ';html+=' < option value = "0" > - < /option> < option value = "1" > & lt; = < /option> < option value = "2" > & gt; = < /option>';html+=' < /select> < /div>';html+=' < div class = "form-group col-auto" > < input type = "text"
class = "form-control"
size = "5"
id = "ftv'+i+'" > < /div>';html+=' < div class = "form-group col-auto" > < label class = "col-form-label"
for = "ftv'+i+'" > & deg; < span class = "tu" > < /span> < /label> < /div>';html+=' < /div>';return html}function c_sil(id,t,o){var html=' < div class = "form-group col-auto" > < label class = "col-form-label"
for = "'+id+'" > '+t+' < /label> < /div>';html+=' < div class = "form-group col-auto" > < select class = "form-control"
id = "'+id+'" > ';for (i=0;i < o.length;
i++) {
html += ' < option value = "'+i+'" > '+o[i]+' < /option>'}html+=' < /select> < /div>';return html}
</script>
</body> </body>
</html> </html>

View File

@@ -44,11 +44,9 @@
<div class="row"> <div class="row">
<div class="col-12 box-c mt-2 mb-2"> <div class="col-12 box-c mt-2 mb-2">
<h2 id="sta_err"> <h2 id="sta_err">
<button class="btn btn-primary btn-pm collapsed" type="button" data-toggle="collapse" data-target="#lfb"> <button class="btn btn-primary btn-pm collapsed" type="button" data-toggle="collapse" data-target="#lfb"><i class="blue"></i></button>Logs filter</h2>
<i class="blue"></i>
</button> Logs filter
</h2>
<div class="box collapse clearfix" id="lfb"> <div class="box collapse clearfix" id="lfb">
<small>Logs filters not functionnal on this simulator.</small>
<div class="form-row"> <div class="form-row">
<div class="form-group col-auto"> <div class="form-group col-auto">
<label for="fsd" class="col-form-label">Start date</label> <label for="fsd" class="col-form-label">Start date</label>
@@ -127,8 +125,8 @@
</div> </div>
</div> </div>
<div class="float-right"> <div class="float-right">
<button type="button" class="btn btn-primary mr06" id="fap">Apply filter</button> <button type="button" class="btn btn-primary mr06" id="fap" onclick="alert('Logs filters not functionnal on this simulator.')">Apply filter</button>
<button type="button" class="btn btn-primary" id="fcl">Clear filter</button> <button type="button" class="btn btn-primary" id="fcl" onclick="alert('Logs filters not functionnal on this simulator.')">Clear filter</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -35,14 +35,11 @@
<h1>Device logs</h1> <h1>Device logs</h1>
<div class="row" id="boxes"> <div class="row" id="boxes">
<div class="col-12 box-c"> <div class="col-12 box-c">
<h2 id="sta_err"><button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" <h2 id="sta_err"><button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" data-target="#lfb"><i class="blue"></i></button> Logs filter<a class="cfg" onclick="cfgm();"><img src="../files/settings.svg"></a></h2>
data-target="#lfb"><i class="blue"></i></button> Logs filter<a class="cfg"
onclick="cfgm();"><img src="../files/settings.svg"></a></h2>
<div class="box collapse clearfix" id="lfb"> <div class="box collapse clearfix" id="lfb">
<h3><button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" <small>Logs filters not functionnal on this simulator.</small>
data-target="#f_me"><i></i></button> Mechanical errors<div class="fall"><input <br>
type="checkbox" id="f_me_p"> all must pass</div> <h3><button class="btn btn-primary btn-pm" type="button" data-toggle="collapse" data-target="#f_me"><i></i></button> Mechanical errors<div class="fall"><input type="checkbox" id="f_me_p">all must pass</div></h3>
</h3>
<div class="collapse" id="f_me"> <div class="collapse" id="f_me">
<div class="form-check form-check-inline"><input type="checkbox" class="form-check-input" <div class="form-check form-check-inline"><input type="checkbox" class="form-check-input"
id="fe_0" value="0"><label class="form-check-label" for="fe_0">Pan error</label></div> id="fe_0" value="0"><label class="form-check-label" for="fe_0">Pan error</label></div>
@@ -326,9 +323,7 @@
</div> </div>
</div> </div>
<script> <script>
var lfn = 'data'; // CREATES MODAL FOR LOG TOOLS
// CREATES MODAL FOR LOG TOOLS
function cfgm() { function cfgm() {
$('#m-t').html('Logs tools'); $('#m-t').html('Logs tools');
$('#m-f').empty(); $('#m-f').empty();