2016-09-06 10:14:54 +02:00
|
|
|
$(document).ready( function() {
|
2016-12-21 18:24:03 +01:00
|
|
|
var uiLock = false;
|
2017-03-24 10:17:36 +01:00
|
|
|
var prevSess = 0;
|
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
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
$(hyperion).on("cmd-serverinfo",function(event){
|
2017-03-18 00:05:04 +01:00
|
|
|
serverInfo = event.response.info;
|
2017-02-08 14:36:28 +01:00
|
|
|
$(hyperion).trigger("ready");
|
2016-12-04 19:32:23 +01:00
|
|
|
|
2017-03-18 00:05:04 +01:00
|
|
|
if (serverInfo.hyperion.config_modified)
|
2016-09-15 20:42:58 +02:00
|
|
|
$("#hyperion_reload_notify").fadeIn("fast");
|
2016-09-14 13:51:28 +02:00
|
|
|
else
|
2016-09-15 20:42:58 +02:00
|
|
|
$("#hyperion_reload_notify").fadeOut("fast");
|
2016-09-14 13:51:28 +02:00
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
if (serverInfo.hyperion.off)
|
|
|
|
$("#hyperion_disabled_notify").fadeIn("fast");
|
|
|
|
else
|
|
|
|
$("#hyperion_disabled_notify").fadeOut("fast");
|
2016-11-26 22:46:16 +01:00
|
|
|
|
2016-12-21 18:24:03 +01:00
|
|
|
if ($("#logmessages").length == 0 && loggingStreamActive)
|
2016-11-26 22:46:16 +01:00
|
|
|
{
|
|
|
|
requestLoggingStop();
|
2017-02-08 14:36:28 +01:00
|
|
|
loggingStreamActive = false;
|
2016-11-26 22:46:16 +01:00
|
|
|
}
|
|
|
|
|
2017-03-18 00:05:04 +01:00
|
|
|
if (!serverInfo.hyperion.config_writeable)
|
2016-12-21 18:24:03 +01:00
|
|
|
{
|
|
|
|
showInfoDialog('uilock',$.i18n('InfoDialog_nowrite_title'),$.i18n('InfoDialog_nowrite_text'));
|
|
|
|
$('#wrapper').toggle(false);
|
|
|
|
uiLock = true;
|
|
|
|
}
|
|
|
|
else if (uiLock)
|
|
|
|
{
|
|
|
|
$("#modal_dialog").modal('hide');
|
|
|
|
$('#wrapper').toggle(true);
|
|
|
|
uiLock = false;
|
|
|
|
}
|
|
|
|
|
2017-03-24 10:17:36 +01:00
|
|
|
var sess = serverInfo.hyperion.sessions;
|
|
|
|
if (sess.length != prevSess)
|
|
|
|
{
|
|
|
|
wSess = [];
|
|
|
|
prevSess = sess.length;
|
|
|
|
for(var i = 0; i<sess.length; i++)
|
|
|
|
{
|
|
|
|
if(sess[i].type == "_hyperiond-http._tcp.")
|
|
|
|
{
|
|
|
|
wSess.push(sess[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wSess.length > 1)
|
|
|
|
$('#btn_instanceswitch').toggle(true);
|
|
|
|
else
|
|
|
|
$('#btn_instanceswitch').toggle(false);
|
|
|
|
}
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
}); // end cmd-serverinfo
|
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
$(hyperion).one("cmd-sysinfo", function(event) {
|
2017-03-18 00:05:04 +01:00
|
|
|
requestServerInfo();
|
|
|
|
sysInfo = event.response.info;
|
2017-04-07 21:33:40 +02:00
|
|
|
|
2017-03-18 00:05:04 +01:00
|
|
|
currentVersion = sysInfo.hyperion.version;
|
2017-03-04 22:17:42 +01:00
|
|
|
});
|
2017-03-18 00:05:04 +01:00
|
|
|
|
2016-09-10 19:08:08 +02:00
|
|
|
$(hyperion).one("cmd-config-getschema", function(event) {
|
2017-02-08 14:36:28 +01:00
|
|
|
serverSchema = event.response.result;
|
2016-10-10 23:15:50 +02:00
|
|
|
requestServerConfig();
|
2017-02-08 14:36:28 +01:00
|
|
|
|
|
|
|
schema = serverSchema.properties;
|
2016-10-10 23:15:50 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$(hyperion).one("cmd-config-getconfig", function(event) {
|
2017-02-08 14:36:28 +01:00
|
|
|
serverConfig = event.response.result;
|
2017-03-18 00:05:04 +01:00
|
|
|
requestSysInfo();
|
2017-02-08 14:36:28 +01:00
|
|
|
|
|
|
|
showOptHelp = serverConfig.general.showOptHelp;
|
2016-09-10 19:08:08 +02:00
|
|
|
});
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
$(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
|
|
|
|
|
|
|
$(hyperion).on("open",function(event){
|
|
|
|
requestServerConfigSchema();
|
|
|
|
});
|
2017-02-08 14:36:28 +01:00
|
|
|
|
|
|
|
$(hyperion).one("ready", function(event) {
|
|
|
|
loadContent();
|
|
|
|
});
|
|
|
|
|
2016-09-15 20:42:58 +02:00
|
|
|
$("#btn_hyperion_reload").on("click", function(){
|
2016-12-21 18:24:03 +01:00
|
|
|
initRestart();
|
2016-09-15 20:42:58 +02:00
|
|
|
});
|
2017-02-08 14:36:28 +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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|