From a39724d88d31ee27fe85bf5fc82b03cf9c0b8c90 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 30 Sep 2016 02:43:09 +0200 Subject: most important views are down now (needs beatification diff --git a/www/index.html b/www/index.html index 9ec29c1..3b9b01b 100644 --- a/www/index.html +++ b/www/index.html @@ -38,10 +38,42 @@

Mood:

-
+
+ +

Active Server:

-
+
+ none +
+
+
+
+ + + + + + +
ServerHealthChannel
+
+
+

Audio Routing

+ + + + + + + + + + + + + +
Out12345678Silence
+
@@ -51,10 +83,37 @@
- + + + diff --git a/www/js/rhctl.js b/www/js/rhctl.js index c8e1f26..ea7adb8 100644 --- a/www/js/rhctl.js +++ b/www/js/rhctl.js @@ -55,6 +55,7 @@ function Rhctl() { } this.sock_onclose = function(event) { + this.draw_callbacks.fireWith(window, []); this.sock.close(); delete this.sock; setTimeout(this.connect.bind(this), 1000); @@ -75,22 +76,39 @@ var rhctl = new Rhctl(); function rhctl_init() { rhctl.connect(); - $('#rhctlraw').text("loading..."); + rhctl_draw_state() rhctl.addCallback(rhctl_draw_state); } function rhctl_draw_state(state) { - $('#rhctlraw').text(JSON.stringify(state, null, '\t')); + var raw = $('#rhctlraw'); + var mood = $('#rhctlmood img').removeClass(); + var srv = $('#rhctlactiveserver span').removeClass().addClass('label'); + var srvTable = $('#rhctlservertable table'); + srvTable.find("tr:gt(0)").remove();; + var audioTable = $('#rhctlaudiotable table'); + audioTable.find("tr:gt(0)").remove();; - var mood = $('').attr('src', '/img/mood-' + state.Mood + '.png'); + if(!state) { + raw.text("connecting..."); + mood.attr('src', '/img/mood-undefined.png'); + srv.addClass('label-default').text('none'); + return; + } + + // Raw message + raw.text(JSON.stringify(state, null, '\t')); + + // Mood + mood.attr('src', '/img/mood-' + state.Mood + '.png'); if(state.Settled) { mood.attr('title', state.Mood); } else { mood.addClass('blink').attr('title', state.Mood + ' (Settling)'); } - $('#rhctlmood').empty().append(mood); - var srv = $('').addClass('label').text(state.ActiveServer); + // Active Server + srv.text(state.ActiveServer); switch(state.ActiveServer) { case 'master': srv.addClass('label-success'); @@ -104,5 +122,39 @@ function rhctl_draw_state(state) { } srv.addClass('label-default'); } - $('#rhctlactiveserver').empty().append($('

').append(srv)); + + // Server Table + $.each(state.Server, function(key, value) { + var entry = $('#hiddenTemplates .servertableEntryTemplate').clone().removeClass('servertableEntryTemplate'); + entry.find('.server-name').text(key); + if(value.Channel) { + entry.find('.server-channel').text(value.Channel); + } + var h = entry.find('.server-health img'); + switch(value.Health) { + case 'alive': + case 'dead': + h.attr('src', '/img/server-' + value.Health + '.png').attr('title', value.Health); + break; + default: + } + srvTable.append(entry) + }); + + + // Audio Outputs + $.each(state.Switch.Audio, function(index, value) { + var entry = $('#hiddenTemplates .audiotableEntryTemplate').clone().removeClass('audiotableEntryTemplate'); + entry.find('.audio-out').text(index+1); + $.each(value.Inputs, function(index, value) { + if(value) { + entry.find('.audio-in' + (index+1) + ' span').removeClass('glyphicon-unchecked').addClass('glyphicon-check'); + } + }); + if(!value.Silence) { + entry.find('.audio-silence span').removeClass('glyphicon-volume-off').addClass('glyphicon-volume-up'); + } + + audioTable.append(entry) + }); } diff --git a/www/styles/main.css b/www/styles/main.css index ad774b8..37b5b80 100644 --- a/www/styles/main.css +++ b/www/styles/main.css @@ -47,13 +47,40 @@ margin-bottom: 1em; } +#rhctlactiveserver span { + font-size: 2em; +} + +#rhctlservertable table { + margin-top: 2em; + width: 100%; +} + +#rhctlaudiotable h4 { + margin-top: 2em; + text-align: center; + width: 100%; +} + +#rhctlaudiotable table { + width: 100%; +} + +#rhctlaudiotable .audio-out,.audio-in { + font-size: 1.1em; +} + +#rhctlaudiotable .audio-silence { + font-size: 2em; +} + @keyframes blink { - 0%{opacity:1;} - 50%{opacity:0.2;} - 100%{opacity:1;} + 0% {opacity:1;} + 50% {opacity:0.2;} + 100% {opacity:1;} } .blink { - transition:all 0.5s ease-in-out; - animation:blink normal 1s infinite ease-in-out; + transition: all 0.5s ease-in-out; + animation: blink normal 1s infinite ease-in-out; }​ -- cgit v0.10.2