implement hyperion restart via webui (#242)

* first try

* implement hyperion restart. core function is good, but needs a beeter structuring- something for next refactoring session ;-)

* several fixes (including osx)
merge with upstream
some refactoring

* add some eye candy to webui
This commit is contained in:
redPanther
2016-09-15 20:42:58 +02:00
committed by GitHub
parent a04f34eab7
commit eeb9b0f7da
33 changed files with 197 additions and 71 deletions

View File

@@ -50,19 +50,19 @@ $(hyperion).one("cmd-config-getschema", function(event) {
schema: {
title:'',
properties: {
/*blackborderdetector,
blackborderdetector,
color,
effects,
forwarder,
initialEffect,
kodiVideoChecker,
smoothing,*/
logger//,
/*jsonServer,
smoothing,
logger,
jsonServer,
protoServer,
boblightServer,
udpListener,
webConfig*/
webConfig
}
}
});
@@ -74,10 +74,10 @@ $(hyperion).one("cmd-config-getschema", function(event) {
$('#editor_container h3').first().remove();
//Called everytime a Input Field is changed = No need for save button
general_conf_editor.off().on('change',function() {
console.log(JSON.stringify(general_conf_editor.getValue()));
requestWriteConfig(general_conf_editor.getValue());
});
// general_conf_editor.off().on('change',function() {
// console.log(JSON.stringify(general_conf_editor.getValue()));
// requestWriteConfig(general_conf_editor.getValue());
// });
//Alternative Function with submit button to get Values
$('btn_submit').off().on('click',function() {

View File

@@ -1,4 +1,6 @@
$(document).ready( function() {
$("#main-nav").hide();
$("#page-content").hide();
$("#loading_overlay").addClass("overlay");
loadContentTo("#container_connection_lost","connection_lost");
initWebSocket();
@@ -22,9 +24,9 @@ $(document).ready( function() {
cleanCurrentVersion = currentVersion.replace(/\./g, '');
if (parsedServerInfoJSON.info.hyperion[0].config_modified)
$("#hyperion_restart_notify").fadeIn("fast");
$("#hyperion_reload_notify").fadeIn("fast");
else
$("#hyperion_restart_notify").fadeOut("fast");
$("#hyperion_reload_notify").fadeOut("fast");
// get active led device
var leddevice = parsedServerInfoJSON.info.ledDevices.active;
@@ -59,6 +61,9 @@ $(document).ready( function() {
}
});
$("#loading_overlay").removeClass("overlay");
$("#main-nav").show('slide', {direction: 'left'}, 1000);
$("#page-content").show('slide', {direction: 'down'}, 2000);
}); // end cmd-serverinfo
$(hyperion).one("cmd-config-getschema", function(event) {
@@ -75,6 +80,13 @@ $(document).ready( function() {
requestServerInfo();
});
$("#btn_hyperion_reload").on("click", function(){
$(hyperion).off();
requestServerConfigReload();
watchdog = 1;
$("#wrapper").fadeOut("slow");
cron();
});
});
$(function(){

View File

@@ -0,0 +1 @@

View File

@@ -1,6 +1,21 @@
var ledsCustomCfgInitialized = false;
function get_hue_lights(){
$.ajax({
type: "GET",
url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights',
processData: false,
contentType: 'application/json',
success: function(r) {
for(var lightid in r){
//console.log(r[lightid].name);
$('#hue_lights').append('ID: '+lightid+' Name: '+r[lightid].name+'<br />');
}
}
});
}
$(document).ready(function() {
// ------------------------------------------------------------------
@@ -157,7 +172,7 @@ $(document).ready(function() {
if (isCurrentDevice)
{
specificOptions_val = grabber_conf_editor.getEditor("root.specificOptions").getValue()
for(var key in grabber_conf_editor.getEditor("root.specificOptions").getValue()){
for(var key in specificOptions_val){
values_specific[key] = (key in parsedConfJSON.device) ? parsedConfJSON.device[key] : specificOptions_val[key];
};

View File

@@ -155,6 +155,10 @@ function requestServerConfig() {
websocket.send('{"command":"config", "tan":'+wsTan+',"subcommand":"getconfig"}');
}
function requestServerConfigReload() {
websocket.send('{"command":"config", "tan":'+wsTan+',"subcommand":"reload"}');
}
function requestLedColorsStart() {
ledStreamActive=true;
websocket.send('{"command":"ledcolors", "tan":'+wsTan+',"subcommand":"ledstream-start"}');
@@ -197,18 +201,3 @@ function requestWriteConfig(config, create, overwrite)
var overwrite = (typeof overwrite !== 'undefined') ? overwrite : false;
websocket.send('{"command":"config","subcommand":"setconfig", "tan":'+wsTan+', "config":'+JSON.stringify(config)+',"create":'+create+', "overwrite":'+overwrite+'}');
}
function get_hue_lights(){
$.ajax({
type: "GET",
url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights',
processData: false,
contentType: 'application/json',
success: function(r) {
for(var lightid in r){
//console.log(r[lightid].name);
$('#hue_lights').append('ID: '+lightid+' Name: '+r[lightid].name+'<br />');
}
}
});
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@ function bindNavToContent(containerId, fileName, loadNow)
});
if (loadNow)
{
$("#page-content").load("/content/"+fileName+".html");
$(containerId).trigger("click");
}
}