mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
* JSONeditor: Disable watchers when updating selections dynamically * Refactor - Load last instance config when loading UI page * LED Devices - Notify getproperties watchers for configured hostname * Remove unused variable * Fix #1314 - Additional classic & matrix configuration items were not saved
This commit is contained in:
parent
42e7f85864
commit
12cdd1d58a
@ -9,7 +9,8 @@
|
|||||||
"name": "Run hyperion with debug option and external console",
|
"name": "Run hyperion with debug option and external console",
|
||||||
"args": [
|
"args": [
|
||||||
"-d",
|
"-d",
|
||||||
"-c"
|
"-c",
|
||||||
|
"-u test"
|
||||||
],
|
],
|
||||||
"externalConsole": true
|
"externalConsole": true
|
||||||
}
|
}
|
||||||
|
BIN
assets/webconfig/js/20210820_LoadInstanceConfig.zip
Normal file
BIN
assets/webconfig/js/20210820_LoadInstanceConfig.zip
Normal file
Binary file not shown.
@ -1,5 +1,3 @@
|
|||||||
var instNameInit = false
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var darkModeOverwrite = getStorage("darkModeOverwrite", true);
|
var darkModeOverwrite = getStorage("darkModeOverwrite", true);
|
||||||
|
|
||||||
@ -27,8 +25,6 @@ $(document).ready(function () {
|
|||||||
// comps
|
// comps
|
||||||
window.comps = event.response.info.components
|
window.comps = event.response.info.components
|
||||||
|
|
||||||
$(window.hyperion).trigger("ready");
|
|
||||||
|
|
||||||
window.comps.forEach(function (obj) {
|
window.comps.forEach(function (obj) {
|
||||||
if (obj.name == "ALL") {
|
if (obj.name == "ALL") {
|
||||||
if (obj.enabled)
|
if (obj.enabled)
|
||||||
@ -44,12 +40,6 @@ $(document).ready(function () {
|
|||||||
$('#btn_hypinstanceswitch').toggle(true)
|
$('#btn_hypinstanceswitch').toggle(true)
|
||||||
else
|
else
|
||||||
$('#btn_hypinstanceswitch').toggle(false)
|
$('#btn_hypinstanceswitch').toggle(false)
|
||||||
// update listing at button
|
|
||||||
updateHyperionInstanceListing()
|
|
||||||
if (!instNameInit) {
|
|
||||||
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
|
|
||||||
instNameInit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSessions();
|
updateSessions();
|
||||||
}); // end cmd-serverinfo
|
}); // end cmd-serverinfo
|
||||||
@ -112,11 +102,9 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$(window.hyperion).one("cmd-authorize-getTokenList", function (event) {
|
$(window.hyperion).one("cmd-authorize-getTokenList", function (event) {
|
||||||
tokenList = event.response.info;
|
tokenList = event.response.info;
|
||||||
requestServerInfo();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window.hyperion).on("cmd-sysinfo", function (event) {
|
$(window.hyperion).on("cmd-sysinfo", function (event) {
|
||||||
requestServerInfo();
|
|
||||||
window.sysInfo = event.response.info;
|
window.sysInfo = event.response.info;
|
||||||
|
|
||||||
window.currentVersion = window.sysInfo.hyperion.version;
|
window.currentVersion = window.sysInfo.hyperion.version;
|
||||||
@ -126,16 +114,22 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$(window.hyperion).one("cmd-config-getschema", function (event) {
|
$(window.hyperion).one("cmd-config-getschema", function (event) {
|
||||||
window.serverSchema = event.response.info;
|
window.serverSchema = event.response.info;
|
||||||
requestServerConfig();
|
window.schema = window.serverSchema.properties;
|
||||||
|
|
||||||
requestTokenInfo();
|
requestTokenInfo();
|
||||||
requestGetPendingTokenRequests();
|
requestGetPendingTokenRequests();
|
||||||
|
|
||||||
window.schema = window.serverSchema.properties;
|
//Switch to last selected instance and load related config
|
||||||
|
var lastSelectedInstance = getStorage('lastSelectedInstance', false);
|
||||||
|
if (!window.serverInfo.instance[lastSelectedInstance]) {
|
||||||
|
lastSelectedInstance = 0;
|
||||||
|
}
|
||||||
|
instanceSwitch(lastSelectedInstance);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
||||||
window.serverConfig = event.response.info;
|
window.serverConfig = event.response.info;
|
||||||
requestSysInfo();
|
|
||||||
|
|
||||||
window.showOptHelp = window.serverConfig.general.showOptHelp;
|
window.showOptHelp = window.serverConfig.general.showOptHelp;
|
||||||
});
|
});
|
||||||
@ -163,6 +157,8 @@ $(document).ready(function () {
|
|||||||
if (event.response.hasOwnProperty('info'))
|
if (event.response.hasOwnProperty('info'))
|
||||||
setStorage("loginToken", event.response.info.token, true);
|
setStorage("loginToken", event.response.info.token, true);
|
||||||
|
|
||||||
|
requestSysInfo();
|
||||||
|
requestServerInfo();
|
||||||
requestServerConfigSchema();
|
requestServerConfigSchema();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -383,22 +383,24 @@ function blackListLeds(nonBlacklistLedArray, blackList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLedConfig() {
|
function getLedConfig() {
|
||||||
var ledConfig = { classic: {}, matrix: {} };
|
|
||||||
var slConfig = window.serverConfig.ledConfig;
|
|
||||||
|
|
||||||
for (var key in slConfig.classic) {
|
var ledConfig = { classic: {}, matrix: {} };
|
||||||
if (typeof (slConfig.classic[key]) === "boolean")
|
|
||||||
|
var classicSchema = window.serverSchema.properties.ledConfig.properties.classic.properties;
|
||||||
|
for (var key in classicSchema) {
|
||||||
|
if (classicSchema[key].type === "boolean")
|
||||||
ledConfig.classic[key] = $('#ip_cl_' + key).is(':checked');
|
ledConfig.classic[key] = $('#ip_cl_' + key).is(':checked');
|
||||||
else if (Number.isInteger(slConfig.classic[key]))
|
else if (classicSchema[key].type === "integer")
|
||||||
ledConfig.classic[key] = parseInt($('#ip_cl_' + key).val());
|
ledConfig.classic[key] = parseInt($('#ip_cl_' + key).val());
|
||||||
else
|
else
|
||||||
ledConfig.classic[key] = $('#ip_cl_' + key).val();
|
ledConfig.classic[key] = $('#ip_cl_' + key).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var key in slConfig.matrix) {
|
var matrixSchema = window.serverSchema.properties.ledConfig.properties.matrix.properties;
|
||||||
if (typeof (slConfig.matrix[key]) === "boolean")
|
for (var key in matrixSchema) {
|
||||||
|
if (matrixSchema[key].type === "boolean")
|
||||||
ledConfig.matrix[key] = $('#ip_ma_' + key).is(':checked');
|
ledConfig.matrix[key] = $('#ip_ma_' + key).is(':checked');
|
||||||
else if (Number.isInteger(slConfig.matrix[key]))
|
else if (matrixSchema[key].type === "integer")
|
||||||
ledConfig.matrix[key] = parseInt($('#ip_ma_' + key).val());
|
ledConfig.matrix[key] = parseInt($('#ip_ma_' + key).val());
|
||||||
else
|
else
|
||||||
ledConfig.matrix[key] = $('#ip_ma_' + key).val();
|
ledConfig.matrix[key] = $('#ip_ma_' + key).val();
|
||||||
@ -876,6 +878,8 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
case 'NONE':
|
case 'NONE':
|
||||||
conf_editor.getEditor(specOptPath + "host").enable();
|
conf_editor.getEditor(specOptPath + "host").enable();
|
||||||
|
//Trigger getProperties via host value
|
||||||
|
conf_editor.notifyWatchers(specOptPath + "host");
|
||||||
break;
|
break;
|
||||||
case 'SELECT':
|
case 'SELECT':
|
||||||
conf_editor.getEditor(specOptPath + "host").setValue("");
|
conf_editor.getEditor(specOptPath + "host").setValue("");
|
||||||
@ -884,9 +888,8 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
conf_editor.getEditor(specOptPath + "host").disable();
|
conf_editor.getEditor(specOptPath + "host").disable();
|
||||||
//Reset host value, to trigger getProperties via host value
|
//Trigger getProperties via host value
|
||||||
conf_editor.getEditor(specOptPath + "host").setValue("");
|
conf_editor.notifyWatchers(specOptPath + "host");
|
||||||
conf_editor.getEditor(specOptPath + "host").setValue(val);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1510,10 +1513,10 @@ async function getProperties_device(ledType, key, params) {
|
|||||||
if (!devicesProperties[ledType][key]) {
|
if (!devicesProperties[ledType][key]) {
|
||||||
const res = await requestLedDeviceProperties(ledType, params);
|
const res = await requestLedDeviceProperties(ledType, params);
|
||||||
if (res && !res.error) {
|
if (res && !res.error) {
|
||||||
var deviceProperties = res.info.properties;
|
var ledDeviceProperties = res.info.properties;
|
||||||
|
|
||||||
if (!jQuery.isEmptyObject(deviceProperties)) {
|
if (!jQuery.isEmptyObject(ledDeviceProperties)) {
|
||||||
devicesProperties[ledType][key] = deviceProperties;
|
devicesProperties[ledType][key] = ledDeviceProperties;
|
||||||
|
|
||||||
if (!window.readOnlyMode) {
|
if (!window.readOnlyMode) {
|
||||||
$('#btn_submit_controller').attr('disabled', false);
|
$('#btn_submit_controller').attr('disabled', false);
|
||||||
|
@ -128,12 +128,13 @@ function getInstanceNameByIndex(index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateHyperionInstanceListing() {
|
function updateHyperionInstanceListing() {
|
||||||
var data = window.serverInfo.instance.filter(entry => entry.running);
|
if (window.serverInfo.instance) {
|
||||||
$('#hyp_inst_listing').html("");
|
var data = window.serverInfo.instance.filter(entry => entry.running);
|
||||||
for (var key in data) {
|
$('#hyp_inst_listing').html("");
|
||||||
var currInstMarker = (data[key].instance == window.currentHyperionInstance) ? "component-on" : "";
|
for (var key in data) {
|
||||||
|
var currInstMarker = (data[key].instance == window.currentHyperionInstance) ? "component-on" : "";
|
||||||
|
|
||||||
var html = '<li id="hyperioninstance_' + data[key].instance + '"> \
|
var html = '<li id="hyperioninstance_' + data[key].instance + '"> \
|
||||||
<a> \
|
<a> \
|
||||||
<div> \
|
<div> \
|
||||||
<i class="fa fa-circle fa-fw '+ currInstMarker + '"></i> \
|
<i class="fa fa-circle fa-fw '+ currInstMarker + '"></i> \
|
||||||
@ -142,15 +143,16 @@ function updateHyperionInstanceListing() {
|
|||||||
</a> \
|
</a> \
|
||||||
</li> '
|
</li> '
|
||||||
|
|
||||||
if (data.length - 1 > key)
|
if (data.length - 1 > key)
|
||||||
html += '<li class="divider"></li>'
|
html += '<li class="divider"></li>'
|
||||||
|
|
||||||
$('#hyp_inst_listing').append(html);
|
$('#hyp_inst_listing').append(html);
|
||||||
|
|
||||||
$('#hyperioninstance_' + data[key].instance).off().on("click", function (e) {
|
$('#hyperioninstance_' + data[key].instance).off().on("click", function (e) {
|
||||||
var inst = e.currentTarget.id.split("_")[1]
|
var inst = e.currentTarget.id.split("_")[1]
|
||||||
instanceSwitch(inst)
|
instanceSwitch(inst)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,8 +293,8 @@ function showInfoDialog(type, header, message) {
|
|||||||
$('#id_body_rename').append('<div class="row"><div class="col-md-4"><p class="text-left">' + $.i18n('infoDialog_username_text') +
|
$('#id_body_rename').append('<div class="row"><div class="col-md-4"><p class="text-left">' + $.i18n('infoDialog_username_text') +
|
||||||
'</p></div><div class="col-md-8"><input class="form-control" id="username" type="text" value="Hyperion" disabled></div></div><br>');
|
'</p></div><div class="col-md-8"><input class="form-control" id="username" type="text" value="Hyperion" disabled></div></div><br>');
|
||||||
$('#id_body_rename').append('<div class="row"><div class="col-md-4"><p class="text-left">' + $.i18n('infoDialog_password_current_text') +
|
$('#id_body_rename').append('<div class="row"><div class="col-md-4"><p class="text-left">' + $.i18n('infoDialog_password_current_text') +
|
||||||
'</p></div><div class="col-md-8"><input class="form-control" id="current-password" placeholder="Old" type="password" autocomplete="current-password"></div></div><br>');
|
'</p></div><div class="col-md-8"><input class="form-control" id="current-password" placeholder="Old" type="password" autocomplete="current-password"></div></div><br>');
|
||||||
$('#id_body_rename').append('<div class="row"><div class="col-md-4"><p class="text-left">' + $.i18n('infoDialog_password_new_text')+
|
$('#id_body_rename').append('<div class="row"><div class="col-md-4"><p class="text-left">' + $.i18n('infoDialog_password_new_text') +
|
||||||
'</p></div><div class="col-md-8"><input class="form-control" id="new-password" placeholder="New" type="password" autocomplete="new-password"></div></div>');
|
'</p></div><div class="col-md-8"><input class="form-control" id="new-password" placeholder="New" type="password" autocomplete="new-password"></div></div>');
|
||||||
$('#id_body_rename').append('<div class="bs-callout bs-callout-info"><span>' + $.i18n('infoDialog_password_minimum_length') + '</span></div>');
|
$('#id_body_rename').append('<div class="bs-callout bs-callout-info"><span>' + $.i18n('infoDialog_password_minimum_length') + '</span></div>');
|
||||||
$('#id_footer_rename').html('<button type="button" id="id_btn_ok" class="btn btn-success" data-dismiss-modal="#modal_dialog_rename" disabled><i class="fa fa-fw fa-save"></i>' + $.i18n('general_btn_ok') + '</button></div>');
|
$('#id_footer_rename').html('<button type="button" id="id_btn_ok" class="btn btn-success" data-dismiss-modal="#modal_dialog_rename" disabled><i class="fa fa-fw fa-save"></i>' + $.i18n('general_btn_ok') + '</button></div>');
|
||||||
@ -469,6 +471,9 @@ function updateJsonEditorSelection(rootEditor, path, key, addElements, newEnumVa
|
|||||||
var editor = rootEditor.getEditor(path);
|
var editor = rootEditor.getEditor(path);
|
||||||
var orginalProperties = editor.schema.properties[key];
|
var orginalProperties = editor.schema.properties[key];
|
||||||
|
|
||||||
|
var orginalWatchFunctions = rootEditor.watchlist[path + "." + key];
|
||||||
|
rootEditor.unwatch(path + "." + key);
|
||||||
|
|
||||||
var newSchema = [];
|
var newSchema = [];
|
||||||
newSchema[key] =
|
newSchema[key] =
|
||||||
{
|
{
|
||||||
@ -546,12 +551,22 @@ function updateJsonEditorSelection(rootEditor, path, key, addElements, newEnumVa
|
|||||||
editor.removeObjectProperty(key);
|
editor.removeObjectProperty(key);
|
||||||
delete editor.cached_editors[key];
|
delete editor.cached_editors[key];
|
||||||
editor.addObjectProperty(key);
|
editor.addObjectProperty(key);
|
||||||
|
|
||||||
|
if (orginalWatchFunctions) {
|
||||||
|
for (var i = 0; i < orginalWatchFunctions.length; i++) {
|
||||||
|
rootEditor.watch(path + "." + key, orginalWatchFunctions[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootEditor.notifyWatchers(path + "." + key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateJsonEditorMultiSelection(rootEditor, path, key, addElements, newEnumVals, newTitelVals, newDefaultVal) {
|
function updateJsonEditorMultiSelection(rootEditor, path, key, addElements, newEnumVals, newTitelVals, newDefaultVal) {
|
||||||
var editor = rootEditor.getEditor(path);
|
var editor = rootEditor.getEditor(path);
|
||||||
var orginalProperties = editor.schema.properties[key];
|
var orginalProperties = editor.schema.properties[key];
|
||||||
|
|
||||||
|
var orginalWatchFunctions = rootEditor.watchlist[path + "." + key];
|
||||||
|
rootEditor.unwatch(path + "." + key);
|
||||||
|
|
||||||
var newSchema = [];
|
var newSchema = [];
|
||||||
newSchema[key] =
|
newSchema[key] =
|
||||||
{
|
{
|
||||||
@ -605,6 +620,13 @@ function updateJsonEditorMultiSelection(rootEditor, path, key, addElements, newE
|
|||||||
editor.removeObjectProperty(key);
|
editor.removeObjectProperty(key);
|
||||||
delete editor.cached_editors[key];
|
delete editor.cached_editors[key];
|
||||||
editor.addObjectProperty(key);
|
editor.addObjectProperty(key);
|
||||||
|
|
||||||
|
if (orginalWatchFunctions) {
|
||||||
|
for (var i = 0; i < orginalWatchFunctions.length; i++) {
|
||||||
|
rootEditor.watch(path + "." + key, orginalWatchFunctions[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootEditor.notifyWatchers(path + "." + key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateJsonEditorRange(rootEditor, path, key, minimum, maximum, defaultValue, step, clear) {
|
function updateJsonEditorRange(rootEditor, path, key, minimum, maximum, defaultValue, step, clear) {
|
||||||
|
2
dependencies/external/rpi_ws281x
vendored
2
dependencies/external/rpi_ws281x
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5d0041eba608e3a52aa637122a72396d3336d91b
|
Subproject commit 3a20f1bdd740a144de180a07d8d3317920459d2d
|
@ -10,7 +10,7 @@
|
|||||||
// Constants
|
// Constants
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const bool verbose = false;
|
const bool verbose = true;
|
||||||
|
|
||||||
// Configuration settings
|
// Configuration settings
|
||||||
const char CONFIG_ADDRESS[] = "host";
|
const char CONFIG_ADDRESS[] = "host";
|
||||||
|
Loading…
Reference in New Issue
Block a user