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:
brindosch
2017-02-15 15:53:35 +01:00
committed by redPanther
parent 37b8a909b6
commit 7c336b0511
17 changed files with 887 additions and 260 deletions

View File

@@ -4,6 +4,7 @@ $(document).ready( function() {
var effectName = "";
var effects_editor = null;
var effectPy = "";
var testrun;
if(showOptHelp)
createHintH("intro", $.i18n('effectsconfigurator_label_intro'), "intro_effc");
@@ -27,6 +28,7 @@ $(document).ready( function() {
}
function triggerTestEffect() {
testrun = true;
var args = effects_editor.getEditor('root.args');
requestTestEffect(effectName, ":/effects/" + effectPy.slice(1), JSON.stringify(args.getValue()));
};
@@ -79,6 +81,9 @@ $(document).ready( function() {
showInfoDialog('success', "", $.i18n('infoDialog_effconf_created_text', effectName));
});
if (testrun)
setTimeout(requestPriorityClear,100);
});
$('#btn_start_test').off().on('click',function() {
@@ -87,6 +92,7 @@ $(document).ready( function() {
$('#btn_stop_test').off().on('click',function() {
requestPriorityClear();
testrun = false;
});
$('#btn_cont_test').off().on('click',function() {

View File

@@ -1,9 +1,6 @@
var ledsCustomCfgInitialized = false;
var finalLedArray = [];
var IntListIds;
var StrListIds;
var BoolListIds;
function validateText(){
e = isJsonString($("#ledconfig").val());
@@ -15,53 +12,6 @@ function validateText(){
return true
}
function loadStoredValues()
{
if (storageComp() && getStorage('ip_cl_ledstop') != null)
{
for(var i = 0; i < IntListIds.length; i++)
{
$('#'+IntListIds[i]).val(parseInt(getStorage(IntListIds[i])));
}
for(var i = 0; i < BoolListIds.length; i++)
{
var vb = getStorage(BoolListIds[i]);
$('#'+BoolListIds[i]).prop('checked', vb == "true" ? true : false);
}
for(var i = 0; i < StrListIds.length; i++)
{
$('#'+StrListIds[i]).val(getStorage(StrListIds[i]));
}
return;
}
return;
}
function saveValues()
{
if(storageComp())
{
for(var i = 0; i < IntListIds.length; i++)
{
setStorage(IntListIds[i], $('#'+IntListIds[i]).val());
}
for(var i = 0; i < BoolListIds.length; i++)
{
setStorage(BoolListIds[i], $('#'+BoolListIds[i]).is(":checked"));
}
for(var i = 0; i < StrListIds.length; i++)
{
setStorage(StrListIds[i], $('#'+StrListIds[i]).val());
}
return;
}
}
function round(number) {
var factor = Math.pow(10, 4);
var tempNumber = number * factor;
@@ -115,20 +65,20 @@ function createLedPreview(leds, origin){
function createClassicLeds(){
//get values
var ledstop = parseInt($("#ip_cl_ledstop").val());
var ledsbottom = parseInt($("#ip_cl_ledsbottom").val());
var ledsleft = parseInt($("#ip_cl_ledsleft").val());
var ledsright = parseInt($("#ip_cl_ledsright").val());
var ledsglength = parseInt($("#ip_cl_ledsglength").val());
var ledsgpos = parseInt($("#ip_cl_ledsgpos").val());
var ledstop = parseInt($("#ip_cl_top").val());
var ledsbottom = parseInt($("#ip_cl_bottom").val());
var ledsleft = parseInt($("#ip_cl_left").val());
var ledsright = parseInt($("#ip_cl_right").val());
var ledsglength = parseInt($("#ip_cl_glength").val());
var ledsgpos = parseInt($("#ip_cl_gpos").val());
var position = parseInt($("#ip_cl_position").val());
var reverse = $("#ip_cl_reverse").is(":checked");
//advanced values
var ledsVDepth = parseInt($("#ip_cl_ledsvdepth").val())/100;
var ledsHDepth = parseInt($("#ip_cl_ledshdepth").val())/100;
var edgeVGap = parseInt($("#ip_cl_ledsedgegap").val())/100/2;
//var cornerVGap = parseInt($("#ip_cl_ledscornergap").val())/100/2;
var ledsVDepth = parseInt($("#ip_cl_vdepth").val())/100;
var ledsHDepth = parseInt($("#ip_cl_hdepth").val())/100;
var edgeVGap = parseInt($("#ip_cl_edgegap").val())/100/2;
//var cornerVGap = parseInt($("#ip_cl_cornergap").val())/100/2;
var overlap = $("#ip_cl_overlap").val()/4000;
//helper
@@ -373,13 +323,31 @@ $(document).ready(function() {
$('#led_vis_help').html('<div><div class="led_ex" style="background-color:black;margin-right:5px;margin-top:3px"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l1')+'</div></div><div class="led_ex" style="background-color:grey;margin-top:3px;margin-right:2px"></div><div class="led_ex" style="background-color: rgb(169, 169, 169);margin-right:5px;margin-top:3px;"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l2')+'</div>');
}
//gather ids
IntListIds = $('.led_val_int').map(function() { return this.id; }).get();
StrListIds = $('.led_val_string').map(function() { return this.id; }).get();
BoolListIds = $('.led_val_bool').map(function() { return this.id; }).get();
var slConfig = serverConfig.ledConfig;
// restore values from storage
loadStoredValues();
//restore ledConfig
for(key in slConfig)
{
if(typeof(slConfig[key]) === "boolean")
$('#ip_cl_'+key).prop('checked', slConfig[key]);
else
$('#ip_cl_'+key).val(slConfig[key]);
}
function saveValues()
{
var ledConfig = {};
for(key in slConfig)
{
if(typeof(slConfig[key]) === "boolean")
ledConfig[key] = $('#ip_cl_'+key).is(':checked');
else if(Number.isInteger(slConfig[key]))
ledConfig[key] = parseInt($('#ip_cl_'+key).val());
else
ledConfig[key] = $('#ip_cl_'+key).val();
}
setTimeout(requestWriteConfig, 100, {ledConfig});
}
// check access level and adjust ui
if(storedAccess == "default")
@@ -410,7 +378,6 @@ $(document).ready(function() {
$("#ledconfig").text(JSON.stringify(finalLedArray, null, "\t"));
$('#collapse1').collapse('hide');
$('#collapse4').collapse('show');
saveValues();
}
});
@@ -420,7 +387,6 @@ $(document).ready(function() {
$("#ledconfig").text(JSON.stringify(finalLedArray, null, "\t"));
$('#collapse2').collapse('hide');
$('#collapse4').collapse('show');
saveValues();
}
});
@@ -518,7 +484,10 @@ $(document).ready(function() {
// validate and save led config from textfield
$("#leds_custom_save").off().on("click", function() {
if (validateText())
{
requestWriteConfig(JSON.parse('{"leds" :'+$("#ledconfig").val()+'}'));
saveValues();
}
});
// toggle led numbers

View File

@@ -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++)
{

View File

@@ -41,9 +41,18 @@ $(document).ready(function() {
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), '['+rgb.r+','+rgb.g+','+rgb.b+']');
});
}
else if(sColor[key].type == "boolean")
{
property = '<div class="checkbox"><input id="cr_'+sColor[key].key+'" type="checkbox" value="'+value+'"/><label></label></div>';
$('.crtbody').append(createTableRow([title, property], false, true));
$('#cr_'+sColor[key].key).off().on('change', function(e){
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.checked);
});
}
else
{
if(sColor[key].key == "brightness" || sColor[key].key == "brightnessMin")
if(sColor[key].key == "brightness" || sColor[key].key == "backlightThreshold")
property = '<input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0.0" max="1.0" step="0.05" value="'+value+'"/>';
else
property = '<input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0.0" max="4.0" step="0.1" value="'+value+'"/>';

View File

@@ -175,7 +175,7 @@ $(document).ready( function() {
var picnr = 0;
var availVideos = ["Sweet_Cocoon","Caminandes_2_GranDillama","Caminandes_3_Llamigos"];
if(getStorage("kodiAddress" != null))
if(getStorage("kodiAddress") != null)
kodiAddress = getStorage("kodiAddress");
function switchPicture(pictures)
@@ -208,9 +208,9 @@ $(document).ready( function() {
$.ajax({
url: 'http://' + kodiAddress + '/jsonrpc',
dataType: 'jsonp',
crossDomain: true,
jsonpCallback: 'jsonCallback',
type: 'POST',
async: true,
timeout: 2000,
data: 'request=' + encodeURIComponent( command )
})
@@ -347,8 +347,8 @@ $(document).ready( function() {
}
if(step == 10)
{
updateWEditor(["backlightThreshold"]);
h = $.i18n('wiz_cc_minBright');
updateWEditor(["backlightThreshold","backlightColored"]);
h = $.i18n('wiz_cc_backlight');
if(withKodi)
{
h += '<br/>'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_black_title'));
@@ -632,5 +632,4 @@ $(document).ready( function() {
}
$('#btn_wizard_philipshue').off().on('click',startWizardPhilipsHue);
});