2020-07-27 20:00:36 +02:00
|
|
|
var conf_editor = null;
|
|
|
|
var createdCont = false;
|
|
|
|
|
|
|
|
performTranslation();
|
|
|
|
requestLoggingStart();
|
2017-02-08 14:36:28 +01:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
2017-02-15 15:53:35 +01:00
|
|
|
var messages;
|
2017-07-30 14:36:23 +02:00
|
|
|
var loguplmess = "";
|
2017-03-18 00:05:04 +01:00
|
|
|
var reportUrl = 'https://report.hyperion-project.org/#';
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
$('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit'));
|
2019-06-05 18:19:08 +02:00
|
|
|
if(window.showOptHelp)
|
2017-01-17 21:53:35 +01:00
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
$('#conf_cont').append(createHelpTable(window.schema.logger.properties, $.i18n("edt_conf_log_heading_title")));
|
2017-02-08 14:36:28 +01:00
|
|
|
createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head");
|
2017-01-17 21:53:35 +01:00
|
|
|
}
|
2017-04-07 21:33:40 +02:00
|
|
|
$("#log_upl_pol").append('<span style="color:grey;font-size:80%">'+$.i18n("conf_logging_uplpolicy")+' '+buildWL("user/support#report_privacy_policy",$.i18n("conf_logging_contpolicy")));
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2016-12-04 19:32:23 +01:00
|
|
|
conf_editor = createJsonEditor('editor_container', {
|
2019-06-05 18:19:08 +02:00
|
|
|
logger : window.schema.logger
|
2017-01-17 21:53:35 +01:00
|
|
|
}, true, true);
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
conf_editor.on('change',function() {
|
2020-11-01 19:47:30 +01:00
|
|
|
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
2017-01-17 21:53:35 +01:00
|
|
|
});
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2016-12-04 19:32:23 +01:00
|
|
|
$('#btn_submit').off().on('click',function() {
|
|
|
|
requestWriteConfig(conf_editor.getValue());
|
|
|
|
});
|
2017-02-28 17:53:41 +01:00
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
$('#btn_logupload').off().on('click',function() {
|
|
|
|
uploadLog();
|
|
|
|
$(this).attr("disabled", true);
|
|
|
|
$('#upl_link').html($.i18n('conf_logging_uploading'))
|
|
|
|
});
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-03-18 00:05:04 +01:00
|
|
|
//show prev uploads
|
|
|
|
var ent;
|
|
|
|
|
|
|
|
if(getStorage("prev_reports"))
|
|
|
|
{
|
|
|
|
ent = JSON.parse(getStorage("prev_reports"));
|
2017-04-07 21:33:40 +02:00
|
|
|
$('#prev_reports').append('<h4 style="margin-top:30px">'+$.i18n('conf_logging_lastreports')+'</h4>');
|
2017-03-18 00:05:04 +01:00
|
|
|
for(var i = 0; i<ent.length; i++)
|
|
|
|
{
|
|
|
|
$('#prev_reports').append('<p><a href="'+reportUrl+ent[i].id+'" target="_blank">'+ent[i].title+'('+ent[i].time+')</a></p>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ent = [];
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-03-18 00:05:04 +01:00
|
|
|
function updateLastReports(id,time,title)
|
|
|
|
{
|
|
|
|
if(ent.length > 4)
|
|
|
|
ent.pop();
|
|
|
|
ent.unshift({"id": id ,"time": time,"title": title})
|
|
|
|
setStorage("prev_reports",JSON.stringify(ent));
|
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-15 15:53:35 +01:00
|
|
|
function uploadLog()
|
|
|
|
{
|
|
|
|
var log = "";
|
2019-06-05 18:19:08 +02:00
|
|
|
var config = JSON.stringify(window.serverConfig, null).replace(/"/g, '\\"');
|
|
|
|
var prios = window.serverInfo.priorities;
|
|
|
|
var comps = window.serverInfo.components;
|
|
|
|
var sys = window.sysInfo.system;
|
|
|
|
var shy = window.sysInfo.hyperion;
|
2017-02-28 17:53:41 +01:00
|
|
|
var info;
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-15 15:53:35 +01:00
|
|
|
//create log
|
2017-07-30 14:36:23 +02:00
|
|
|
log = (messages ? loguplmess : "Log was empty!");
|
2017-04-07 21:33:40 +02:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
//create general info
|
2017-03-18 00:05:04 +01:00
|
|
|
info = "### GENERAL ### \n";
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'Build: '+shy.build+'\n';
|
|
|
|
info += 'Build time: '+shy.time+'\n';
|
|
|
|
info += 'Version: '+shy.version+'\n';
|
|
|
|
info += 'UI Lang: '+storedLang+' (BrowserL: '+navigator.language+')\n';
|
|
|
|
info += 'UI Access: '+storedAccess+'\n';
|
|
|
|
info += 'Log lvl: '+window.serverConfig.logger.level+'\n';
|
|
|
|
info += 'Avail Capt: '+window.serverInfo.grabbers.available+'\n';
|
|
|
|
info += 'Database: '+(shy.readOnlyMode ? "ready-only" : "read/write")+'\n';
|
2020-10-20 20:18:51 +02:00
|
|
|
info += '\n';
|
|
|
|
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'Distribution: '+sys.prettyName+'\n';
|
|
|
|
info += 'Architecture: '+sys.architecture+'\n';
|
2020-10-20 20:18:51 +02:00
|
|
|
|
|
|
|
if (sys.cpuModelName)
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'CPU Model: ' + sys.cpuModelName + '\n';
|
2020-10-20 20:18:51 +02:00
|
|
|
if (sys.cpuModelType)
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'CPU Type: ' + sys.cpuModelType + '\n';
|
2020-10-20 20:18:51 +02:00
|
|
|
if (sys.cpuRevision)
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'CPU Revision: ' + sys.cpuRevision + '\n';
|
2020-10-20 20:18:51 +02:00
|
|
|
if (sys.cpuHardware)
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'CPU Hardware: ' + sys.cpuHardware + '\n';
|
2020-10-20 20:18:51 +02:00
|
|
|
|
2020-11-14 16:34:31 +01:00
|
|
|
info += 'Kernel: ' + sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))' + '\n';
|
|
|
|
info += 'Qt Version: ' + sys.qtVersion + '\n';
|
|
|
|
info += 'Python Version: ' + sys.pyVersion + '\n';
|
|
|
|
info += 'Browser/OS: ' + navigator.userAgent + '\n\n';
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-15 15:53:35 +01:00
|
|
|
//create prios
|
2017-03-18 00:05:04 +01:00
|
|
|
info += "### PRIORITIES ### \n";
|
2017-02-15 15:53:35 +01:00
|
|
|
for(var i = 0; i<prios.length; i++)
|
|
|
|
{
|
|
|
|
info += prios[i].priority;
|
|
|
|
if(prios[i].visible)
|
|
|
|
info += ' VISIBLE!';
|
|
|
|
else
|
|
|
|
info += ' ';
|
|
|
|
info += ' ('+prios[i].component+') Owner: '+prios[i].owner+'\n';
|
|
|
|
}
|
2019-06-05 18:19:08 +02:00
|
|
|
info += '\npriorities_autoselect: '+window.serverInfo.priorities_autoselect+'\n\n';
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-15 15:53:35 +01:00
|
|
|
//create comps
|
2019-06-05 18:19:08 +02:00
|
|
|
info += '### COMPONENTS ### \n';
|
2017-02-15 15:53:35 +01:00
|
|
|
for(var i = 0; i<comps.length; i++)
|
|
|
|
{
|
|
|
|
info += comps[i].enabled+' - '+comps[i].name+'\n';
|
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-03-18 00:05:04 +01:00
|
|
|
//escape data
|
|
|
|
info = JSON.stringify(info);
|
|
|
|
log = JSON.stringify(log);
|
|
|
|
config = JSON.stringify(config);
|
2019-06-05 18:19:08 +02:00
|
|
|
var title = 'Hyperion '+window.currentVersion+' Report ('+window.serverConfig.general.name+' ('+window.serverInfo.ledDevices.active+'))';
|
2017-03-18 00:05:04 +01:00
|
|
|
|
2017-02-15 15:53:35 +01:00
|
|
|
$.ajax({
|
2017-03-18 00:05:04 +01:00
|
|
|
url: 'https://api.hyperion-project.org/report.php',
|
2017-02-15 15:53:35 +01:00
|
|
|
crossDomain: true,
|
|
|
|
contentType: 'application/json',
|
|
|
|
type: 'POST',
|
|
|
|
timeout: 7000,
|
2017-03-18 00:05:04 +01:00
|
|
|
data: '{"title":"'+title+'","info":'+info+',"log":'+log+',"config":'+config+'}'
|
2017-02-15 15:53:35 +01:00
|
|
|
})
|
|
|
|
.done( function( data, textStatus, jqXHR ) {
|
|
|
|
reportUrl += data.id;
|
|
|
|
if(textStatus == "success")
|
|
|
|
{
|
|
|
|
$('#upl_link').html($.i18n('conf_logging_yourlink')+': <a href="'+reportUrl+'" target="_blank">'+reportUrl+'</a>');
|
|
|
|
$("html, body").animate({ scrollTop: 9999 }, "fast");
|
2017-03-18 00:05:04 +01:00
|
|
|
updateLastReports(data.id,data.time,title);
|
2017-02-15 15:53:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('#btn_logupload').attr("disabled", false);
|
|
|
|
$('#upl_link').html('<span style="color:red">'+$.i18n('conf_logging_uplfailed')+'<span>');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.fail( function( jqXHR, textStatus ) {
|
2017-03-18 00:05:04 +01:00
|
|
|
console.log(jqXHR,textStatus);
|
2017-02-28 17:53:41 +01:00
|
|
|
$('#btn_logupload').attr("disabled", false);
|
|
|
|
$('#upl_link').html('<span style="color:red">'+$.i18n('conf_logging_uplfailed')+'<span>');
|
2017-02-15 15:53:35 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
if (!window.loggingHandlerInstalled)
|
2016-11-26 22:46:16 +01:00
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
window.loggingHandlerInstalled = true;
|
|
|
|
$(window.hyperion).on("cmd-logging-update",function(event){
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
if ($("#logmessages").length == 0 && window.loggingStreamActive)
|
2017-09-04 23:12:59 +02:00
|
|
|
{
|
|
|
|
requestLoggingStop();
|
2019-06-05 18:19:08 +02:00
|
|
|
window.loggingStreamActive = false;
|
2017-09-04 23:12:59 +02:00
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
messages = (event.response.result.messages);
|
|
|
|
if(messages.length != 0 && !createdCont)
|
2016-11-26 22:46:16 +01:00
|
|
|
{
|
2020-04-05 20:08:56 +02:00
|
|
|
$('#log_content').html('<pre><div id="logmessages" style="overflow:scroll;max-height:400px"></div></pre><button class="btn btn-primary" id="btn_autoscroll"><i class="fa fa-long-arrow-down fa-fw"></i>'+$.i18n('conf_logging_btn_autoscroll')+'</button>');
|
2017-02-08 14:36:28 +01:00
|
|
|
createdCont = true;
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
$('#btn_autoscroll').off().on('click',function() {
|
|
|
|
toggleClass('#btn_autoscroll', "btn-success", "btn-danger");
|
|
|
|
});
|
2016-11-26 22:46:16 +01:00
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
|
|
|
for(var idx = 0; idx < messages.length; idx++)
|
2016-11-26 22:46:16 +01:00
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
var app_name = messages[idx].appName;
|
|
|
|
var logger_name = messages[idx].loggerName;
|
|
|
|
var function_ = messages[idx].function;
|
|
|
|
var line = messages[idx].line;
|
|
|
|
var file_name = messages[idx].fileName;
|
|
|
|
var msg = messages[idx].message;
|
|
|
|
var level_string = messages[idx].levelString;
|
2020-07-27 20:00:36 +02:00
|
|
|
var utime = messages[idx].utime;
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
var debug = "";
|
|
|
|
if(level_string == "DEBUG") {
|
2017-07-30 14:36:23 +02:00
|
|
|
debug = "("+file_name+":"+line+":"+function_+"()) ";
|
2016-12-04 19:32:23 +01:00
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
|
|
|
var date = new Date(parseInt(utime));
|
|
|
|
|
|
|
|
$("#logmessages").append("\n <code>"+date.toISOString()+" ["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+"</code>");
|
2017-07-30 14:36:23 +02:00
|
|
|
loguplmess += "["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+"\n";
|
2017-02-08 14:36:28 +01:00
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
|
|
|
if($("#btn_autoscroll").hasClass('btn-success'))
|
|
|
|
{
|
2017-02-08 14:36:28 +01:00
|
|
|
$('#logmessages').stop().animate({
|
|
|
|
scrollTop: $('#logmessages')[0].scrollHeight
|
|
|
|
}, 800);
|
2016-11-26 22:46:16 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-07-27 20:00:36 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
removeOverlay();
|
2016-11-26 22:46:16 +01:00
|
|
|
});
|