Refactor config API

This commit is contained in:
LordGrey
2024-08-01 23:07:18 +02:00
parent 4a5b0b6bf2
commit c86af5ce79
42 changed files with 1605 additions and 889 deletions

View File

@@ -37,9 +37,8 @@ const ENDLESS = -1;
function initRestart()
{
$(window.hyperion).off();
requestServerConfigReload();
window.watchdog = 10;
connectionLostDetection('restart');
connectionLostDetection('restart');
}
function connectionLostDetection(type)
@@ -138,9 +137,10 @@ function initWebSocket()
if (error == "Service Unavailable") {
window.location.reload();
} else {
$(window.hyperion).trigger({type:"error",reason:error});
$(window.hyperion).trigger({type:"error", reason:error});
}
console.log("[window.websocket::onmessage] ",error)
let errorData = response.hasOwnProperty("errorData")? response.errorData : "";
console.log("[window.websocket::onmessage] ",error, ", Description:", errorData);
}
}
}
@@ -344,6 +344,11 @@ function requestServerConfig()
sendToHyperion("config", "getconfig");
}
function requestServerConfigOld()
{
sendToHyperion("config", "getconfig-old");
}
function requestServerConfigReload()
{
sendToHyperion("config", "reload");
@@ -522,3 +527,14 @@ async function requestServiceDiscovery(type, params) {
return sendAsyncToHyperion("service", "discover", data);
}
async function requestConfig(globalTypes, instances, instanceTypes) {
let globalFilter = { "global": { "types": globalTypes } };
let instanceFilter = { "instances": { "ids": instances, "types": instanceTypes } };
//todo create filter
let filter;
return sendAsyncToHyperion("config", "getconfig", filter);
}