mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
ledConfig in config, report creation and upload (#398)
* update effects * fix * try * . * Update clock.py * Update clock.py * upd * impl ledConfig * upd * fix * update * update js * fix pacman * change order of priorities
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var messages;
|
||||
|
||||
$('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit'));
|
||||
if(showOptHelp)
|
||||
{
|
||||
@@ -24,6 +26,80 @@ $(document).ready(function() {
|
||||
requestWriteConfig(conf_editor.getValue());
|
||||
});
|
||||
|
||||
function uploadLog()
|
||||
{
|
||||
var reportUrl = 'https://glot.io/snippets/';
|
||||
var log = "";
|
||||
var config = JSON.stringify(serverConfig, null, "\t").replace(/"/g, '\\"');
|
||||
var prios = serverInfo.info.priorities;
|
||||
var comps = serverInfo.info.components;
|
||||
|
||||
//create log
|
||||
for(var i = 0; i<messages.length; i++)
|
||||
{
|
||||
app_name = messages[i].appName;
|
||||
logger_name = messages[i].loggerName;
|
||||
function_ = messages[i].function;
|
||||
line = messages[i].line;
|
||||
file_name = messages[i].fileName;
|
||||
msg = messages[i].message;
|
||||
level_string = messages[i].levelString;
|
||||
debug = "";
|
||||
|
||||
if(level_string == "DEBUG") {
|
||||
debug = "<"+file_name+":"+line+":"+function_+"()> ";
|
||||
}
|
||||
|
||||
log += "["+app_name+" "+logger_name+"] <"+level_string+"> "+debug+msg+"\n";
|
||||
}
|
||||
|
||||
//create prios
|
||||
var info = "######## PRIORITIES ######## \n";
|
||||
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';
|
||||
}
|
||||
info += '\npriorities_autoselect: '+serverInfo.info.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';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: 'https://snippets.glot.io/snippets',
|
||||
// headers: { "Authorization": "Token 9ed92d37-36ca-4430-858f-47b6a3d4d535", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET,HEAD,OPTIONS,POST,PUT", "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization" },
|
||||
crossDomain: true,
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
timeout: 7000,
|
||||
data: '{"language":"plaintext","title":"Hyperion '+currentVersion+' Report ('+serverConfig.general.name+' ('+serverInfo.info.ledDevices.active+'))","public":false,"files":[{"name":"Info","content":"'+info+'"},{"name":"Hyperion Log","content":"'+log+'"},{"name":"Hyperion Config","content":"'+config+'"}]}'
|
||||
})
|
||||
.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");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#btn_logupload').attr("disabled", false);
|
||||
$('#upl_link').html('<span style="color:red">'+$.i18n('conf_logging_uplfailed')+'<span>');
|
||||
}
|
||||
})
|
||||
.fail( function( jqXHR, textStatus ) {
|
||||
//console.log(jqXHR, textStatus)
|
||||
});
|
||||
}
|
||||
|
||||
if (!loggingHandlerInstalled)
|
||||
{
|
||||
loggingHandlerInstalled = true;
|
||||
@@ -31,12 +107,17 @@ $(document).ready(function() {
|
||||
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_pbupload">'+$.i18n('conf_logging_btn_pbupload')+'</button><button class="btn btn-success" id="btn_autoscroll" style="margin-left:10px;">'+$.i18n('conf_logging_btn_autoscroll')+'</button>');
|
||||
$('#log_content').html('<pre><div id="logmessages" style="overflow:scroll;max-height:400px"></div></pre><button class="btn btn-primary" id="btn_logupload">'+$.i18n('conf_logging_btn_pbupload')+'</button><button class="btn btn-success" id="btn_autoscroll" style="margin-left:10px;">'+$.i18n('conf_logging_btn_autoscroll')+'</button><div id="upl_link" style="margin-top:10px;font-weight:bold;"></div>');
|
||||
createdCont = true;
|
||||
|
||||
$('#btn_autoscroll').off().on('click',function() {
|
||||
toggleClass('#btn_autoscroll', "btn-success", "btn-danger");
|
||||
});
|
||||
$('#btn_logupload').off().on('click',function() {
|
||||
uploadLog();
|
||||
$(this).attr("disabled", true);
|
||||
$('#upl_link').html($.i18n('conf_logging_uploading'))
|
||||
});
|
||||
}
|
||||
for(var idx=0; idx<messages.length; idx++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user