diff --git a/assets/webconfig/content/about.html b/assets/webconfig/content/about.html index 665dbc4b..a293b203 100644 --- a/assets/webconfig/content/about.html +++ b/assets/webconfig/content/about.html @@ -31,39 +31,9 @@ libh += "
" + $.i18n("about_credits"); lang = lang.toString().replace(/,/g, ", "); - // Github Issue bugreport infos - var sys = window.sysInfo.system; - var shy = window.sysInfo.hyperion; - var info = "
Hyperion Server: \n";
-	info += '- Build:           ' + shy.build + '\n';
-	info += '- Build time:      ' + shy.time + '\n';
-	info += '- Git Remote:      ' + shy.gitremote + '\n';
-	info += '- Version:         ' + shy.version + '\n';
-	info += '- UI Lang:         ' + storedLang + ' (BrowserLang: ' + 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';
-
-	info += '\n';
-
-	info += 'Hyperion Server OS: \n';
-	info += '- Distribution:   ' + sys.prettyName + '\n';
-	info += '- Architecture:   ' + sys.architecture + '\n';
-
-	if (sys.cpuModelName)
-	  info += '- CPU Model:      ' + sys.cpuModelName + '\n';
-	if (sys.cpuModelType)
-	  info += '- CPU Type:       ' + sys.cpuModelType + '\n';
-	if (sys.cpuRevision)
-	  info += '- CPU Revision:   ' + sys.cpuRevision + '\n';
-	if (sys.cpuHardware)
-	  info += '- CPU Hardware:   ' + sys.cpuHardware + '\n';	
-
-	info += '- Kernel:         ' + sys.kernelType + ' (' + sys.kernelVersion + ' (WS: ' + sys.wordSize + '))\n';
-	info += '- Qt Version:     ' + sys.qtVersion + '\n';
-	info += '- Python Version: ' + sys.pyVersion + '\n';	
-	info += '- Browser:        ' + navigator.userAgent + ' 
'; + // Github Issue bugreport infos + var sysInfo = getSystemInfo(); + var info = '
' + sysInfo + '
'; var fc = ['' + $.i18n("about_version") + '', $.i18n("about_build"), $.i18n("about_builddate"), $.i18n("about_translations"), $.i18n("about_resources", $.i18n("general_webui_title")), "System info (Github Issue)", $.i18n("about_3rd_party_licenses")]; var sc = [currentVersion, si.build, si.time, '(' + availLang.length + ')

' + lang + '

' + $.i18n("about_contribute") + '

', libh, info, '
']; diff --git a/assets/webconfig/content/conf_logging.html b/assets/webconfig/content/conf_logging.html index a9995b2f..768f9908 100644 --- a/assets/webconfig/content/conf_logging.html +++ b/assets/webconfig/content/conf_logging.html @@ -1,21 +1,22 @@
-
-
- -
-
-
-
-
-
-

Bericht

