2016-09-06 10:14:54 +02:00
|
|
|
$(document).ready( function() {
|
2016-12-21 18:24:03 +01:00
|
|
|
var uiLock = false;
|
|
|
|
|
2016-09-15 20:42:58 +02:00
|
|
|
$("#main-nav").hide();
|
2016-09-06 10:14:54 +02:00
|
|
|
loadContentTo("#container_connection_lost","connection_lost");
|
|
|
|
initWebSocket();
|
|
|
|
bindNavToContent("#load_dashboard","dashboard",true);
|
2016-09-09 18:59:58 +02:00
|
|
|
bindNavToContent("#load_remote","remote",false);
|
2016-09-06 10:14:54 +02:00
|
|
|
bindNavToContent("#load_huebridge","huebridge",false);
|
|
|
|
bindNavToContent("#load_support","support",false);
|
|
|
|
bindNavToContent("#load_update","update",false);
|
2016-12-23 19:37:35 +01:00
|
|
|
bindNavToContent("#load_confGeneral","general",false);
|
2016-10-09 10:23:04 +02:00
|
|
|
bindNavToContent("#load_confEffects","effects",false);
|
2016-12-23 19:37:35 +01:00
|
|
|
bindNavToContent("#load_confKodi","kodiconf",false);
|
2016-09-06 10:14:54 +02:00
|
|
|
bindNavToContent("#load_confLeds","leds",false);
|
2016-09-07 20:10:37 +02:00
|
|
|
bindNavToContent("#load_confGrabber","grabber",false);
|
2016-10-09 10:23:04 +02:00
|
|
|
bindNavToContent("#load_confColors","colors",false);
|
|
|
|
bindNavToContent("#load_confNetwork","network",false);
|
2016-10-30 17:54:38 +01:00
|
|
|
bindNavToContent("#load_effectsconfig","effects_configurator",false);
|
2016-11-26 22:46:16 +01:00
|
|
|
bindNavToContent("#load_logging","logging",false);
|
2016-12-08 23:39:41 +01:00
|
|
|
bindNavToContent("#load_webconfig","webconfig",false);
|
2016-09-07 20:10:37 +02:00
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
$(hyperion).on("cmd-serverinfo",function(event){
|
2017-01-04 10:55:10 +01:00
|
|
|
showOptHelp = parsedConfJSON.general.showOptHelp;
|
2016-09-06 10:14:54 +02:00
|
|
|
parsedServerInfoJSON = event.response;
|
|
|
|
currentVersion = parsedServerInfoJSON.info.hyperion[0].version;
|
|
|
|
cleanCurrentVersion = currentVersion.replace(/\./g, '');
|
2016-12-04 19:32:23 +01:00
|
|
|
|
2016-09-14 13:51:28 +02:00
|
|
|
if (parsedServerInfoJSON.info.hyperion[0].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
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
// get active led device
|
|
|
|
var leddevice = parsedServerInfoJSON.info.ledDevices.active;
|
2016-11-26 22:46:16 +01:00
|
|
|
if ($("#content_dashboard").length > 0)
|
|
|
|
{
|
|
|
|
$('#dash_leddevice').html(leddevice);
|
|
|
|
}
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
// get host
|
|
|
|
var hostname = parsedServerInfoJSON.info.hostname;
|
2016-11-26 22:46:16 +01:00
|
|
|
if ($("#content_dashboard").length > 0)
|
2016-09-07 20:10:37 +02:00
|
|
|
{
|
2016-11-26 22:46:16 +01:00
|
|
|
$('#dash_systeminfo').html(hostname+':'+hyperionport);
|
2016-09-07 20:10:37 +02:00
|
|
|
}
|
2016-09-06 10:14:54 +02:00
|
|
|
|
|
|
|
|
2016-11-26 22:46:16 +01:00
|
|
|
if ($("#content_dashboard").length > 0)
|
|
|
|
{
|
|
|
|
var components = parsedServerInfoJSON.info.components;
|
|
|
|
components_html = "";
|
|
|
|
for ( idx=0; idx<components.length;idx++)
|
2016-09-06 10:14:54 +02:00
|
|
|
{
|
2016-12-04 19:32:23 +01:00
|
|
|
components_html += '<tr><td>'+$.i18n('general_comp_'+components[idx].name)+'</td><td><i class="fa fa-circle component-'+(components[idx].enabled?"on":"off")+'"></i></td></tr>';
|
2016-09-06 10:14:54 +02:00
|
|
|
}
|
2016-11-26 22:46:16 +01:00
|
|
|
$("#tab_components").html(components_html);
|
|
|
|
|
|
|
|
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
|
|
|
|
parsedUpdateJSON = JSON.parse(data);
|
|
|
|
latestVersion = parsedUpdateJSON[0].versionnr;
|
|
|
|
cleanLatestVersion = latestVersion.replace(/\./g, '');
|
|
|
|
|
|
|
|
$('#currentversion').html(' V'+currentVersion);
|
|
|
|
$('#latestversion').html(' V'+latestVersion);
|
|
|
|
|
|
|
|
if ( cleanCurrentVersion < cleanLatestVersion )
|
|
|
|
{
|
2016-12-04 19:32:23 +01:00
|
|
|
$('#versioninforesult').html('<div style="margin:0px;" class="alert alert-warning">'+$.i18n('dashboard_infobox_message_updatewarning', latestVersion)+'</div>');
|
2016-11-26 22:46:16 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-12-04 19:32:23 +01:00
|
|
|
$('#versioninforesult').html('<div style="margin:0px;" class="alert alert-success">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-13 11:51:16 +02:00
|
|
|
$("#loading_overlay").removeClass("overlay");
|
2016-09-15 20:42:58 +02:00
|
|
|
$("#main-nav").show('slide', {direction: 'left'}, 1000);
|
|
|
|
|
2016-12-21 18:24:03 +01:00
|
|
|
if (!parsedServerInfoJSON.info.hyperion[0].config_writeable)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
}); // end cmd-serverinfo
|
|
|
|
|
2016-09-10 19:08:08 +02:00
|
|
|
$(hyperion).one("cmd-config-getschema", function(event) {
|
|
|
|
parsedConfSchemaJSON = event.response.result;
|
2016-10-10 23:15:50 +02:00
|
|
|
requestServerConfig();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(hyperion).one("cmd-config-getconfig", function(event) {
|
|
|
|
parsedConfJSON = event.response.result;
|
|
|
|
requestServerInfo();
|
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();
|
|
|
|
});
|
|
|
|
|
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
|
|
|
});
|
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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|