mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
second part of PR #578
Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
Reference in New Issue
Block a user