Streamline API calls from UI (incl. Fix #1311, #1314) (#1312)

* 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:
LordGrey
2021-08-31 10:55:32 +02:00
committed by GitHub
parent 42e7f85864
commit 12cdd1d58a
7 changed files with 70 additions and 48 deletions

View File

@@ -1,5 +1,3 @@
var instNameInit = false
$(document).ready(function () {
var darkModeOverwrite = getStorage("darkModeOverwrite", true);
@@ -27,8 +25,6 @@ $(document).ready(function () {
// comps
window.comps = event.response.info.components
$(window.hyperion).trigger("ready");
window.comps.forEach(function (obj) {
if (obj.name == "ALL") {
if (obj.enabled)
@@ -44,12 +40,6 @@ $(document).ready(function () {
$('#btn_hypinstanceswitch').toggle(true)
else
$('#btn_hypinstanceswitch').toggle(false)
// update listing at button
updateHyperionInstanceListing()
if (!instNameInit) {
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
instNameInit = true;
}
updateSessions();
}); // end cmd-serverinfo
@@ -112,11 +102,9 @@ $(document).ready(function () {
$(window.hyperion).one("cmd-authorize-getTokenList", function (event) {
tokenList = event.response.info;
requestServerInfo();
});
$(window.hyperion).on("cmd-sysinfo", function (event) {
requestServerInfo();
window.sysInfo = event.response.info;
window.currentVersion = window.sysInfo.hyperion.version;
@@ -126,16 +114,22 @@ $(document).ready(function () {
$(window.hyperion).one("cmd-config-getschema", function (event) {
window.serverSchema = event.response.info;
requestServerConfig();
window.schema = window.serverSchema.properties;
requestTokenInfo();
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.serverConfig = event.response.info;
requestSysInfo();
window.showOptHelp = window.serverConfig.general.showOptHelp;
});
@@ -163,6 +157,8 @@ $(document).ready(function () {
if (event.response.hasOwnProperty('info'))
setStorage("loginToken", event.response.info.token, true);
requestSysInfo();
requestServerInfo();
requestServerConfigSchema();
});