Webui: view led configuration + lights (#223)

* make hyperion websocket api event based

* implement new websocket handling for generalconf

* migrate all webui stuff to new event based websocket api
some cleanup ... now all html templates are in content
refactoring of web stuff

* add hyperionport to global
start impl. removing advanced key

* separate dashboard
serverinfo is updated every 3 seconds automatily
add input selection
cleanup and remove not needed stuff

* prepare infrastructure for server sided file execution

* webui minor fixes

* fix compile

* implement led layout view with live colors

* live led vies

* fix general conf
unrigister ledcolors request, when not on leds.html

* fix compiler warning

* prepare realtime ledview and enhance ui
This commit is contained in:
redPanther
2016-09-05 17:26:29 +02:00
committed by GitHub
parent b99e75d7e4
commit bbffa078fd
14 changed files with 292 additions and 52 deletions

View File

@@ -26,19 +26,23 @@ var currentVersion;
var cleanCurrentVersion;
var latestVersion;
var cleanLatestVersion;
var parsedServerInfoJSON;
var parsedUpdateJSON;
var parsedConfSchemaJSON;
var parsedServerInfoJSON = {};
var parsedUpdateJSON = {};
var parsedConfSchemaJSON = {};
var parsedConfJSON = {};
var hyperionport = 19444;
var websocket = null;
var hyperion = {};
var wsTan = 1;
var cronId = 0;
var ledStreamActive=false;
//
function cron()
{
requestServerInfo();
$(hyperion).trigger({type:"cron"});
}
// init websocket to hyperion and bind socket events to jquery events of $(hyperion) object
@@ -54,7 +58,7 @@ function initWebSocket()
websocket.onopen = function (event) {
$(hyperion).trigger({type:"open"});
cronId = window.setInterval(cron,3000);
cronId = window.setInterval(cron,2000);
};
websocket.onclose = function (event) {
@@ -130,6 +134,14 @@ function requestServerConfigSchema() {
websocket.send('{"command":"config", "tan":'+wsTan+',"subcommand":"getschema"}');
}
function requestServerConfig() {
websocket.send('{"command":"config", "tan":'+wsTan+',"subcommand":"getconfig"}');
}
function requestLedColorsStart() {
websocket.send('{"command":"ledcolors", "tan":'+wsTan+',"subcommand":"ledstream_start"}');
}
function requestPriorityClear() {
websocket.send('{"command":"clear", "tan":'+wsTan+', "priority":1}');
}
@@ -142,7 +154,6 @@ function requestSetColor(r,g,b) {
websocket.send('{"command":"color", "tan":'+wsTan+', "color":['+r+','+g+','+b+'], "priority":1}');
}
function requestSetComponentState(comp, state){
state_str = state?"true":"false";
websocket.send('{"command":"componentstate", "tan":'+wsTan+',"componentstate":{"component":"'+comp+'","state":'+state_str+'}}');

View File

@@ -10,3 +10,34 @@ function bindNavToContent(containerId, fileName, loadNow)
$("#page-wrapper").load("/content/"+fileName+".html");
}
}
function toggleClass(obj,class1,class2)
{
if ( $(obj).hasClass(class1))
{
$(obj).removeClass(class1);
$(obj).addClass(class2);
}
else
{
$(obj).removeClass(class2);
$(obj).addClass(class1);
}
}
function setClassByBool(obj,enable,class1,class2)
{
if (enable)
{
$(obj).removeClass(class1);
$(obj).addClass(class2);
}
else
{
$(obj).removeClass(class2);
$(obj).addClass(class1);
}
}