2019-07-14 22:43:22 +02:00
|
|
|
var instNameInit = false
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
$(document).ready( function() {
|
2016-12-21 18:24:03 +01:00
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
loadContentTo("#container_connection_lost","connection_lost");
|
2017-01-17 21:53:35 +01:00
|
|
|
loadContentTo("#container_restart","restart");
|
2016-09-06 10:14:54 +02:00
|
|
|
initWebSocket();
|
2016-09-07 20:10:37 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-serverinfo",function(event){
|
|
|
|
window.serverInfo = event.response.info;
|
2019-01-01 19:47:07 +01:00
|
|
|
// comps
|
2019-06-05 18:19:08 +02:00
|
|
|
window.comps = event.response.info.components
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).trigger("ready");
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
window.comps.forEach( function(obj) {
|
2019-01-01 19:47:07 +01:00
|
|
|
if (obj.name == "ALL")
|
|
|
|
{
|
|
|
|
if(obj.enabled)
|
|
|
|
$("#hyperion_disabled_notify").fadeOut("fast");
|
|
|
|
else
|
|
|
|
$("#hyperion_disabled_notify").fadeIn("fast");
|
|
|
|
}
|
|
|
|
});
|
2016-09-14 13:51:28 +02:00
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
// determine button visibility
|
|
|
|
var running = window.serverInfo.instance.filter(entry => entry.running);
|
|
|
|
if(running.length > 1)
|
|
|
|
$('#btn_hypinstanceswitch').toggle(true)
|
2018-12-27 23:11:32 +01:00
|
|
|
else
|
2019-07-14 22:43:22 +02:00
|
|
|
$('#btn_hypinstanceswitch').toggle(false)
|
|
|
|
// update listing at button
|
|
|
|
updateHyperionInstanceListing()
|
|
|
|
if(!instNameInit)
|
|
|
|
{
|
|
|
|
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
|
|
|
|
instNameInit = true;
|
|
|
|
}
|
2016-11-26 22:46:16 +01:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
updateSessions();
|
2016-09-06 10:14:54 +02:00
|
|
|
}); // end cmd-serverinfo
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-sessions-update", function(event) {
|
|
|
|
window.serverInfo.sessions = event.response.data;
|
2018-12-27 23:11:32 +01:00
|
|
|
updateSessions();
|
|
|
|
});
|
|
|
|
|
2019-07-12 16:54:26 +02:00
|
|
|
$(window.hyperion).one("cmd-authorize-getTokenList", function(event) {
|
|
|
|
tokenList = event.response.info;
|
|
|
|
requestServerInfo();
|
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-sysinfo", function(event) {
|
2017-03-18 00:05:04 +01:00
|
|
|
requestServerInfo();
|
2019-06-05 18:19:08 +02:00
|
|
|
window.sysInfo = event.response.info;
|
2017-04-07 21:33:40 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
window.currentVersion = window.sysInfo.hyperion.version;
|
2019-07-08 15:04:38 +02:00
|
|
|
window.currentChannel = window.sysInfo.hyperion.channel;
|
2017-03-04 22:17:42 +01:00
|
|
|
});
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).one("cmd-config-getschema", function(event) {
|
|
|
|
window.serverSchema = event.response.info;
|
2016-10-10 23:15:50 +02:00
|
|
|
requestServerConfig();
|
2019-07-12 16:54:26 +02:00
|
|
|
requestTokenInfo();
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
window.schema = window.serverSchema.properties;
|
2016-10-10 23:15:50 +02:00
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-config-getconfig", function(event) {
|
|
|
|
window.serverConfig = event.response.info;
|
2017-03-18 00:05:04 +01:00
|
|
|
requestSysInfo();
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
window.showOptHelp = window.serverConfig.general.showOptHelp;
|
2016-09-10 19:08:08 +02:00
|
|
|
});
|
2019-02-07 00:59:52 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-config-setconfig", function(event) {
|
2019-02-07 00:59:52 +01:00
|
|
|
if (event.response.success === true) {
|
|
|
|
$('#hyperion_config_write_success_notify').fadeIn().delay(5000).fadeOut();
|
|
|
|
}
|
|
|
|
});
|
2016-09-10 19:08:08 +02:00
|
|
|
|
2019-07-12 16:54:26 +02:00
|
|
|
$(window.hyperion).one("cmd-authorize-login", function(event) {
|
|
|
|
requestServerConfigSchema();
|
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("error",function(event){
|
2016-10-27 23:42:24 +02:00
|
|
|
showInfoDialog("error","Error", event.reason);
|
2016-09-06 10:14:54 +02:00
|
|
|
});
|
2016-09-10 19:08:08 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("open",function(event){
|
2019-07-12 16:54:26 +02:00
|
|
|
requestAuthorization();
|
2016-09-10 19:08:08 +02:00
|
|
|
});
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).one("ready", function(event) {
|
2017-02-08 14:36:28 +01:00
|
|
|
loadContent();
|
|
|
|
});
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-adjustment-update", function(event) {
|
|
|
|
window.serverInfo.adjustment = event.response.data
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-videomode-update", function(event) {
|
|
|
|
window.serverInfo.videomode = event.response.data.videomode
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-components-update", function(event) {
|
2018-12-27 23:11:32 +01:00
|
|
|
let obj = event.response.data
|
|
|
|
|
|
|
|
// notfication in index
|
|
|
|
if (obj.name == "ALL")
|
|
|
|
{
|
2019-01-01 19:47:07 +01:00
|
|
|
if(obj.enabled)
|
2018-12-27 23:11:32 +01:00
|
|
|
$("#hyperion_disabled_notify").fadeOut("fast");
|
|
|
|
else
|
|
|
|
$("#hyperion_disabled_notify").fadeIn("fast");
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
window.comps.forEach((entry, index) => {
|
2018-12-27 23:11:32 +01:00
|
|
|
if (entry.name === obj.name){
|
2019-06-05 18:19:08 +02:00
|
|
|
window.comps[index] = obj;
|
2018-12-27 23:11:32 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
// notify the update
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).trigger("components-updated");
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
$(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)
|
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-effects-update", function(event){
|
|
|
|
window.serverInfo.effects = event.response.data.effects
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
$(".mnava").bind('click.menu', function(e){
|
2017-02-08 14:36:28 +01:00
|
|
|
loadContent(e);
|
2017-02-28 17:53:41 +01:00
|
|
|
window.scrollTo(0, 0);
|
2017-02-08 14:36:28 +01:00
|
|
|
});
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance
|
|
|
|
sidebar.delegate('a.inactive','click',function(){
|
|
|
|
sidebar.find('.active').toggleClass('active inactive');
|
|
|
|
$(this).toggleClass('active inactive');
|
|
|
|
});
|
|
|
|
});
|