second part of PR #578

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen-Panther
2019-07-14 22:43:22 +02:00
parent ea796160af
commit 90599e820a
52 changed files with 2354 additions and 536 deletions

View File

@@ -1,3 +1,5 @@
var instNameInit = false
$(document).ready( function() {
loadContentTo("#container_connection_lost","connection_lost");
@@ -21,10 +23,19 @@ $(document).ready( function() {
}
});
if (window.serverInfo.hyperion.enabled)
$("#hyperion_disabled_notify").fadeOut("fast");
// determine button visibility
var running = window.serverInfo.instance.filter(entry => entry.running);
if(running.length > 1)
$('#btn_hypinstanceswitch').toggle(true)
else
$("#hyperion_disabled_notify").fadeIn("fast");
$('#btn_hypinstanceswitch').toggle(false)
// update listing at button
updateHyperionInstanceListing()
if(!instNameInit)
{
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
instNameInit = true;
}
updateSessions();
}); // end cmd-serverinfo
@@ -113,6 +124,50 @@ $(document).ready( function() {
$(window.hyperion).trigger("components-updated");
});
$(window.hyperion).on("cmd-instance-update", function(event) {
window.serverInfo.instance = event.response.data
var avail = event.response.data;
// notify the update
$(window.hyperion).trigger("instance-updated");
// if our current instance is no longer available we are at instance 0 again.
var isInData = false;
for(var key in avail)
{
if(avail[key].instance == currentHyperionInstance && avail[key].running)
{
isInData = true;
}
}
if(!isInData)
{
currentHyperionInstance = 0;
currentHyperionInstanceName = getInstanceNameByIndex(0);
requestServerConfig();
setTimeout(requestServerInfo,100)
setTimeout(requestTokenInfo,200)
setTimeout(loadContent,300, undefined, true)
}
// determine button visibility
var running = serverInfo.instance.filter(entry => entry.running);
if(running.length > 1)
$('#btn_hypinstanceswitch').toggle(true)
else
$('#btn_hypinstanceswitch').toggle(false)
// update listing for button
updateHyperionInstanceListing()
});
$(window.hyperion).on("cmd-instance-switchTo", function(event){
requestServerConfig();
setTimeout(requestServerInfo,200)
setTimeout(requestTokenInfo,400)
setTimeout(loadContent,400, undefined, true)
});
$(window.hyperion).on("cmd-effects-update", function(event){
window.serverInfo.effects = event.response.data.effects
});