mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Fix logger and led colors (#906)
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
var conf_editor = null;
|
||||
var createdCont = false;
|
||||
performTranslation();
|
||||
requestLoggingStart();
|
||||
var conf_editor = null;
|
||||
var createdCont = false;
|
||||
|
||||
performTranslation();
|
||||
requestLoggingStart();
|
||||
|
||||
$(document).ready(function() {
|
||||
var messages;
|
||||
var loguplmess = "";
|
||||
var reportUrl = 'https://report.hyperion-project.org/#';
|
||||
|
||||
|
||||
$('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit'));
|
||||
if(window.showOptHelp)
|
||||
{
|
||||
@@ -15,15 +16,15 @@ $(document).ready(function() {
|
||||
createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head");
|
||||
}
|
||||
$("#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")));
|
||||
|
||||
|
||||
conf_editor = createJsonEditor('editor_container', {
|
||||
logger : window.schema.logger
|
||||
}, true, true);
|
||||
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
requestWriteConfig(conf_editor.getValue());
|
||||
});
|
||||
@@ -33,7 +34,7 @@ $(document).ready(function() {
|
||||
$(this).attr("disabled", true);
|
||||
$('#upl_link').html($.i18n('conf_logging_uploading'))
|
||||
});
|
||||
|
||||
|
||||
//show prev uploads
|
||||
var ent;
|
||||
|
||||
@@ -48,7 +49,7 @@ $(document).ready(function() {
|
||||
}
|
||||
else
|
||||
ent = [];
|
||||
|
||||
|
||||
function updateLastReports(id,time,title)
|
||||
{
|
||||
if(ent.length > 4)
|
||||
@@ -56,7 +57,7 @@ $(document).ready(function() {
|
||||
ent.unshift({"id": id ,"time": time,"title": title})
|
||||
setStorage("prev_reports",JSON.stringify(ent));
|
||||
}
|
||||
|
||||
|
||||
function uploadLog()
|
||||
{
|
||||
var log = "";
|
||||
@@ -66,7 +67,7 @@ $(document).ready(function() {
|
||||
var sys = window.sysInfo.system;
|
||||
var shy = window.sysInfo.hyperion;
|
||||
var info;
|
||||
|
||||
|
||||
//create log
|
||||
log = (messages ? loguplmess : "Log was empty!");
|
||||
|
||||
@@ -83,7 +84,7 @@ $(document).ready(function() {
|
||||
info += 'Arch: '+sys.architecture+'\n';
|
||||
info += 'Kernel: '+sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))\n';
|
||||
info += 'Browser/OS: '+navigator.userAgent+'\n\n';
|
||||
|
||||
|
||||
//create prios
|
||||
info += "### PRIORITIES ### \n";
|
||||
for(var i = 0; i<prios.length; i++)
|
||||
@@ -96,14 +97,14 @@ $(document).ready(function() {
|
||||
info += ' ('+prios[i].component+') Owner: '+prios[i].owner+'\n';
|
||||
}
|
||||
info += '\npriorities_autoselect: '+window.serverInfo.priorities_autoselect+'\n\n';
|
||||
|
||||
|
||||
//create comps
|
||||
info += '### COMPONENTS ### \n';
|
||||
for(var i = 0; i<comps.length; i++)
|
||||
{
|
||||
info += comps[i].enabled+' - '+comps[i].name+'\n';
|
||||
}
|
||||
|
||||
|
||||
//escape data
|
||||
info = JSON.stringify(info);
|
||||
log = JSON.stringify(log);
|
||||
@@ -143,24 +144,25 @@ $(document).ready(function() {
|
||||
{
|
||||
window.loggingHandlerInstalled = true;
|
||||
$(window.hyperion).on("cmd-logging-update",function(event){
|
||||
|
||||
|
||||
if ($("#logmessages").length == 0 && window.loggingStreamActive)
|
||||
{
|
||||
requestLoggingStop();
|
||||
window.loggingStreamActive = false;
|
||||
}
|
||||
|
||||
|
||||
messages = (event.response.result.messages);
|
||||
if(messages.length != 0 && !createdCont)
|
||||
{
|
||||
$('#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>');
|
||||
createdCont = true;
|
||||
|
||||
|
||||
$('#btn_autoscroll').off().on('click',function() {
|
||||
toggleClass('#btn_autoscroll', "btn-success", "btn-danger");
|
||||
});
|
||||
}
|
||||
for(var idx=0; idx<messages.length; idx++)
|
||||
|
||||
for(var idx = 0; idx < messages.length; idx++)
|
||||
{
|
||||
var app_name = messages[idx].appName;
|
||||
var logger_name = messages[idx].loggerName;
|
||||
@@ -169,23 +171,27 @@ $(document).ready(function() {
|
||||
var file_name = messages[idx].fileName;
|
||||
var msg = messages[idx].message;
|
||||
var level_string = messages[idx].levelString;
|
||||
|
||||
var utime = messages[idx].utime;
|
||||
|
||||
var debug = "";
|
||||
|
||||
if(level_string == "DEBUG") {
|
||||
debug = "("+file_name+":"+line+":"+function_+"()) ";
|
||||
}
|
||||
|
||||
$("#logmessages").append("\n <code>"+"["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+"</code>");
|
||||
|
||||
var date = new Date(parseInt(utime));
|
||||
|
||||
$("#logmessages").append("\n <code>"+date.toISOString()+" ["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+"</code>");
|
||||
loguplmess += "["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+"\n";
|
||||
}
|
||||
if($("#btn_autoscroll").hasClass('btn-success')){
|
||||
|
||||
if($("#btn_autoscroll").hasClass('btn-success'))
|
||||
{
|
||||
$('#logmessages').stop().animate({
|
||||
scrollTop: $('#logmessages')[0].scrollHeight
|
||||
}, 800);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
removeOverlay();
|
||||
});
|
||||
|
Reference in New Issue
Block a user