mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge branch 'master' into Razer_Chroma_Support
This commit is contained in:
@@ -35,7 +35,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
editor_color.on('change',function() {
|
||||
editor_color.validate().length ? $('#btn_submit_color').attr('disabled', true) : $('#btn_submit_color').attr('disabled', false);
|
||||
editor_color.validate().length || window.readOnlyMode ? $('#btn_submit_color').attr('disabled', true) : $('#btn_submit_color').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_color').off().on('click',function() {
|
||||
@@ -48,7 +48,8 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
editor_smoothing.on('change',function() {
|
||||
editor_smoothing.validate().length ? $('#btn_submit_smoothing').attr('disabled', true) : $('#btn_submit_smoothing').attr('disabled', false);
|
||||
editor_smoothing.validate().length || window.readOnlyMode ? $('#btn_submit_smoothing').attr('disabled', true) : $('#btn_submit_smoothing').attr('disabled', false);
|
||||
|
||||
});
|
||||
|
||||
$('#btn_submit_smoothing').off().on('click',function() {
|
||||
@@ -61,7 +62,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
editor_blackborder.on('change',function() {
|
||||
editor_blackborder.validate().length ? $('#btn_submit_blackborder').attr('disabled', true) : $('#btn_submit_blackborder').attr('disabled', false);
|
||||
editor_blackborder.validate().length || window.readOnlyMode ? $('#btn_submit_blackborder').attr('disabled', true) : $('#btn_submit_blackborder').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_blackborder').off().on('click',function() {
|
||||
|
||||
@@ -70,7 +70,6 @@ $(document).ready( function() {
|
||||
});
|
||||
|
||||
var instancename = window.currentHyperionInstanceName;
|
||||
console.log ("instancename: ",instancename);
|
||||
|
||||
$('#dash_statush').html(hyperion_enabled ? '<span style="color:green">'+$.i18n('general_btn_on')+'</span>' : '<span style="color:red">'+$.i18n('general_btn_off')+'</span>');
|
||||
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh', instancename)+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh', instancename)+'</button>');
|
||||
|
||||
@@ -43,7 +43,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
effects_editor.on('change',function() {
|
||||
effects_editor.validate().length ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false);
|
||||
effects_editor.validate().length || window.readOnlyMode ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_effects').off().on('click',function() {
|
||||
@@ -65,11 +65,11 @@ $(document).ready( function() {
|
||||
});
|
||||
|
||||
foregroundEffect_editor.on('change',function() {
|
||||
foregroundEffect_editor.validate().length ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
|
||||
foregroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
|
||||
});
|
||||
|
||||
backgroundEffect_editor.on('change',function() {
|
||||
backgroundEffect_editor.validate().length ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
|
||||
backgroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_foregroundEffect').off().on('click',function() {
|
||||
|
||||
@@ -83,7 +83,8 @@ $(document).ready( function() {
|
||||
}
|
||||
if( effects_editor.validate().length == 0 && effectName != "")
|
||||
{
|
||||
$('#btn_start_test, #btn_write').attr('disabled', false);
|
||||
$('#btn_start_test').attr('disabled', false);
|
||||
!window.readOnlyMode ? $('#btn_write').attr('disabled', false) : $('#btn_write').attr('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,6 +102,7 @@ $(document).ready( function() {
|
||||
} else {
|
||||
effects_editor.enable();
|
||||
$("#eff_footer").children().attr('disabled',false);
|
||||
!window.readOnlyMode ? $('#btn_write').attr('disabled', false) : $('#btn_write').attr('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
@@ -28,6 +28,12 @@ $(document).ready( function() {
|
||||
// Instance handling
|
||||
function handleInstanceRename(e)
|
||||
{
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#btn_ma_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
var inst = e.currentTarget.id.split("_")[1];
|
||||
showInfoDialog('renInst', $.i18n('conf_general_inst_renreq_t'), getInstanceNameByIndex(inst));
|
||||
|
||||
@@ -77,6 +83,10 @@ $(document).ready( function() {
|
||||
$('#instren_'+inst[key].instance).off().on('click', handleInstanceRename);
|
||||
$('#inst_'+inst[key].instance).off().on('click', handleInstanceStartStop);
|
||||
$('#instdel_'+inst[key].instance).off().on('click', handleInstanceDelete);
|
||||
|
||||
window.readOnlyMode ? $('#instren_'+inst[key].instance).attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#inst_'+inst[key].instance).attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#instdel_'+inst[key].instance).attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +95,7 @@ $(document).ready( function() {
|
||||
buildInstanceList();
|
||||
|
||||
$('#inst_name').off().on('input',function(e) {
|
||||
(e.currentTarget.value.length >= 5) ? $('#btn_create_inst').attr('disabled', false) : $('#btn_create_inst').attr('disabled', true);
|
||||
(e.currentTarget.value.length >= 5) && !window.readOnlyMode ? $('#btn_create_inst').attr('disabled', false) : $('#btn_create_inst').attr('disabled', true);
|
||||
if(5-e.currentTarget.value.length >= 1 && 5-e.currentTarget.value.length <= 4)
|
||||
$('#inst_chars_needed').html(5-e.currentTarget.value.length + " " + $.i18n('general_chars_needed'))
|
||||
else
|
||||
@@ -105,7 +115,7 @@ $(document).ready( function() {
|
||||
//import
|
||||
function dis_imp_btn(state)
|
||||
{
|
||||
state ? $('#btn_import_conf').attr('disabled', true) : $('#btn_import_conf').attr('disabled', false);
|
||||
state || window.readOnlyMode ? $('#btn_import_conf').attr('disabled', true) : $('#btn_import_conf').attr('disabled', false);
|
||||
}
|
||||
|
||||
function readFile(evt)
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
$(document).ready( function() {
|
||||
$(document).ready(function () {
|
||||
performTranslation();
|
||||
var conf_editor_v4l2 = null;
|
||||
var conf_editor_fg = null;
|
||||
var conf_editor_instCapt = null;
|
||||
var V4L2_AVAIL = window.serverInfo.grabbers.available.includes("v4l2");
|
||||
|
||||
if(V4L2_AVAIL) {
|
||||
if (V4L2_AVAIL) {
|
||||
// Dynamic v4l2 enum schema
|
||||
var v4l2_dynamic_enum_schema = {
|
||||
"available_devices":
|
||||
{
|
||||
"type": "string",
|
||||
"title": "edt_conf_v4l2_device_title",
|
||||
"propertyOrder" : 1,
|
||||
"required" : true
|
||||
"propertyOrder": 1,
|
||||
"required": true
|
||||
},
|
||||
"device_inputs":
|
||||
{
|
||||
"type": "string",
|
||||
"title": "edt_conf_v4l2_input_title",
|
||||
"propertyOrder" : 3,
|
||||
"required" : true
|
||||
"propertyOrder": 3,
|
||||
"required": true
|
||||
},
|
||||
"resolutions":
|
||||
{
|
||||
"type": "string",
|
||||
"title": "edt_conf_v4l2_resolution_title",
|
||||
"propertyOrder" : 6,
|
||||
"required" : true
|
||||
"propertyOrder": 6,
|
||||
"required": true
|
||||
},
|
||||
"framerates":
|
||||
{
|
||||
"type": "string",
|
||||
"title": "edt_conf_v4l2_framerate_title",
|
||||
"propertyOrder" : 9,
|
||||
"required" : true
|
||||
"propertyOrder": 9,
|
||||
"required": true
|
||||
}
|
||||
};
|
||||
|
||||
// Build dynamic v4l2 enum schema parts
|
||||
var buildSchemaPart = function(key, schema, device) {
|
||||
var buildSchemaPart = function (key, schema, device) {
|
||||
if (schema[key]) {
|
||||
var enumVals = [];
|
||||
var enumTitelVals = [];
|
||||
@@ -76,31 +76,31 @@ $(document).ready( function() {
|
||||
"type": schema[key].type,
|
||||
"title": schema[key].title,
|
||||
"enum": [].concat(["auto"], enumVals, ["custom"]),
|
||||
"options" :
|
||||
"options":
|
||||
{
|
||||
"enum_titles" : [].concat(["edt_conf_enum_automatic"], enumTitelVals, ["edt_conf_enum_custom"]),
|
||||
"enum_titles": [].concat(["edt_conf_enum_automatic"], enumTitelVals, ["edt_conf_enum_custom"]),
|
||||
},
|
||||
"propertyOrder" : schema[key].propertyOrder,
|
||||
"required" : schema[key].required
|
||||
"propertyOrder": schema[key].propertyOrder,
|
||||
"required": schema[key].required
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Switch between visible states
|
||||
function toggleOption(option, state) {
|
||||
$('[data-schemapath="root.grabberV4L2.'+option+'"]').toggle(state);
|
||||
$('[data-schemapath="root.grabberV4L2.' + option + '"]').toggle(state);
|
||||
if (state) (
|
||||
$('[data-schemapath="root.grabberV4L2.'+option+'"]').addClass('col-md-12'),
|
||||
$('label[for="root_grabberV4L2_'+option+'"]').css('left','10px'),
|
||||
$('[id="root_grabberV4L2_'+option+'"]').css('left','10px')
|
||||
$('[data-schemapath="root.grabberV4L2.' + option + '"]').addClass('col-md-12'),
|
||||
$('label[for="root_grabberV4L2_' + option + '"]').css('left', '10px'),
|
||||
$('[id="root_grabberV4L2_' + option + '"]').css('left', '10px')
|
||||
);
|
||||
}
|
||||
|
||||
// Watch all v4l2 dynamic fields
|
||||
var setWatchers = function(schema) {
|
||||
var setWatchers = function (schema) {
|
||||
var path = 'root.grabberV4L2.';
|
||||
Object.keys(schema).forEach(function(key) {
|
||||
conf_editor_v4l2.watch(path + key, function() {
|
||||
Object.keys(schema).forEach(function (key) {
|
||||
conf_editor_v4l2.watch(path + key, function () {
|
||||
var ed = conf_editor_v4l2.getEditor(path + key);
|
||||
var val = ed.getValue();
|
||||
|
||||
@@ -108,7 +108,7 @@ $(document).ready( function() {
|
||||
var V4L2properties = ['device_inputs', 'resolutions', 'framerates'];
|
||||
if (val == 'custom') {
|
||||
var grabberV4L2 = ed.parent;
|
||||
V4L2properties.forEach(function(item) {
|
||||
V4L2properties.forEach(function (item) {
|
||||
buildSchemaPart(item, v4l2_dynamic_enum_schema, 'none');
|
||||
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
@@ -123,9 +123,8 @@ $(document).ready( function() {
|
||||
|
||||
conf_editor_v4l2.getEditor(path + 'standard').enable();
|
||||
toggleOption('device', true);
|
||||
|
||||
} else if (val == 'auto') {
|
||||
V4L2properties.forEach(function(item) {
|
||||
V4L2properties.forEach(function (item) {
|
||||
conf_editor_v4l2.getEditor(path + item).setValue('auto');
|
||||
conf_editor_v4l2.getEditor(path + item).disable();
|
||||
});
|
||||
@@ -134,12 +133,11 @@ $(document).ready( function() {
|
||||
conf_editor_v4l2.getEditor(path + 'standard').disable();
|
||||
|
||||
(toggleOption('device', false), toggleOption('input', false),
|
||||
toggleOption('width', false), toggleOption('height', false),
|
||||
toggleOption('fps', false));
|
||||
|
||||
toggleOption('width', false), toggleOption('height', false),
|
||||
toggleOption('fps', false));
|
||||
} else {
|
||||
var grabberV4L2 = ed.parent;
|
||||
V4L2properties.forEach(function(item) {
|
||||
V4L2properties.forEach(function (item) {
|
||||
buildSchemaPart(item, v4l2_dynamic_enum_schema, val);
|
||||
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||
@@ -176,12 +174,12 @@ $(document).ready( function() {
|
||||
};
|
||||
|
||||
// Insert dynamic v4l2 enum schema parts
|
||||
Object.keys(v4l2_dynamic_enum_schema).forEach(function(key) {
|
||||
Object.keys(v4l2_dynamic_enum_schema).forEach(function (key) {
|
||||
buildSchemaPart(key, v4l2_dynamic_enum_schema, window.serverConfig.grabberV4L2.device);
|
||||
});
|
||||
}
|
||||
|
||||
if(window.showOptHelp) {
|
||||
if (window.showOptHelp) {
|
||||
// Instance Capture
|
||||
$('#conf_cont').append(createRow('conf_cont_instCapt'));
|
||||
$('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt'));
|
||||
@@ -193,7 +191,7 @@ $(document).ready( function() {
|
||||
$('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
|
||||
|
||||
// V4L2 - hide if not available
|
||||
if(V4L2_AVAIL) {
|
||||
if (V4L2_AVAIL) {
|
||||
$('#conf_cont').append(createRow('conf_cont_v4l'));
|
||||
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||
$('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
|
||||
@@ -202,7 +200,7 @@ $(document).ready( function() {
|
||||
$('#conf_cont').addClass('row');
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt'));
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
|
||||
if(V4L2_AVAIL) {
|
||||
if (V4L2_AVAIL) {
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||
}
|
||||
}
|
||||
@@ -212,11 +210,11 @@ $(document).ready( function() {
|
||||
instCapture: window.schema.instCapture
|
||||
}, true, true);
|
||||
|
||||
conf_editor_instCapt.on('change',function() {
|
||||
conf_editor_instCapt.validate().length ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false);
|
||||
conf_editor_instCapt.on('change', function () {
|
||||
conf_editor_instCapt.validate().length || window.readOnlyMode ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_instCapt').off().on('click',function() {
|
||||
$('#btn_submit_instCapt').off().on('click', function () {
|
||||
requestWriteConfig(conf_editor_instCapt.getValue());
|
||||
});
|
||||
|
||||
@@ -225,24 +223,46 @@ $(document).ready( function() {
|
||||
framegrabber: window.schema.framegrabber
|
||||
}, true, true);
|
||||
|
||||
conf_editor_fg.on('change',function() {
|
||||
conf_editor_fg.validate().length ? $('#btn_submit_fg').attr('disabled', true) : $('#btn_submit_fg').attr('disabled', false);
|
||||
conf_editor_fg.on('change', function () {
|
||||
//Remove Grabbers which are not supported
|
||||
var grabbers = window.serverInfo.grabbers.available;
|
||||
|
||||
var selector = "root_framegrabber_type";
|
||||
var options = $("#" + selector + " option");
|
||||
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
var type = options[i].value;
|
||||
if (grabbers.indexOf(type) === -1) {
|
||||
$("#" + selector + " option[value='" + type + "']").remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (window.serverInfo.grabbers.active)
|
||||
{
|
||||
var activegrabber = window.serverInfo.grabbers.active.toLowerCase();
|
||||
$("#" + selector + " option[value='" + activegrabber + "']").attr('selected', 'selected');
|
||||
}
|
||||
|
||||
var selectedType = $("#root_framegrabber_type").val();
|
||||
filerFgGrabberOptions(selectedType);
|
||||
|
||||
conf_editor_fg.validate().length || window.readOnlyMode ? $('#btn_submit_fg').attr('disabled', true) : $('#btn_submit_fg').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_fg').off().on('click',function() {
|
||||
$('#btn_submit_fg').off().on('click', function () {
|
||||
requestWriteConfig(conf_editor_fg.getValue());
|
||||
});
|
||||
|
||||
if(V4L2_AVAIL) {
|
||||
if (V4L2_AVAIL) {
|
||||
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
|
||||
grabberV4L2 : window.schema.grabberV4L2
|
||||
grabberV4L2: window.schema.grabberV4L2
|
||||
}, true, true);
|
||||
|
||||
conf_editor_v4l2.on('change',function() {
|
||||
conf_editor_v4l2.validate().length ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||
conf_editor_v4l2.on('change', function () {
|
||||
conf_editor_v4l2.validate().length || window.readOnlyMode ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||
});
|
||||
|
||||
conf_editor_v4l2.on('ready', function() {
|
||||
conf_editor_v4l2.on('ready', function () {
|
||||
setWatchers(v4l2_dynamic_enum_schema);
|
||||
|
||||
if (window.serverConfig.grabberV4L2.available_devices == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
@@ -252,7 +272,7 @@ $(document).ready( function() {
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
|
||||
|
||||
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
|
||||
['device_inputs', 'standard', 'resolutions', 'framerates'].forEach(function(item) {
|
||||
['device_inputs', 'standard', 'resolutions', 'framerates'].forEach(function (item) {
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).setValue('auto');
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).disable();
|
||||
});
|
||||
@@ -266,10 +286,9 @@ $(document).ready( function() {
|
||||
|
||||
if (window.serverConfig.grabberV4L2.framerates == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
toggleOption('fps', true);
|
||||
|
||||
});
|
||||
|
||||
$('#btn_submit_v4l2').off().on('click',function() {
|
||||
$('#btn_submit_v4l2').off().on('click', function () {
|
||||
var v4l2Options = conf_editor_v4l2.getValue();
|
||||
|
||||
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
@@ -304,31 +323,54 @@ $(document).ready( function() {
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
//create introduction
|
||||
if(window.showOptHelp) {
|
||||
if (window.showOptHelp) {
|
||||
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
|
||||
if(V4L2_AVAIL){
|
||||
if (V4L2_AVAIL) {
|
||||
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
|
||||
}
|
||||
}
|
||||
|
||||
function hideEl(el) {
|
||||
for(var i = 0; i<el.length; i++) {
|
||||
$('[data-schemapath*="root.framegrabber.'+el[i]+'"]').toggle(false);
|
||||
function toggleFgOptions(el, state) {
|
||||
for (var i = 0; i < el.length; i++) {
|
||||
$('[data-schemapath*="root.framegrabber.' + el[i] + '"]').toggle(state);
|
||||
}
|
||||
}
|
||||
|
||||
//hide specific options
|
||||
conf_editor_fg.on('ready',function() {
|
||||
var grabbers = window.serverInfo.grabbers.available;
|
||||
function filerFgGrabberOptions(type) {
|
||||
//hide specific options for grabbers found
|
||||
|
||||
if (grabbers.indexOf('dispmanx') > -1)
|
||||
hideEl(["device","pixelDecimation"]);
|
||||
else if (grabbers.indexOf('x11') > -1 || grabbers.indexOf('xcb') > -1)
|
||||
hideEl(["device","width","height"]);
|
||||
else if (grabbers.indexOf('osx') > -1 )
|
||||
hideEl(["device","pixelDecimation"]);
|
||||
else if (grabbers.indexOf('amlogic') > -1)
|
||||
hideEl(["pixelDecimation"]);
|
||||
var grabbers = window.serverInfo.grabbers.available;
|
||||
if (grabbers.indexOf(type) > -1) {
|
||||
toggleFgOptions(["width", "height", "pixelDecimation", "display"], true);
|
||||
|
||||
switch (type) {
|
||||
case "dispmanx":
|
||||
toggleFgOptions(["pixelDecimation", "display"], false);
|
||||
break;
|
||||
case "x11":
|
||||
case "xcb":
|
||||
toggleFgOptions(["width", "height", "display"], false);
|
||||
break;
|
||||
case "framebuffer":
|
||||
toggleFgOptions(["display"], false);
|
||||
break;
|
||||
case "amlogic":
|
||||
toggleFgOptions(["pixelDecimation", "display"], false);
|
||||
break;
|
||||
case "qt":
|
||||
break;
|
||||
case "dx":
|
||||
break;
|
||||
case "osx":
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$('#root_framegrabber_type').change(function () {
|
||||
var selectedType = $("#root_framegrabber_type").val();
|
||||
filerFgGrabberOptions(selectedType);
|
||||
});
|
||||
|
||||
removeOverlay();
|
||||
|
||||
@@ -26,6 +26,9 @@ $(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
|
||||
|
||||
|
||||
@@ -59,40 +59,36 @@ function createLedPreview(leds, origin){
|
||||
|
||||
}
|
||||
|
||||
function createClassicLeds(){
|
||||
//get values
|
||||
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");
|
||||
function createClassicLedLayoutSimple( ledstop,ledsleft,ledsright,ledsbottom,position,reverse ){
|
||||
|
||||
//advanced values
|
||||
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()/100;
|
||||
let params = {
|
||||
ledstop: 0, ledsleft: 0, ledsright: 0, ledsbottom: 0,
|
||||
ledsglength: 0, ledsgpos: 0, position: 0,
|
||||
ledsHDepth: 0.08, ledsVDepth: 0.05, overlap: 0,
|
||||
edgeVGap: 0,
|
||||
ptblh: 0, ptblv: 1, ptbrh: 1, ptbrv: 1,
|
||||
pttlh: 0, pttlv: 0, pttrh: 1, pttrv: 0,
|
||||
reverse:false
|
||||
};
|
||||
|
||||
params.ledstop = ledstop;
|
||||
params.ledsleft = ledsleft;
|
||||
params.ledsright = ledsright;
|
||||
params.ledsbottom = ledsbottom;
|
||||
params.position = position;
|
||||
params.reverse = reverse;
|
||||
|
||||
//trapezoid values % -> float
|
||||
var ptblh = parseInt($("#ip_cl_pblh").val())/100;
|
||||
var ptblv = parseInt($("#ip_cl_pblv").val())/100;
|
||||
var ptbrh = parseInt($("#ip_cl_pbrh").val())/100;
|
||||
var ptbrv = parseInt($("#ip_cl_pbrv").val())/100;
|
||||
var pttlh = parseInt($("#ip_cl_ptlh").val())/100;
|
||||
var pttlv = parseInt($("#ip_cl_ptlv").val())/100;
|
||||
var pttrh = parseInt($("#ip_cl_ptrh").val())/100;
|
||||
var pttrv = parseInt($("#ip_cl_ptrv").val())/100;
|
||||
return createClassicLedLayout( params );
|
||||
}
|
||||
|
||||
function createClassicLedLayout( params ){
|
||||
|
||||
//helper
|
||||
var edgeHGap = edgeVGap/(16/9);
|
||||
var edgeHGap = params.edgeVGap/(16/9);
|
||||
var ledArray = [];
|
||||
|
||||
function createFinalArray(array){
|
||||
finalLedArray = [];
|
||||
var finalLedArray = [];
|
||||
for(var i = 0; i<array.length; i++){
|
||||
var hmin = array[i].hmin;
|
||||
var hmax = array[i].hmax;
|
||||
@@ -100,7 +96,7 @@ function createClassicLeds(){
|
||||
var vmax = array[i].vmax;
|
||||
finalLedArray[i] = { "hmax": hmax, "hmin": hmin, "vmax": vmax, "vmin": vmin }
|
||||
}
|
||||
createLedPreview(finalLedArray, 'classic');
|
||||
return finalLedArray;
|
||||
}
|
||||
|
||||
function rotateArray(array, times){
|
||||
@@ -131,9 +127,9 @@ function createClassicLeds(){
|
||||
function ovl(scan,val)
|
||||
{
|
||||
if(scan == "+")
|
||||
return valScan(val += overlap);
|
||||
return valScan(val += params.overlap);
|
||||
else
|
||||
return valScan(val -= overlap);
|
||||
return valScan(val -= params.overlap);
|
||||
}
|
||||
|
||||
function createLedArray(hmin, hmax, vmin, vmax){
|
||||
@@ -145,53 +141,53 @@ function createClassicLeds(){
|
||||
}
|
||||
|
||||
function createTopLeds(){
|
||||
var steph = (pttrh - pttlh - (2*edgeHGap))/ledstop;
|
||||
var stepv = (pttrv - pttlv)/ledstop;
|
||||
var steph = (params.pttrh - params.pttlh - (2*edgeHGap))/params.ledstop;
|
||||
var stepv = (params.pttrv - params.pttlv)/params.ledstop;
|
||||
|
||||
for (var i = 0; i<ledstop; i++){
|
||||
var hmin = ovl("-",pttlh+(steph*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",pttlh+(steph*Number([i+1]))+edgeHGap);
|
||||
var vmin = pttlv+(stepv*Number([i]));
|
||||
var vmax = vmin + ledsHDepth;
|
||||
for (var i = 0; i<params.ledstop; i++){
|
||||
var hmin = ovl("-",params.pttlh+(steph*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",params.pttlh+(steph*Number([i+1]))+edgeHGap);
|
||||
var vmin = params.pttlv+(stepv*Number([i]));
|
||||
var vmax = vmin + params.ledsHDepth;
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
|
||||
function createRightLeds(){
|
||||
var steph = (ptbrh - pttrh)/ledsright;
|
||||
var stepv = (ptbrv - pttrv - (2*edgeVGap))/ledsright;
|
||||
var steph = (params.ptbrh - params.pttrh)/params.ledsright;
|
||||
var stepv = (params.ptbrv - params.pttrv - (2*params.edgeVGap))/params.ledsright;
|
||||
|
||||
for (var i = 0; i<ledsright; i++){
|
||||
var hmax = pttrh+(steph*Number([i+1]));
|
||||
var hmin = hmax-ledsVDepth;
|
||||
var vmin = ovl("-",pttrv+(stepv*Number([i]))+edgeVGap);
|
||||
var vmax = ovl("+",pttrv+(stepv*Number([i+1]))+edgeVGap);
|
||||
for (var i = 0; i<params.ledsright; i++){
|
||||
var hmax = params.pttrh+(steph*Number([i+1]));
|
||||
var hmin = hmax-params.ledsVDepth;
|
||||
var vmin = ovl("-",params.pttrv+(stepv*Number([i]))+params.edgeVGap);
|
||||
var vmax = ovl("+",params.pttrv+(stepv*Number([i+1]))+params.edgeVGap);
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
|
||||
function createBottomLeds(){
|
||||
var steph = (ptbrh - ptblh - (2*edgeHGap))/ledsbottom;
|
||||
var stepv = (ptbrv - ptblv)/ledsbottom;
|
||||
var steph = (params.ptbrh - params.ptblh - (2*edgeHGap))/params.ledsbottom;
|
||||
var stepv = (params.ptbrv - params.ptblv)/params.ledsbottom;
|
||||
|
||||
for (var i = ledsbottom-1; i>-1; i--){
|
||||
var hmin = ovl("-",ptblh+(steph*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",ptblh+(steph*Number([i+1]))+edgeHGap);
|
||||
var vmax= ptblv+(stepv*Number([i]));
|
||||
var vmin = vmax-ledsHDepth;
|
||||
for (var i = params.ledsbottom-1; i>-1; i--){
|
||||
var hmin = ovl("-",params.ptblh+(steph*Number([i]))+edgeHGap);
|
||||
var hmax = ovl("+",params.ptblh+(steph*Number([i+1]))+edgeHGap);
|
||||
var vmax= params.ptblv+(stepv*Number([i]));
|
||||
var vmin = vmax-params.ledsHDepth;
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
}
|
||||
|
||||
function createLeftLeds(){
|
||||
var steph = (ptblh - pttlh)/ledsleft;
|
||||
var stepv = (ptblv - pttlv - (2*edgeVGap))/ledsleft;
|
||||
var steph = (params.ptblh - params.pttlh)/params.ledsleft;
|
||||
var stepv = (params.ptblv - params.pttlv - (2*params.edgeVGap))/params.ledsleft;
|
||||
|
||||
for (var i = ledsleft-1; i>-1; i--){
|
||||
var hmin = pttlh+(steph*Number([i]));
|
||||
var hmax = hmin+ledsVDepth;
|
||||
var vmin = ovl("-",pttlv+(stepv*Number([i]))+edgeVGap);
|
||||
var vmax = ovl("+",pttlv+(stepv*Number([i+1]))+edgeVGap);
|
||||
for (var i = params.ledsleft-1; i>-1; i--){
|
||||
var hmin = params.pttlh+(steph*Number([i]));
|
||||
var hmax = hmin+params.ledsVDepth;
|
||||
var vmin = ovl("-",params.pttlv+(stepv*Number([i]))+params.edgeVGap);
|
||||
var vmax = ovl("+",params.pttlv+(stepv*Number([i+1]))+params.edgeVGap);
|
||||
createLedArray(hmin, hmax, vmin, vmax);
|
||||
}
|
||||
|
||||
@@ -202,47 +198,87 @@ function createClassicLeds(){
|
||||
createRightLeds();
|
||||
createBottomLeds();
|
||||
createLeftLeds();
|
||||
|
||||
|
||||
//check led gap pos
|
||||
if (ledsgpos+ledsglength > ledArray.length)
|
||||
if (params.ledsgpos+params.ledsglength > ledArray.length)
|
||||
{
|
||||
var mpos = Math.max(0,ledArray.length-ledsglength);
|
||||
$('#ip_cl_ledsgpos').val(mpos);
|
||||
var mpos = Math.max(0,ledArray.length-params.ledsglength);
|
||||
//$('#ip_cl_ledsgpos').val(mpos);
|
||||
ledsgpos = mpos;
|
||||
}
|
||||
|
||||
//check led gap length
|
||||
if(ledsglength >= ledArray.length)
|
||||
if(params.ledsglength >= ledArray.length)
|
||||
{
|
||||
$('#ip_cl_ledsglength').val(ledArray.length-1);
|
||||
ledsglength = ledArray.length-ledsglength-1;
|
||||
//$('#ip_cl_ledsglength').val(ledArray.length-1);
|
||||
params.ledsglength = ledArray.length-params.ledsglength-1;
|
||||
}
|
||||
|
||||
if(ledsglength != 0){
|
||||
ledArray.splice(ledsgpos, ledsglength);
|
||||
if(params.ledsglength != 0){
|
||||
ledArray.splice(params.ledsgpos, params.ledsglength);
|
||||
}
|
||||
|
||||
if (position != 0){
|
||||
rotateArray(ledArray, position);
|
||||
if (params.position != 0){
|
||||
rotateArray(ledArray, params.position);
|
||||
}
|
||||
|
||||
if (reverse)
|
||||
if (params.reverse)
|
||||
ledArray.reverse();
|
||||
|
||||
createFinalArray(ledArray);
|
||||
return createFinalArray(ledArray);
|
||||
}
|
||||
|
||||
function createMatrixLeds(){
|
||||
function createClassicLeds(){
|
||||
|
||||
//get values
|
||||
let params = {
|
||||
ledstop : parseInt($("#ip_cl_top").val()),
|
||||
ledsbottom : parseInt($("#ip_cl_bottom").val()),
|
||||
ledsleft : parseInt($("#ip_cl_left").val()),
|
||||
ledsright : parseInt($("#ip_cl_right").val()),
|
||||
ledsglength : parseInt($("#ip_cl_glength").val()),
|
||||
ledsgpos : parseInt($("#ip_cl_gpos").val()),
|
||||
position : parseInt($("#ip_cl_position").val()),
|
||||
reverse : $("#ip_cl_reverse").is(":checked"),
|
||||
|
||||
//advanced values
|
||||
ledsVDepth : parseInt($("#ip_cl_vdepth").val())/100,
|
||||
ledsHDepth : parseInt($("#ip_cl_hdepth").val())/100,
|
||||
edgeVGap : parseInt($("#ip_cl_edgegap").val())/100/2,
|
||||
//cornerVGap : parseInt($("#ip_cl_cornergap").val())/100/2,
|
||||
overlap : $("#ip_cl_overlap").val()/100,
|
||||
|
||||
//trapezoid values % -> float
|
||||
ptblh : parseInt($("#ip_cl_pblh").val())/100,
|
||||
ptblv : parseInt($("#ip_cl_pblv").val())/100,
|
||||
ptbrh : parseInt($("#ip_cl_pbrh").val())/100,
|
||||
ptbrv : parseInt($("#ip_cl_pbrv").val())/100,
|
||||
pttlh : parseInt($("#ip_cl_ptlh").val())/100,
|
||||
pttlv : parseInt($("#ip_cl_ptlv").val())/100,
|
||||
pttrh : parseInt($("#ip_cl_ptrh").val())/100,
|
||||
pttrv : parseInt($("#ip_cl_ptrv").val())/100,
|
||||
}
|
||||
|
||||
finalLedArray = createClassicLedLayout( params );
|
||||
|
||||
//check led gap pos
|
||||
if (params.ledsgpos+params.ledsglength > finalLedArray.length) {
|
||||
var mpos = Math.max(0,finalLedArray.length-params.ledsglength);
|
||||
$('#ip_cl_ledsgpos').val(mpos);
|
||||
}
|
||||
//check led gap length
|
||||
if(params.ledsglength >= finalLedArray.length) {
|
||||
$('#ip_cl_ledsglength').val(finalLedArray.length-1);
|
||||
}
|
||||
|
||||
createLedPreview(finalLedArray, 'classic');
|
||||
}
|
||||
|
||||
|
||||
function createMatrixLayout( ledshoriz, ledsvert, cabling, start){
|
||||
// Big thank you to RanzQ (Juha Rantanen) from Github for this script
|
||||
// https://raw.githubusercontent.com/RanzQ/hyperion-audio-effects/master/matrix-config.js
|
||||
|
||||
//get values
|
||||
var ledshoriz = parseInt($("#ip_ma_ledshoriz").val());
|
||||
var ledsvert = parseInt($("#ip_ma_ledsvert").val());
|
||||
var cabling = $("#ip_ma_cabling").val();
|
||||
//var order = $("#ip_ma_order").val();
|
||||
var start = $("#ip_ma_start").val();
|
||||
|
||||
var parallel = false
|
||||
var leds = []
|
||||
var hblock = 1.0 / ledshoriz
|
||||
@@ -298,9 +334,23 @@ function createMatrixLeds(){
|
||||
endX = tmp
|
||||
}
|
||||
}
|
||||
finalLedArray =[];
|
||||
finalLedArray = leds
|
||||
createLedPreview(leds, 'matrix');
|
||||
|
||||
return leds;
|
||||
}
|
||||
|
||||
|
||||
function createMatrixLeds(){
|
||||
// Big thank you to RanzQ (Juha Rantanen) from Github for this script
|
||||
// https://raw.githubusercontent.com/RanzQ/hyperion-audio-effects/master/matrix-config.js
|
||||
|
||||
//get values
|
||||
var ledshoriz = parseInt($("#ip_ma_ledshoriz").val());
|
||||
var ledsvert = parseInt($("#ip_ma_ledsvert").val());
|
||||
var cabling = $("#ip_ma_cabling").val();
|
||||
var start = $("#ip_ma_start").val();
|
||||
|
||||
finalLedArray = createMatrixLayout(ledshoriz,ledsvert,cabling,start);
|
||||
createLedPreview(finalLedArray, 'matrix');
|
||||
}
|
||||
|
||||
function migrateLedConfig(slConfig){
|
||||
@@ -309,10 +359,10 @@ function migrateLedConfig(slConfig){
|
||||
|
||||
//Default Classic layout
|
||||
newLedConfig.classic = {
|
||||
"top" : 8,
|
||||
"bottom" : 8,
|
||||
"left" : 5,
|
||||
"right" : 5,
|
||||
"top" : 1,
|
||||
"bottom" : 0,
|
||||
"left" : 0,
|
||||
"right" : 0,
|
||||
"glength" : 0,
|
||||
"gpos" : 0,
|
||||
"position" : 0,
|
||||
@@ -336,8 +386,8 @@ function migrateLedConfig(slConfig){
|
||||
newLedConfig.classic.overlap = slConfig.overlap;
|
||||
|
||||
//Default Matrix layout
|
||||
newLedConfig["matrix"] = { "ledshoriz": 10,
|
||||
"ledsvert" : 10,
|
||||
newLedConfig["matrix"] = { "ledshoriz": 1,
|
||||
"ledsvert" : 1,
|
||||
"cabling" : "snake",
|
||||
"start" : "top-left"
|
||||
}
|
||||
@@ -468,6 +518,11 @@ $(document).ready(function() {
|
||||
$('#leds_custom_updsim').attr("disabled", true);
|
||||
$('#leds_custom_save').attr("disabled", true);
|
||||
}
|
||||
|
||||
if ( window.readOnlyMode )
|
||||
{
|
||||
$('#leds_custom_save').attr('disabled', true);
|
||||
}
|
||||
}
|
||||
}, window.serverConfig.leds);
|
||||
|
||||
@@ -520,7 +575,13 @@ $(document).ready(function() {
|
||||
};
|
||||
|
||||
// change save button state based on validation result
|
||||
conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#btn_ma_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#leds_custom_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
// led controller sepecific wizards
|
||||
$('#btn_wiz_holder').html("");
|
||||
@@ -549,6 +610,12 @@ $(document).ready(function() {
|
||||
var atmoorb_title = 'wiz_atmoorb_title';
|
||||
changeWizard(data, atmoorb_title, startWizardAtmoOrb);
|
||||
}
|
||||
else if(ledType == "cololight") {
|
||||
var ledWizardType = (this.checked) ? "cololight" : ledType;
|
||||
var data = { type: ledWizardType };
|
||||
var cololight_title = 'wiz_cololight_title';
|
||||
changeWizard(data, cololight_title, startWizardCololight);
|
||||
}
|
||||
else if(ledType == "yeelight") {
|
||||
var ledWizardType = (this.checked) ? "yeelight" : ledType;
|
||||
var data = { type: ledWizardType };
|
||||
@@ -572,10 +639,10 @@ $(document).ready(function() {
|
||||
var devRPiPWM = ['ws281x'];
|
||||
var devRPiGPIO = ['piblaster'];
|
||||
|
||||
var devNET = ['atmoorb', 'fadecandy', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw', 'wled', 'yeelight'];
|
||||
var devNET = ['atmoorb', 'cololight', 'fadecandy', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw', 'wled', 'yeelight'];
|
||||
var devUSB = ['adalight', 'dmx', 'atmo', 'hyperionusbasp', 'lightpack', 'paintpack', 'rawhid', 'sedu', 'tpm2', 'karate'];
|
||||
|
||||
var optArr = [[]];
|
||||
var optArr = [[]];
|
||||
optArr[1]=[];
|
||||
optArr[2]=[];
|
||||
optArr[3]=[];
|
||||
|
||||
@@ -22,7 +22,7 @@ $(document).ready(function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
@@ -73,17 +73,32 @@ $(document).ready(function() {
|
||||
|
||||
//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\n';
|
||||
info += 'Distribution:'+sys.prettyName+'\n';
|
||||
info += 'Arch: '+sys.architecture+'\n';
|
||||
info += 'Kernel: '+sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))\n';
|
||||
info += 'Browser/OS: '+navigator.userAgent+'\n\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 += '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/OS: ' + navigator.userAgent + '\n\n';
|
||||
|
||||
//create prios
|
||||
info += "### PRIORITIES ### \n";
|
||||
|
||||
@@ -62,7 +62,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_net.on('change',function() {
|
||||
conf_editor_net.validate().length ? $('#btn_submit_net').attr('disabled', true) : $('#btn_submit_net').attr('disabled', false);
|
||||
conf_editor_net.validate().length || window.readOnlyMode ? $('#btn_submit_net').attr('disabled', true) : $('#btn_submit_net').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_net').off().on('click',function() {
|
||||
@@ -75,7 +75,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_json.on('change',function() {
|
||||
conf_editor_json.validate().length ? $('#btn_submit_jsonserver').attr('disabled', true) : $('#btn_submit_jsonserver').attr('disabled', false);
|
||||
conf_editor_json.validate().length || window.readOnlyMode ? $('#btn_submit_jsonserver').attr('disabled', true) : $('#btn_submit_jsonserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_jsonserver').off().on('click',function() {
|
||||
@@ -88,7 +88,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_fbs.on('change',function() {
|
||||
conf_editor_fbs.validate().length ? $('#btn_submit_fbserver').attr('disabled', true) : $('#btn_submit_fbserver').attr('disabled', false);
|
||||
conf_editor_fbs.validate().length || window.readOnlyMode ? $('#btn_submit_fbserver').attr('disabled', true) : $('#btn_submit_fbserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_fbserver').off().on('click',function() {
|
||||
@@ -101,7 +101,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_proto.on('change',function() {
|
||||
conf_editor_proto.validate().length ? $('#btn_submit_protoserver').attr('disabled', true) : $('#btn_submit_protoserver').attr('disabled', false);
|
||||
conf_editor_proto.validate().length || window.readOnlyMode ? $('#btn_submit_protoserver').attr('disabled', true) : $('#btn_submit_protoserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_protoserver').off().on('click',function() {
|
||||
@@ -114,7 +114,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_bobl.on('change',function() {
|
||||
conf_editor_bobl.validate().length ? $('#btn_submit_boblightserver').attr('disabled', true) : $('#btn_submit_boblightserver').attr('disabled', false);
|
||||
conf_editor_bobl.validate().length || window.readOnlyMode ? $('#btn_submit_boblightserver').attr('disabled', true) : $('#btn_submit_boblightserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_boblightserver').off().on('click',function() {
|
||||
@@ -129,7 +129,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_forw.on('change',function() {
|
||||
conf_editor_forw.validate().length ? $('#btn_submit_forwarder').attr('disabled', true) : $('#btn_submit_forwarder').attr('disabled', false);
|
||||
conf_editor_forw.validate().length || window.readOnlyMode ? $('#btn_submit_forwarder').attr('disabled', true) : $('#btn_submit_forwarder').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_forwarder').off().on('click',function() {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
}, true, true);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
|
||||
@@ -454,9 +454,9 @@ function requestAdjustment(type, value, complete)
|
||||
sendToHyperion("adjustment", "", '"adjustment": {"'+type+'": '+value+'}');
|
||||
}
|
||||
|
||||
async function requestLedDeviceDiscovery(type)
|
||||
async function requestLedDeviceDiscovery(type, params)
|
||||
{
|
||||
let data = { ledDeviceType: type };
|
||||
let data = { ledDeviceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("leddevice", "discover", data, Math.floor(Math.random() * 1000) );
|
||||
}
|
||||
@@ -471,8 +471,5 @@ async function requestLedDeviceProperties(type, params)
|
||||
function requestLedDeviceIdentification(type, params)
|
||||
{
|
||||
sendToHyperion("leddevice", "identify", '"ledDeviceType": "'+type+'","params": '+JSON.stringify(params)+'');
|
||||
|
||||
//let data = {ledDeviceType: type, params: params};
|
||||
//sendToHyperion("leddevice", "identify", data );
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ function changePassword(){
|
||||
});
|
||||
|
||||
$('#newPw, #oldPw').off().on('input',function(e) {
|
||||
($('#oldPw').val().length >= 8 && $('#newPw').val().length >= 8) ? $('#id_btn_ok').attr('disabled', false) : $('#id_btn_ok').attr('disabled', true);
|
||||
($('#oldPw').val().length >= 8 && $('#newPw').val().length >= 8) && !window.readOnlyMode ? $('#id_btn_ok').attr('disabled', false) : $('#id_btn_ok').attr('disabled', true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ function initLanguageSelection()
|
||||
for (var i = 0; i < availLang.length; i++)
|
||||
{
|
||||
$("#language-select").append('<option value="'+i+'" selected="">'+availLangText[i]+'</option>');
|
||||
}
|
||||
}
|
||||
|
||||
var langLocale = storedLang;
|
||||
|
||||
@@ -389,7 +389,7 @@ function showInfoDialog(type,header,message)
|
||||
|
||||
$(document).on('click', '[data-dismiss-modal]', function () {
|
||||
var target = $(this).attr('data-dismiss-modal');
|
||||
$(target).modal('hide');
|
||||
$.find(target).modal.hide();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ function createJsonEditor(container,schema,setconfig,usePanel,arrayre)
|
||||
{
|
||||
for(var key in editor.root.editors)
|
||||
{
|
||||
editor.getEditor("root."+key).setValue( window.serverConfig[key] );
|
||||
editor.getEditor("root."+key).setValue(Object.assign({}, editor.getEditor("root."+key).value, window.serverConfig[key] ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +109,13 @@ function beginWizardRGB() {
|
||||
if (redS == "r" && greenS == "g") {
|
||||
$('#btn_wiz_save').toggle(false);
|
||||
$('#btn_wiz_checkok').toggle(true);
|
||||
|
||||
window.readOnlyMode ? $('#btn_wiz_checkok').attr('disabled', true) : $('#btn_wiz_checkok').attr('disabled', false);
|
||||
}
|
||||
else {
|
||||
$('#btn_wiz_save').toggle(true);
|
||||
window.readOnlyMode ? $('#btn_wiz_save').attr('disabled', true) : $('#btn_wiz_save').attr('disabled', false);
|
||||
|
||||
$('#btn_wiz_checkok').toggle(false);
|
||||
}
|
||||
new_rgb_order = rgb_order;
|
||||
@@ -148,9 +152,11 @@ function beginWizardRGB() {
|
||||
$('#btn_wizard_byteorder').off().on('click', startWizardRGB);
|
||||
|
||||
//color calibration wizard
|
||||
|
||||
var kodiHost = document.location.hostname;
|
||||
var kodiPort = 9090;
|
||||
var kodiAddress = kodiHost;
|
||||
|
||||
var wiz_editor;
|
||||
var colorLength;
|
||||
var cobj;
|
||||
@@ -164,6 +170,7 @@ var picnr = 0;
|
||||
var availVideos = ["Sweet_Cocoon", "Caminandes_2_GranDillama", "Caminandes_3_Llamigos"];
|
||||
|
||||
if (getStorage("kodiAddress") != null) {
|
||||
|
||||
kodiAddress = getStorage("kodiAddress");
|
||||
[kodiHost, kodiPort] = kodiAddress.split(":", 2);
|
||||
|
||||
@@ -390,6 +397,7 @@ function performAction() {
|
||||
|
||||
$('#btn_wiz_next').attr("disabled", true);
|
||||
$('#btn_wiz_save').toggle(true);
|
||||
window.readOnlyMode ? $('#btn_wiz_save').attr('disabled', true) : $('#btn_wiz_save').attr('disabled', false);
|
||||
}
|
||||
else {
|
||||
$('#btn_wiz_next').attr("disabled", false);
|
||||
@@ -407,16 +415,16 @@ function updateWEditor(el, all) {
|
||||
}
|
||||
|
||||
function startWizardCC() {
|
||||
|
||||
// Ensure that Kodi's default REST-API port is not used, as now the Web-Socket port is used
|
||||
[kodiHost, kodiPort] = kodiAddress.split(":", 2);
|
||||
if (kodiPort === "8080") {
|
||||
kodiAddress = kodiHost;
|
||||
kodiPort = undefined;
|
||||
}
|
||||
|
||||
//create html
|
||||
$('#wiz_header').html('<i class="fa fa-magic fa-fw"></i>' + $.i18n('wiz_cc_title'));
|
||||
$('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">' + $.i18n('wiz_cc_title') + '</h4><p>' + $.i18n('wiz_cc_intro1') + '</p><label>' + $.i18n('wiz_cc_kwebs') + '</label><input class="form-control" style="width:170px;margin:auto" id="wiz_cc_kodiip" type="text" placeholder="' + kodiAddress + '" value="' + kodiAddress + '" /><span id="kodi_status"></span><span id="multi_cali"></span>');
|
||||
$('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">' + $.i18n('wiz_cc_title') + '</h4><p>' + $.i18n('wiz_cc_intro1') + '</p><label>' + $.i18n('wiz_cc_kwebs') + '</label><input class="form-control" style="width:170px;margin:auto" id="wiz_cc_kodiip" type="text" placeholder="' + kodiAddress + '" value="' + kodiAddress + '" /><span id="kodi_status"></span><span id="multi_cali"></span>');
|
||||
$('#wizp1_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_cont" disabled="disabled"><i class="fa fa-fw fa-check"></i>' + $.i18n('general_btn_continue') + '</button><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>' + $.i18n('general_btn_cancel') + '</button>');
|
||||
$('#wizp2_body').html('<div id="wiz_cc_desc" style="font-weight:bold"></div><div id="editor_container_wiz"></div>');
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_back"><i class="fa fa-fw fa-chevron-left"></i>' + $.i18n('general_btn_back') + '</button><button type="button" class="btn btn-primary" id="btn_wiz_next">' + $.i18n('general_btn_next') + '<i style="margin-left:4px;"class="fa fa-fw fa-chevron-right"></i></button><button type="button" class="btn btn-warning" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>' + $.i18n('general_btn_save') + '</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>' + $.i18n('general_btn_cancel') + '</button>');
|
||||
@@ -429,7 +437,10 @@ function startWizardCC() {
|
||||
});
|
||||
|
||||
$('#wiz_cc_kodiip').off().on('change', function () {
|
||||
|
||||
kodiAddress = $(this).val().trim();
|
||||
$('#wizp1_body').find("kodiAddress").val(kodiAddress);
|
||||
|
||||
$('#kodi_status').html('');
|
||||
|
||||
// Remove Kodi's default Web-Socket port (9090) from display and ensure Kodi's default REST-API port (8080) is mapped to web-socket port to ease migration
|
||||
@@ -579,6 +590,30 @@ function assignLightPos(id, pos, name) {
|
||||
return i;
|
||||
}
|
||||
|
||||
function getHostInLights(hostname) {
|
||||
return lights.filter(
|
||||
function (lights) {
|
||||
return lights.host === hostname
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getIpInLights(ip) {
|
||||
return lights.filter(
|
||||
function (lights) {
|
||||
return lights.ip === ip
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getIdInLights(id) {
|
||||
return lights.filter(
|
||||
function (lights) {
|
||||
return lights.id === id
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//****************************
|
||||
// Wizard Philips Hue
|
||||
//****************************
|
||||
@@ -792,17 +827,8 @@ async function getProperties_hue_bridge(hostAddress, username, resourceFilter) {
|
||||
}
|
||||
|
||||
function identify_hue_device(hostAddress, username, id) {
|
||||
console.log("identify_hue_device");
|
||||
|
||||
let params = { host: hostAddress, user: username, lightId: id };
|
||||
|
||||
const res = requestLedDeviceIdentification("philipshue", params);
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
console.log(r);
|
||||
}
|
||||
requestLedDeviceIdentification("philipshue", params);
|
||||
}
|
||||
|
||||
function getHueIPs() {
|
||||
@@ -1151,7 +1177,9 @@ function get_hue_lights() {
|
||||
cC++;
|
||||
}
|
||||
}
|
||||
(cC == 0) ? $('#btn_wiz_save').attr("disabled", true) : $('#btn_wiz_save').attr("disabled", false);
|
||||
|
||||
(cC == 0 || window.readOnlyMode) ? $('#btn_wiz_save').attr("disabled", true) : $('#btn_wiz_save').attr("disabled", false);
|
||||
|
||||
});
|
||||
}
|
||||
$('.hue_sel_watch').trigger('change');
|
||||
@@ -1263,14 +1291,7 @@ async function getProperties_wled(hostAddress, resourceFilter) {
|
||||
|
||||
function identify_wled(hostAddress) {
|
||||
let params = { host: hostAddress };
|
||||
|
||||
const res = requestLedDeviceIdentification("wled", params);
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
console.log(r);
|
||||
}
|
||||
requestLedDeviceIdentification("wled", params);
|
||||
}
|
||||
|
||||
//****************************
|
||||
@@ -1382,14 +1403,6 @@ function beginWizardYeelight() {
|
||||
$('#btn_wiz_abort').off().on('click', resetWizard);
|
||||
}
|
||||
|
||||
function getHostInLights(hostname) {
|
||||
return lights.filter(
|
||||
function (lights) {
|
||||
return lights.host === hostname
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function discover_yeelight_lights() {
|
||||
var light = {};
|
||||
// Get discovered lights
|
||||
@@ -1406,10 +1419,9 @@ async function discover_yeelight_lights() {
|
||||
|
||||
if (device.hostname !== "") {
|
||||
if (getHostInLights(device.hostname).length === 0) {
|
||||
light = {};
|
||||
var light = {};
|
||||
light.host = device.hostname;
|
||||
light.port = device.port;
|
||||
|
||||
light.name = device.other.name;
|
||||
light.model = device.other.model;
|
||||
lights.push(light);
|
||||
@@ -1427,7 +1439,7 @@ async function discover_yeelight_lights() {
|
||||
|
||||
if (host !== "")
|
||||
if (getHostInLights(host).length === 0) {
|
||||
light = {};
|
||||
var light = {};
|
||||
light.host = host;
|
||||
light.port = port;
|
||||
light.name = configuredLights[keyConfig].name;
|
||||
@@ -1446,7 +1458,7 @@ function assign_yeelight_lights() {
|
||||
// If records are left for configuration
|
||||
if (Object.keys(lights).length > 0) {
|
||||
$('#wh_topcontainer').toggle(false);
|
||||
$('#yee_ids_t,#btn_wiz_save').toggle(true);
|
||||
$('#yee_ids_t, #btn_wiz_save').toggle(true);
|
||||
|
||||
var lightOptions = [
|
||||
"top", "topleft", "topright",
|
||||
@@ -1478,7 +1490,7 @@ function assign_yeelight_lights() {
|
||||
options += '>' + $.i18n(txt + val) + '</option>';
|
||||
}
|
||||
|
||||
var enabled = 'enabled'
|
||||
var enabled = 'enabled';
|
||||
if (!models.includes(lights[lightid].model)) {
|
||||
var enabled = 'disabled';
|
||||
options = '<option value=disabled>' + $.i18n('wiz_yeelight_unsupported') + '</option>';
|
||||
@@ -1497,7 +1509,8 @@ function assign_yeelight_lights() {
|
||||
cC++;
|
||||
}
|
||||
}
|
||||
if (cC === 0)
|
||||
|
||||
if (cC === 0 || window.readOnlyMode)
|
||||
$('#btn_wiz_save').attr("disabled", true);
|
||||
else
|
||||
$('#btn_wiz_save').attr("disabled", false);
|
||||
@@ -1505,7 +1518,7 @@ function assign_yeelight_lights() {
|
||||
$('.yee_sel_watch').trigger('change');
|
||||
}
|
||||
else {
|
||||
var noLightsTxt = '<p style="font-weight:bold;color:red;">' + $.i18n('wiz_yeelight_noLights') + '</p>';
|
||||
var noLightsTxt = '<p style="font-weight:bold;color:red;">' + $.i18n('wiz_noLights','Yeelights') + '</p>';
|
||||
$('#wizp2_body').append(noLightsTxt);
|
||||
}
|
||||
}
|
||||
@@ -1527,13 +1540,7 @@ async function getProperties_yeelight(hostname, port) {
|
||||
|
||||
function identify_yeelight_device(hostname, port) {
|
||||
let params = { hostname: hostname, port: port };
|
||||
|
||||
const res = requestLedDeviceIdentification("yeelight", params);
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
//const r = res.info;
|
||||
}
|
||||
requestLedDeviceIdentification("yeelight", params);
|
||||
}
|
||||
|
||||
//****************************
|
||||
@@ -1580,7 +1587,7 @@ function beginWizardAtmoOrb() {
|
||||
lights = [];
|
||||
configuredLights = [];
|
||||
|
||||
configruedOrbIds = conf_editor.getEditor("root.specificOptions.orbIds").getValue().trim();
|
||||
var configruedOrbIds = conf_editor.getEditor("root.specificOptions.orbIds").getValue().trim();
|
||||
if (configruedOrbIds.length !== 0) {
|
||||
configuredLights = configruedOrbIds.split(",").map(Number);
|
||||
}
|
||||
@@ -1640,24 +1647,19 @@ function beginWizardAtmoOrb() {
|
||||
$('#btn_wiz_abort').off().on('click', resetWizard);
|
||||
}
|
||||
|
||||
function getIdInLights(id) {
|
||||
return lights.filter(
|
||||
function (lights) {
|
||||
return lights.id === id
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function discover_atmoorb_lights(multiCastGroup, multiCastPort) {
|
||||
var light = {};
|
||||
|
||||
if (multiCastGroup === "")
|
||||
multiCastGroup = "239.255.255.250";
|
||||
var params = {};
|
||||
if (multiCastGroup !== "")
|
||||
{
|
||||
params.multiCastGroup = multiCastGroup;
|
||||
}
|
||||
|
||||
if (multiCastPort === "")
|
||||
multiCastPort = 49692;
|
||||
|
||||
let params = { multiCastGroup: multiCastGroup, multiCastPort: multiCastPort };
|
||||
if (multiCastPort !== 0)
|
||||
{
|
||||
params.multiCastPort = multiCastPort;
|
||||
}
|
||||
|
||||
// Get discovered lights
|
||||
const res = await requestLedDeviceDiscovery('atmoorb', params);
|
||||
@@ -1665,13 +1667,13 @@ async function discover_atmoorb_lights(multiCastGroup, multiCastPort) {
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
|
||||
const r = res.info;
|
||||
|
||||
// Process devices returned by discovery
|
||||
for (const device of r.devices) {
|
||||
if (device.id !== "") {
|
||||
if (getIdInLights(device.id).length === 0) {
|
||||
light = {};
|
||||
var light = {};
|
||||
light.id = device.id;
|
||||
light.ip = device.ip;
|
||||
light.host = device.hostname;
|
||||
@@ -1684,7 +1686,7 @@ async function discover_atmoorb_lights(multiCastGroup, multiCastPort) {
|
||||
for (const keyConfig in configuredLights) {
|
||||
if (configuredLights[keyConfig] !== "" && !isNaN(configuredLights[keyConfig])) {
|
||||
if (getIdInLights(configuredLights[keyConfig]).length === 0) {
|
||||
light = {};
|
||||
var light = {};
|
||||
light.id = configuredLights[keyConfig];
|
||||
light.ip = "";
|
||||
light.host = "";
|
||||
@@ -1735,9 +1737,9 @@ function assign_atmoorb_lights() {
|
||||
options += '>' + $.i18n(txt + val) + '</option>';
|
||||
}
|
||||
|
||||
var enabled = 'enabled'
|
||||
var enabled = 'enabled';
|
||||
if (orbId < 1 || orbId > 255) {
|
||||
enabled = 'disabled'
|
||||
enabled = 'disabled';
|
||||
options = '<option value=disabled>' + $.i18n('wiz_atmoorb_unsupported') + '</option>';
|
||||
}
|
||||
|
||||
@@ -1759,7 +1761,7 @@ function assign_atmoorb_lights() {
|
||||
cC++;
|
||||
}
|
||||
}
|
||||
if (cC === 0)
|
||||
if (cC === 0 || window.readOnlyMode)
|
||||
$('#btn_wiz_save').attr("disabled", true);
|
||||
else
|
||||
$('#btn_wiz_save').attr("disabled", false);
|
||||
@@ -1767,20 +1769,14 @@ function assign_atmoorb_lights() {
|
||||
$('.orb_sel_watch').trigger('change');
|
||||
}
|
||||
else {
|
||||
var noLightsTxt = '<p style="font-weight:bold;color:red;">' + $.i18n('wiz_atmoorb_noLights') + '</p>';
|
||||
var noLightsTxt = '<p style="font-weight:bold;color:red;">' + $.i18n('wiz_noLights','AtmoOrbs') + '</p>';
|
||||
$('#wizp2_body').append(noLightsTxt);
|
||||
}
|
||||
}
|
||||
|
||||
function identify_atmoorb_device(orbId) {
|
||||
let params = { id: orbId };
|
||||
|
||||
const res = requestLedDeviceIdentification("atmoorb", params);
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
}
|
||||
requestLedDeviceIdentification("atmoorb", params);
|
||||
}
|
||||
|
||||
//****************************
|
||||
@@ -1829,16 +1825,197 @@ async function getProperties_nanoleaf(hostAddress, authToken, resourceFilter) {
|
||||
|
||||
function identify_nanoleaf(hostAddress, authToken) {
|
||||
let params = { host: hostAddress, token: authToken };
|
||||
requestLedDeviceIdentification("nanoleaf", params);
|
||||
}
|
||||
|
||||
//****************************
|
||||
// Wizard Cololight
|
||||
//****************************
|
||||
var lights = null;
|
||||
var selectedLightId = null;
|
||||
|
||||
function startWizardCololight(e) {
|
||||
//create html
|
||||
|
||||
var cololight_title = 'wiz_cololight_title';
|
||||
var cololight_intro1 = 'wiz_cololight_intro1';
|
||||
|
||||
$('#wiz_header').html('<i class="fa fa-magic fa-fw"></i>' + $.i18n(cololight_title));
|
||||
$('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">' + $.i18n(cololight_title) + '</h4><p>' + $.i18n(cololight_intro1) + '</p>');
|
||||
$('#wizp1_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_cont"><i class="fa fa-fw fa-check"></i>' + $.i18n('general_btn_continue') + '</button><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>' + $.i18n('general_btn_cancel') + '</button>');
|
||||
|
||||
$('#wizp2_body').html('<div id="wh_topcontainer"></div>');
|
||||
|
||||
$('#wh_topcontainer').append('<div class="form-group" id="usrcont" style="display:none"></div>');
|
||||
|
||||
$('#wizp2_body').append('<div id="colo_ids_t" style="display:none"><p style="font-weight:bold" id="colo_id_headline">' + $.i18n('wiz_cololight_desc2') + '</p></div>');
|
||||
|
||||
createTable("lidsh", "lidsb", "colo_ids_t");
|
||||
$('.lidsh').append(createTableRow([$.i18n('edt_dev_spec_lights_title'), $.i18n('wiz_identify')], true));
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'
|
||||
+ $.i18n('general_btn_save') + '</button><buttowindow.serverConfig.device = d;n type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'
|
||||
+ $.i18n('general_btn_cancel') + '</button>');
|
||||
|
||||
//open modal
|
||||
$("#wizard_modal").modal({
|
||||
backdrop: "static",
|
||||
keyboard: false,
|
||||
show: true
|
||||
});
|
||||
|
||||
//listen for continue
|
||||
$('#btn_wiz_cont').off().on('click', function () {
|
||||
beginWizardCololight();
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(true);
|
||||
});
|
||||
}
|
||||
|
||||
function beginWizardCololight() {
|
||||
lights = [];
|
||||
|
||||
discover_cololights();
|
||||
|
||||
$('#btn_wiz_save').off().on("click", function () {
|
||||
//LED device config
|
||||
//Start with a clean configuration
|
||||
var d = {};
|
||||
|
||||
d.type = 'cololight';
|
||||
|
||||
//Cololight does not resolve into stable hostnames (as devices named the same), therefore use IP
|
||||
if (!lights[selectedLightId].ip) {
|
||||
d.host = lights[selectedLightId].host;
|
||||
} else {
|
||||
d.host = lights[selectedLightId].ip;
|
||||
}
|
||||
|
||||
var coloLightProperties = lights[selectedLightId].props;
|
||||
if (Object.keys(coloLightProperties).length === 0) {
|
||||
alert($.i18n('wiz_cololight_noprops'));
|
||||
d.hardwareLedCount = 1;
|
||||
} else {
|
||||
if (coloLightProperties.ledCount > 0) {
|
||||
d.hardwareLedCount = coloLightProperties.ledCount;
|
||||
} else if (coloLightProperties.modelType === "Strip")
|
||||
d.hardwareLedCount = 120;
|
||||
}
|
||||
|
||||
d.colorOrder = conf_editor.getEditor("root.generalOptions.colorOrder").getValue();
|
||||
d.latchTime = parseInt(conf_editor.getEditor("root.specificOptions.latchTime").getValue());;
|
||||
|
||||
window.serverConfig.device = d;
|
||||
|
||||
//LED layout - have initial layout prepared matching the LED-count
|
||||
|
||||
var coloLightLedConfig = [];
|
||||
|
||||
if (coloLightProperties.modelType === "Strip") {
|
||||
coloLightLedConfig = createClassicLedLayoutSimple(d.hardwareLedCount / 2, d.hardwareLedCount / 4, d.hardwareLedCount / 4, 0, d.hardwareLedCount / 4 * 3, false);
|
||||
} else {
|
||||
coloLightLedConfig = createClassicLedLayoutSimple(0, 0, 0, d.hardwareLedCount, 0, true);
|
||||
}
|
||||
|
||||
window.serverConfig.leds = coloLightLedConfig;
|
||||
|
||||
//smoothing off
|
||||
window.serverConfig.smoothing.enable = false;
|
||||
|
||||
requestWriteConfig(window.serverConfig, true);
|
||||
|
||||
resetWizard();
|
||||
});
|
||||
|
||||
$('#btn_wiz_abort').off().on('click', resetWizard);
|
||||
}
|
||||
|
||||
async function discover_cololights() {
|
||||
const res = await requestLedDeviceDiscovery('cololight');
|
||||
|
||||
const res = requestLedDeviceIdentification("nanoleaf", params);
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
console.log(r);
|
||||
const r = res.info;
|
||||
|
||||
// Process devices returned by discovery
|
||||
for (const device of r.devices) {
|
||||
if (device.ip !== "") {
|
||||
if (getIpInLights(device.ip).length === 0) {
|
||||
var light = {};
|
||||
light.ip = device.ip;
|
||||
light.host = device.hostname;
|
||||
light.name = device.name;
|
||||
light.type = device.type;
|
||||
lights.push(light);
|
||||
}
|
||||
}
|
||||
}
|
||||
assign_cololight_lights();
|
||||
}
|
||||
}
|
||||
|
||||
function assign_cololight_lights() {
|
||||
// If records are left for configuration
|
||||
if (Object.keys(lights).length > 0) {
|
||||
$('#wh_topcontainer').toggle(false);
|
||||
$('#colo_ids_t, #btn_wiz_save').toggle(true);
|
||||
|
||||
$('.lidsb').html("");
|
||||
|
||||
var options = "";
|
||||
|
||||
for (var lightid in lights) {
|
||||
lights[lightid].id = lightid;
|
||||
|
||||
var lightHostname = lights[lightid].host;
|
||||
var lightIP = lights[lightid].ip;
|
||||
|
||||
var val = lightHostname + " (" + lightIP + ")";
|
||||
options += '<option value="' + lightid + '">' + val + '</option>';
|
||||
}
|
||||
|
||||
var enabled = 'enabled';
|
||||
|
||||
$('.lidsb').append(createTableRow(['<select id="colo_select_id" ' + enabled + ' class="colo_sel_watch form-control">'
|
||||
+ options
|
||||
+ '</select>', '<button id="wiz_identify_btn" class="btn btn-sm btn-primary">'
|
||||
+ $.i18n('wiz_identify') + '</button>']));
|
||||
|
||||
$('.colo_sel_watch').bind("change", function () {
|
||||
selectedLightId = $('#colo_select_id').val();
|
||||
var lightIP = lights[selectedLightId].ip;
|
||||
|
||||
$('#wiz_identify_btn').unbind().bind('click', function (event) { identify_cololight_device(lightIP); });
|
||||
|
||||
if (!lights[selectedLightId].props) {
|
||||
getProperties_cololight(lightIP);
|
||||
}
|
||||
});
|
||||
$('.colo_sel_watch').trigger('change');
|
||||
}
|
||||
else {
|
||||
var noLightsTxt = '<p style="font-weight:bold;color:red;">' + $.i18n('wiz_noLights','Cololights') + '</p>';
|
||||
$('#wizp2_body').append(noLightsTxt);
|
||||
}
|
||||
}
|
||||
|
||||
async function getProperties_cololight(ip) {
|
||||
let params = { host: ip };
|
||||
|
||||
const res = await requestLedDeviceProperties('cololight', params);
|
||||
|
||||
if (res && !res.error) {
|
||||
var coloLightProperties = res.info;
|
||||
|
||||
//Store properties along light with given IP-address
|
||||
var id = getIpInLights(ip)[0].id;
|
||||
lights[id].props = coloLightProperties;
|
||||
}
|
||||
}
|
||||
|
||||
function identify_cololight_device(hostAddress) {
|
||||
let params = { host: hostAddress };
|
||||
requestLedDeviceIdentification("cololight", params);
|
||||
}
|
||||
|
||||
//****************************
|
||||
// Wizard/Routines RS232-Devices
|
||||
//****************************
|
||||
@@ -1860,7 +2037,6 @@ async function discover_providerRs232(rs232Type) {
|
||||
//****************************
|
||||
async function discover_providerHid(hidType) {
|
||||
const res = await requestLedDeviceDiscovery(hidType);
|
||||
console.log("discover_providerHid", res);
|
||||
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
|
||||
Reference in New Issue
Block a user