- -
- -
-
-
-
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index 20beaeb8..be7abeb6 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -125,6 +125,7 @@ "conf_logging_label_intro": "Area to check log messages, you will see more or less information depending on the logging level set.", "conf_logging_lastreports": "Previous reports", "conf_logging_nomessage": "No log messages available.", + "conf_logging_logoutput": "Log output", "conf_logging_report": "Report", "conf_logging_uplfailed": "Upload failed! Please check your internet connection!", "conf_logging_uploading": "Prepare data...", diff --git a/assets/webconfig/js/content_index.js b/assets/webconfig/js/content_index.js index c2263509..ff44d7fc 100755 --- a/assets/webconfig/js/content_index.js +++ b/assets/webconfig/js/content_index.js @@ -24,8 +24,6 @@ $(document).ready(function () { $(window.hyperion).on("cmd-serverinfo", function (event) { window.serverInfo = event.response.info; - window.readOnlyMode = window.sysInfo.hyperion.readOnlyMode; - // comps window.comps = event.response.info.components @@ -123,6 +121,7 @@ $(document).ready(function () { window.currentVersion = window.sysInfo.hyperion.version; window.currentChannel = window.sysInfo.hyperion.channel; + window.readOnlyMode = window.sysInfo.hyperion.readOnlyMode; }); $(window.hyperion).one("cmd-config-getschema", function (event) { @@ -340,7 +339,6 @@ $("#btn_darkmode").off().on("click", function (e) { setStorage("darkModeOverwrite", true, true); location.reload(); } - }); // Menuitem toggle; diff --git a/assets/webconfig/js/content_logging.js b/assets/webconfig/js/content_logging.js index 8ace208d..901afaa1 100644 --- a/assets/webconfig/js/content_logging.js +++ b/assets/webconfig/js/content_logging.js @@ -1,212 +1,192 @@ var conf_editor = null; var createdCont = false; +var isScroll = true; performTranslation(); +requestLoggingStop(); requestLoggingStart(); -$(document).ready(function() { - var messages; - var loguplmess = ""; - var reportUrl = 'https://report.hyperion-project.org/#'; +$(document).ready(function () { - $('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit')); - if(window.showOptHelp) - { - $('#conf_cont').append(createHelpTable(window.schema.logger.properties, $.i18n("edt_conf_log_heading_title"))); - createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head"); - } - $("#log_upl_pol").append(''+$.i18n("conf_logging_uplpolicy")+' '+buildWL("user/support#report_privacy_policy",$.i18n("conf_logging_contpolicy"))); + $('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit')); + if (window.showOptHelp) { + $('#conf_cont').append(createHelpTable(window.schema.logger.properties, $.i18n("edt_conf_log_heading_title"))); + createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head"); + } - conf_editor = createJsonEditor('editor_container', { - logger : window.schema.logger - }, true, true); + conf_editor = createJsonEditor('editor_container', { + logger: window.schema.logger + }, true, true); - conf_editor.on('change',function() { - conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false); - }); + conf_editor.on('change', function () { + conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false); + }); - $('#btn_submit').off().on('click',function() { - requestWriteConfig(conf_editor.getValue()); - }); + $('#btn_submit').off().on('click', function () { - $('#btn_logupload').off().on('click',function() { - uploadLog(); - $(this).attr("disabled", true); - $('#upl_link').html($.i18n('conf_logging_uploading')) - }); + var displayedLogLevel = conf_editor.getEditor("root.logger.level").getValue(); + var newLogLevel = {logger:{}}; + newLogLevel.logger.level = displayedLogLevel; - //show prev uploads - var ent; + requestWriteConfig(newLogLevel); + }); - if(getStorage("prev_reports")) - { - ent = JSON.parse(getStorage("prev_reports")); - $('#prev_reports').append('

'+$.i18n('conf_logging_lastreports')+'

'); - for(var i = 0; i'+ent[i].title+'('+ent[i].time+')

'); - } - } - else - ent = []; + function infoSummary() { + var info = ""; - 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)); - } + info += 'Hyperion System Summary Report (' + window.serverConfig.general.name + '), Reported instance: ' + window.currentHyperionInstanceName + '\n'; - function uploadLog() - { - var log = ""; - 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; - var info; + info += "\n< ----- System information -------------------- >\n"; + info += getSystemInfo() + '\n'; - //create log - log = (messages ? loguplmess : "Log was empty!"); + info += "\n< ----- Configured Instances ------------------ >\n"; + var instances = window.serverInfo.instance; + for (var i = 0; i < instances.length; i++) { + info += instances[i].instance + ': ' + instances[i].friendly_name + ' Running: ' + instances[i].running + '\n'; + } - //create general info - info = "### GENERAL ### \n"; - 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'; - info += '\n'; + info += "\n< ----- This instance's priorities ------------ >\n"; + var prios = window.serverInfo.priorities; + for (var i = 0; i < prios.length; i++) { + info += prios[i].priority + ': '; + if (prios[i].visible) { + info += ' VISIBLE!'; + } + else { + info += ' '; + } + info += ' (' + prios[i].componentId + ') Owner: ' + prios[i].owner + '\n'; + } + info += 'priorities_autoselect: ' + window.serverInfo.priorities_autoselect + '\n'; - info += 'Distribution: '+sys.prettyName+'\n'; - info += 'Architecture: '+sys.architecture+'\n'; + info += "\n< ----- This instance components' status ------->\n"; + var comps = window.serverInfo.components; + for (var i = 0; i < comps.length; i++) { + info += comps[i].name + ' - ' + comps[i].enabled + '\n'; + } - if (sys.cpuModelName) - info += 'CPU Model: ' + sys.cpuModelName + '\n'; - if (sys.cpuModelType) - info += 'CPU Type: ' + sys.cpuModelType + '\n'; - if (sys.cpuRevision) - info += 'CPU Revision: ' + sys.cpuRevision + '\n'; - if (sys.cpuHardware) - info += 'CPU Hardware: ' + sys.cpuHardware + '\n'; + info += "\n< ----- This instance's configuration --------- >\n"; + info += JSON.stringify(window.serverConfig) + '\n'; - 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'; + info += "\n< ----- Current Log --------------------------- >\n"; + var logMsgs = document.getElementById("logmessages").textContent; + if (logMsgs.length !== 0) { + info += logMsgs; + } else { + info += "Log is empty!"; + } - //create prios - info += "### PRIORITIES ### \n"; - for(var i = 0; i'+reportUrl+''); - $("html, body").animate({ scrollTop: 9999 }, "fast"); - updateLastReports(data.id,data.time,title); - } - else - { - $('#btn_logupload').attr("disabled", false); - $('#upl_link').html(''+$.i18n('conf_logging_uplfailed')+''); - } - }) - .fail( function( jqXHR, textStatus ) { - console.log(jqXHR,textStatus); - $('#btn_logupload').attr("disabled", false); - $('#upl_link').html(''+$.i18n('conf_logging_uplfailed')+''); - }); - } + $('#log_content').html('
'); + $('#log_footer').append('' + ); - if (!window.loggingHandlerInstalled) - { - window.loggingHandlerInstalled = true; - $(window.hyperion).on("cmd-logging-update",function(event){ + $(`#btn_scroll`).bootstrapToggle(); + $(`#btn_scroll`).change(e => { + if (e.currentTarget.checked) { + //Scroll to end of log + isScroll = true; + if ($("#logmessages").length > 0) { + $('#logmessages')[0].scrollTop = $('#logmessages')[0].scrollHeight; + } + } else { + isScroll = false; + } + }); - if ($("#logmessages").length == 0 && window.loggingStreamActive) - { - requestLoggingStop(); - window.loggingStreamActive = false; - } + $('#log_footer').append(''); - messages = (event.response.result.messages); - if(messages.length != 0 && !createdCont) - { - $('#log_content').html('
'); - createdCont = true; + $('#btn_clipboard').off().on('click', function () { + const temp = document.createElement('textarea'); + temp.textContent = infoSummary(); + document.body.append(temp); + temp.select(); + document.execCommand("copy"); + temp.remove(); + }); + } - $('#btn_autoscroll').off().on('click',function() { - toggleClass('#btn_autoscroll', "btn-success", "btn-danger"); - }); - } + function updateLogOutput(messages) { - for(var idx = 0; idx < messages.length; idx++) - { - 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; - var utime = messages[idx].utime; + if (messages.length != 0) { - var debug = ""; - if(level_string == "DEBUG") { - debug = "("+file_name+":"+line+":"+function_+"()) "; - } + for (var idx = 0; idx < messages.length; idx++) { + 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; + var utime = messages[idx].utime; - var date = new Date(parseInt(utime)); + var debug = ""; + if (level_string == "DEBUG") { + debug = "(" + file_name + ":" + line + ":" + function_ + "()) "; + } - $("#logmessages").append("\n "+date.toISOString()+" ["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+""); - loguplmess += "["+app_name+" "+logger_name+"] ("+level_string+") "+debug+msg+"\n"; - } + var date = new Date(parseInt(utime)); + var newLogLine = date.toISOString() + " [" + app_name + " " + logger_name + "] (" + level_string + ") " + debug + msg; - if($("#btn_autoscroll").hasClass('btn-success')) - { - $('#logmessages').stop().animate({ - scrollTop: $('#logmessages')[0].scrollHeight - }, 800); - } - }); - } + $("#logmessages").append("" + newLogLine + "\n"); + } - removeOverlay(); + if (isScroll && $("#logmessages").length > 0) { + $('#logmessages').stop().animate({ + scrollTop: $('#logmessages')[0].scrollHeight + }, 800); + } + } + } + + if (!window.loggingHandlerInstalled) { + window.loggingHandlerInstalled = true; + + $(window.hyperion).on("cmd-logging-update", function (event) { + + messages = (event.response.result.messages); + + if (messages.length != 0) { + if (!createdCont) { + createLogContainer(); + createdCont = true; + } + + var currentlogLevel = window.serverConfig.logger.level; + + updateLogOutput(messages) + } + }); + } + + $(window.hyperion).on("cmd-settings-update", function (event) { + + var obj = event.response.data + if (obj.logger) { + Object.getOwnPropertyNames(obj).forEach(function (val, idx, array) { + window.serverConfig[val] = obj[val]; + }); + + var currentlogLevel = window.serverConfig.logger.level; + var displayedLogLevel = conf_editor.getEditor("root.logger.level").getValue(); + + //if ( currentlogLevel !== displayedLogLevel ) + { + conf_editor.getEditor("root.logger.level").setValue(currentlogLevel); + location.reload(); + } + } + + }); + + removeOverlay(); }); diff --git a/assets/webconfig/js/content_remote.js b/assets/webconfig/js/content_remote.js index f6898fa1..c8e07602 100644 --- a/assets/webconfig/js/content_remote.js +++ b/assets/webconfig/js/content_remote.js @@ -1,13 +1,13 @@ -$(document).ready(function() { +$(document).ready(function () { performTranslation(); var oldEffects = []; var cpcolor = '#B500FF'; var mappingList = window.serverSchema.properties.color.properties.imageToLedMappingType.enum; var duration = 0; - var rgb = {r:255,g:0,b:0}; + var rgb = { r: 255, g: 0, b: 0 }; var lastImgData = ""; - var lastFileName= ""; + var lastFileName = ""; //create html createTable('ssthead', 'sstbody', 'sstcont'); @@ -16,8 +16,7 @@ $(document).ready(function() { //create introduction - if(window.showOptHelp) - { + if (window.showOptHelp) { createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro"); createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont"); createHint("intro", $.i18n('remote_adjustment_intro', $.i18n('remote_losthint')), "adjust_content"); @@ -30,83 +29,73 @@ $(document).ready(function() { var sColor = sortProperties(window.serverSchema.properties.color.properties.channelAdjustment.items.properties); var values = window.serverInfo.adjustment[0]; - for(var key in sColor) - { - if(sColor[key].key != "id" && sColor[key].key != "leds") - { - var title = ''; + for (var key in sColor) { + if (sColor[key].key != "id" && sColor[key].key != "leds") { + var title = ''; var property; var value = values[sColor[key].key]; - if(sColor[key].type == "array") - { - property = '
'; + if (sColor[key].type == "array") { + property = '
'; $('.crtbody').append(createTableRow([title, property], false, true)); - createCP('cr_'+sColor[key].key, value, function(rgb,hex,e){ - requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), '['+rgb.r+','+rgb.g+','+rgb.b+']'); + createCP('cr_' + sColor[key].key, value, function (rgb, hex, e) { + requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), '[' + rgb.r + ',' + rgb.g + ',' + rgb.b + ']'); }); } - else if(sColor[key].type == "boolean") - { - property = '
'; + else if (sColor[key].type == "boolean") { + property = '
'; $('.crtbody').append(createTableRow([title, property], false, true)); - $('#cr_'+sColor[key].key).off().on('change', function(e){ + $('#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 == "brightnessCompensation" || sColor[key].key == "backlightThreshold") - property = '
'+$.i18n("edt_append_percent")+'
'; + else { + if (sColor[key].key == "brightness" || sColor[key].key == "brightnessCompensation" || sColor[key].key == "backlightThreshold") + property = '
' + $.i18n("edt_append_percent") + '
'; else - property = ''; + property = ''; $('.crtbody').append(createTableRow([title, property], false, true)); - $('#cr_'+sColor[key].key).off().on('change', function(e){ - valValue(this.id,this.value,this.min,this.max); + $('#cr_' + sColor[key].key).off().on('change', function (e) { + valValue(this.id, this.value, this.min, this.max); requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.value); }); } } } - function sendEffect() - { + function sendEffect() { var efx = $("#effect_select").val(); - if(efx != "__none__") - { + if (efx != "__none__") { requestPriorityClear(); - $(window.hyperion).one("cmd-clear", function(event) { - setTimeout(function() {requestPlayEffect(efx,duration)}, 100); + $(window.hyperion).one("cmd-clear", function (event) { + setTimeout(function () { requestPlayEffect(efx, duration) }, 100); }); } } - function sendColor() - { - requestSetColor(rgb.r, rgb.g, rgb.b,duration); + function sendColor() { + requestSetColor(rgb.r, rgb.g, rgb.b, duration); } - function updateInputSelect() - { + function updateInputSelect() { $('.sstbody').html(""); var prios = window.serverInfo.priorities; var clearAll = false; - for(var i = 0; i < prios.length; i++) - { - var origin = prios[i].origin ? prios[i].origin : "System"; + for (var i = 0; i < prios.length; i++) { + var origin = prios[i].origin ? prios[i].origin : "System"; origin = origin.split("@"); var ip = origin[1]; origin = origin[0]; - var owner = prios[i].owner; - var active = prios[i].active; - var visible = prios[i].visible; + var owner = prios[i].owner; + var active = prios[i].active; + var visible = prios[i].visible; var priority = prios[i].priority; - var compId = prios[i].componentId; - var duration = prios[i].duration_ms/1000; + var compId = prios[i].componentId; + var duration = prios[i].duration_ms / 1000; var value = "0,0,0"; var btn_type = "default"; var btn_text = $.i18n('remote_input_setsource_btn'); @@ -115,40 +104,38 @@ $(document).ready(function() { if (active) btn_type = "primary"; - if(priority > 254) + if (priority > 254) continue; - if(priority < 254 && (compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") ) + if (priority < 254 && (compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE")) clearAll = true; - if (visible) - { + if (visible) { btn_state = "disabled"; btn_type = "success"; btn_text = $.i18n('remote_input_sourceactiv_btn'); } - if(ip) - origin += '
'+$.i18n('remote_input_ip')+' '+ip+''; + if (ip) + origin += '
' + $.i18n('remote_input_ip') + ' ' + ip + ''; - if("value" in prios[i]) + if ("value" in prios[i]) value = prios[i].value.RGB; - switch (compId) - { + switch (compId) { case "EFFECT": - owner = $.i18n('remote_effects_label_effects')+' '+owner; + owner = $.i18n('remote_effects_label_effects') + ' ' + owner; break; case "COLOR": - owner = $.i18n('remote_color_label_color')+' '+'
'; + owner = $.i18n('remote_color_label_color') + ' ' + '
'; break; case "IMAGE": - owner = $.i18n('remote_effects_label_picture')+' '+owner; + owner = $.i18n('remote_effects_label_picture') + ' ' + owner; break; - case "GRABBER": - owner = $.i18n('general_comp_GRABBER')+': ('+owner+')'; + case "GRABBER": + owner = $.i18n('general_comp_GRABBER') + ': (' + owner + ')'; break; case "V4L": - owner = $.i18n('general_comp_V4L')+': ('+owner+')'; + owner = $.i18n('general_comp_V4L') + ': (' + owner + ')'; break; case "BOBLIGHTSERVER": owner = $.i18n('general_comp_BOBLIGHTSERVER'); @@ -161,126 +148,112 @@ $(document).ready(function() { break; } - if(duration && compId != "GRABBER" && compId != "FLATBUFSERVER" && compId != "PROTOSERVER") - owner += '
'+$.i18n('remote_input_duration')+' '+duration.toFixed(0)+$.i18n('edt_append_s')+''; + if (duration && compId != "GRABBER" && compId != "FLATBUFSERVER" && compId != "PROTOSERVER") + owner += '
' + $.i18n('remote_input_duration') + ' ' + duration.toFixed(0) + $.i18n('edt_append_s') + ''; - var btn = ''; + var btn = ''; - if((compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") && priority < 254) - btn += ''; + if ((compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") && priority < 254) + btn += ''; - if(btn_type != 'default') + if (btn_type != 'default') $('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true)); } - var btn_auto_color = (window.serverInfo.priorities_autoselect? "btn-success" : "btn-danger"); - var btn_auto_state = (window.serverInfo.priorities_autoselect? "disabled" : "enabled"); - var btn_auto_text = (window.serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off')); - var btn_call_state = (clearAll? "enabled" : "disabled"); - $('#auto_btn').html(''); - $('#auto_btn').append(''); + var btn_auto_color = (window.serverInfo.priorities_autoselect ? "btn-success" : "btn-danger"); + var btn_auto_state = (window.serverInfo.priorities_autoselect ? "disabled" : "enabled"); + var btn_auto_text = (window.serverInfo.priorities_autoselect ? $.i18n('general_btn_on') : $.i18n('general_btn_off')); + var btn_call_state = (clearAll ? "enabled" : "disabled"); + $('#auto_btn').html(''); + $('#auto_btn').append(''); - var max_width=100; - $('.btn_input_selection').each(function() { + var max_width = 100; + $('.btn_input_selection').each(function () { if ($(this).innerWidth() > max_width) max_width = $(this).innerWidth(); }); - $('.btn_input_selection').css("min-width",max_width+"px"); + $('.btn_input_selection').css("min-width", max_width + "px"); } - function updateLedMapping() - { + function updateLedMapping() { var mapping = window.serverInfo.imageToLedMappingType; $('#mappingsbutton').html(""); - for(var ix = 0; ix < mappingList.length; ix++) - { - if(mapping == mappingList[ix]) + for (var ix = 0; ix < mappingList.length; ix++) { + if (mapping == mappingList[ix]) var btn_style = 'btn-success'; else var btn_style = 'btn-primary'; - $('#mappingsbutton').append('
'); + $('#mappingsbutton').append('
'); } } - function initComponents() - { + function initComponents() { var components = window.comps; var hyperionEnabled = true; - components.forEach( function(obj) { - if (obj.name == "ALL") - { + components.forEach(function (obj) { + if (obj.name == "ALL") { hyperionEnabled = obj.enabled; } }); - for (const comp of components) - { - if(comp.name === "ALL") + for (const comp of components) { + if (comp.name === "ALL") continue; - const enable_style = (comp.enabled? "checked" : ""); - const comp_btn_id = "comp_btn_"+comp.name; + const enable_style = (comp.enabled ? "checked" : ""); + const comp_btn_id = "comp_btn_" + comp.name; - if ($("#"+comp_btn_id).length === 0) - { - var d='' - +'' - +'   ' - +''; + if ($("#" + comp_btn_id).length === 0) { + var d = '' + + ' ' + + ''; $('#componentsbutton').append(d); $(`#${comp_btn_id}`).bootstrapToggle(); $(`#${comp_btn_id}`).bootstrapToggle((hyperionEnabled ? "enable" : "disable")); $(`#${comp_btn_id}`).change(e => { - requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked); - //console.log(e.currentTarget.checked) + requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked); }); } } } - function updateComponent( component ) - { - if (component.name == "ALL") - { + function updateComponent(component) { + if (component.name == "ALL") { var components = window.comps; var hyperionEnabled = component.enabled; - for (const comp of components) - { + for (const comp of components) { - if(comp.name === "ALL") - continue; + if (comp.name === "ALL") + continue; - const comp_btn_id = "comp_btn_"+comp.name; + const comp_btn_id = "comp_btn_" + comp.name; - if ( !hyperionEnabled ) - { + if (!hyperionEnabled) { $(`#${comp_btn_id}`).bootstrapToggle('off'); $(`#${comp_btn_id}`).bootstrapToggle("disable"); } - else - { + else { $(`#${comp_btn_id}`).bootstrapToggle("enable"); - if ( comp.enabled !== $(`#${comp_btn_id}`).prop("checked") ) - { + if (comp.enabled !== $(`#${comp_btn_id}`).prop("checked")) { $(`#${comp_btn_id}`).bootstrapToggle().prop('checked', comp.enabled).change(); } } } } - else - { - const comp_btn_id = "comp_btn_"+component.name; + else { + const comp_btn_id = "comp_btn_" + component.name; //console.log ("updateComponent: ", component.name, "Current Checked: ", $(`#${comp_btn_id}`).prop("checked"), "New Checked: ", component.enabled, ); // In case Buttons were disabled before, status may be different to component status - if ( component.enabled != $(`#${comp_btn_id}`).prop("checked") ) - { + if (component.enabled != $(`#${comp_btn_id}`).prop("checked")) { // console.log ("Update status to Checked = ", component.enabled); - if ( component.enabled ) + if (component.enabled) $(`#${comp_btn_id}`).bootstrapToggle("on"); else $(`#${comp_btn_id}`).bootstrapToggle("off"); @@ -288,21 +261,19 @@ $(document).ready(function() { } } - function updateEffectlist() - { + function updateEffectlist() { var newEffects = window.serverInfo.effects; - if (newEffects.length != oldEffects.length) - { + if (newEffects.length != oldEffects.length) { $('#effect_select').html(''); var usrEffArr = []; var sysEffArr = []; - for(var i = 0; i < newEffects.length; i++) { + for (var i = 0; i < newEffects.length; i++) { var effectName = newEffects[i].name; - if(!/^\:/.test(newEffects[i].file)){ + if (!/^\:/.test(newEffects[i].file)) { usrEffArr.push(effectName); } - else{ + else { sysEffArr.push(effectName); } } @@ -312,74 +283,70 @@ $(document).ready(function() { } } - function updateVideoMode() - { - var videoModes = ["2D","3DSBS","3DTAB"]; + function updateVideoMode() { + var videoModes = ["2D", "3DSBS", "3DTAB"]; var currVideoMode = window.serverInfo.videomode; $('#videomodebtns').html(""); - for(var ix = 0; ix < videoModes.length; ix++) - { - if(currVideoMode == videoModes[ix]) + for (var ix = 0; ix < videoModes.length; ix++) { + if (currVideoMode == videoModes[ix]) var btn_style = 'btn-success'; else var btn_style = 'btn-primary'; - $('#videomodebtns').append('
'); + $('#videomodebtns').append('
'); } } // colorpicker and effect - if (getStorage('rmcpcolor') != null) - { + if (getStorage('rmcpcolor') != null) { cpcolor = getStorage('rmcpcolor'); rgb = hexToRgb(cpcolor); } - if (getStorage('rmduration') != null) - { + if (getStorage('rmduration') != null) { $("#remote_duration").val(getStorage('rmduration')); duration = getStorage('rmduration'); } - createCP('cp2', cpcolor, function(rgbT,hex){ + createCP('cp2', cpcolor, function (rgbT, hex) { rgb = rgbT; sendColor(); setStorage('rmcpcolor', hex); updateInputSelect(); }); - $("#reset_color").off().on("click", function(){ + $("#reset_color").off().on("click", function () { requestPriorityClear(); lastImgData = ""; $("#effect_select").val("__none__"); $("#remote_input_img").val(""); }); - $("#remote_duration").off().on("change", function(){ - duration = valValue(this.id,this.value,this.min,this.max); + $("#remote_duration").off().on("change", function () { + duration = valValue(this.id, this.value, this.min, this.max); setStorage('rmduration', duration); }); - $("#effect_select").off().on("change", function(event) { + $("#effect_select").off().on("change", function (event) { sendEffect(); }); - $("#remote_input_reseff, #remote_input_rescol").off().on("click", function(){ - if(this.id == "remote_input_rescol") + $("#remote_input_reseff, #remote_input_rescol").off().on("click", function () { + if (this.id == "remote_input_rescol") sendColor(); else sendEffect(); }); - $("#remote_input_repimg").off().on("click", function(){ - if(lastImgData != "") + $("#remote_input_repimg").off().on("click", function () { + if (lastImgData != "") requestSetImage(lastImgData, duration, lastFileName); }); - $("#remote_input_img").change(function(){ - readImg(this, function(src,fileName){ + $("#remote_input_img").change(function () { + readImg(this, function (src, fileName) { lastFileName = fileName; - if(src.includes(",")) + if (src.includes(",")) lastImgData = src.split(",")[1]; else lastImgData = src; @@ -397,27 +364,27 @@ $(document).ready(function() { // interval updates - $(window.hyperion).on('components-updated', function(e, comp){ + $(window.hyperion).on('components-updated', function (e, comp) { //console.log ("components-updated", e, comp); - updateComponent (comp); + updateComponent(comp); }); - $(window.hyperion).on("cmd-priorities-update", function(event){ + $(window.hyperion).on("cmd-priorities-update", function (event) { window.serverInfo.priorities = event.response.data.priorities; window.serverInfo.priorities_autoselect = event.response.data.priorities_autoselect; updateInputSelect(); }); - $(window.hyperion).on("cmd-imageToLedMapping-update", function(event){ + $(window.hyperion).on("cmd-imageToLedMapping-update", function (event) { window.serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType; updateLedMapping(); }); - $(window.hyperion).on("cmd-videomode-update", function(event){ + $(window.hyperion).on("cmd-videomode-update", function (event) { window.serverInfo.videomode = event.response.data.videomode; updateVideoMode(); }); - $(window.hyperion).on("cmd-effects-update", function(event){ + $(window.hyperion).on("cmd-effects-update", function (event) { window.serverInfo.effects = event.response.data.effects; updateEffectlist(); }); diff --git a/assets/webconfig/js/ledsim.js b/assets/webconfig/js/ledsim.js index 7fbdcbae..ace97bcb 100644 --- a/assets/webconfig/js/ledsim.js +++ b/assets/webconfig/js/ledsim.js @@ -249,12 +249,16 @@ $(document).ready(function() { // ------------------------------------------------------------------ $(window.hyperion).on("cmd-settings-update",function(event){ + var obj = event.response.data - Object.getOwnPropertyNames(obj).forEach(function(val, idx, array) { - window.serverInfo[val] = obj[val]; - }); - leds = window.serverConfig.leds - updateLedLayout(); + if ( obj.leds) { + console.log("ledsim: cmd-settings-update", event.response.data); + Object.getOwnPropertyNames(obj).forEach(function(val, idx, array) { + window.serverInfo[val] = obj[val]; + }); + leds = window.serverConfig.leds + updateLedLayout(); + } }); function resetImage(){ diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index 126efbec..26221f88 100755 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -330,7 +330,7 @@ function showInfoDialog(type, header, message) { $(document).on('click', '[data-dismiss-modal]', function () { var target = $(this).attr('data-dismiss-modal'); - $.find(target).modal.hide(); + $(target).modal('hide'); }); } @@ -1070,6 +1070,43 @@ function getReleases(callback) { }); } +function getSystemInfo() { + var sys = window.sysInfo.system; + var shy = window.sysInfo.hyperion; + + var info = "Hyperion Server: \n"; + info += '- Build: ' + shy.build + '\n'; + info += '- Build time: ' + shy.time + '\n'; + info += '- Git Remote: ' + shy.gitremote + '\n'; + info += '- Version: ' + shy.version + '\n'; + info += '- UI Lang: ' + storedLang + ' (BrowserLang: ' + 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'; + + info += '\n'; + + info += 'Hyperion Server OS: \n'; + info += '- Distribution: ' + sys.prettyName + '\n'; + info += '- Architecture: ' + sys.architecture + '\n'; + + if (sys.cpuModelName) + info += '- CPU Model: ' + sys.cpuModelName + '\n'; + if (sys.cpuModelType) + info += '- CPU Type: ' + sys.cpuModelType + '\n'; + if (sys.cpuRevision) + info += '- CPU Revision: ' + sys.cpuRevision + '\n'; + if (sys.cpuHardware) + info += '- CPU Hardware: ' + sys.cpuHardware + '\n'; + + info += '- Kernel: ' + sys.kernelType + ' (' + sys.kernelVersion + ' (WS: ' + sys.wordSize + '))\n'; + info += '- Qt Version: ' + sys.qtVersion + '\n'; + info += '- Python Version: ' + sys.pyVersion + '\n'; + info += '- Browser: ' + navigator.userAgent; + return info; +} + function handleDarkMode() { $("", { rel: "stylesheet",