From 786f5228e92312695568e26bb38e0ce37775f539 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 29 Sep 2016 23:47:03 +0200 Subject: rudimentary renderings work now diff --git a/www/index.html b/www/index.html index f576a6b..9ec29c1 100644 --- a/www/index.html +++ b/www/index.html @@ -35,7 +35,17 @@
-
+
+
+

Mood:

+
+ +

Active Server:

+
+
+
+
+
diff --git a/www/js/rhctl.js b/www/js/rhctl.js index 103f12c..c8e1f26 100644 --- a/www/js/rhctl.js +++ b/www/js/rhctl.js @@ -75,11 +75,34 @@ var rhctl = new Rhctl(); function rhctl_init() { rhctl.connect(); - $('#rhctl').text("loading..."); + $('#rhctlraw').text("loading..."); rhctl.addCallback(rhctl_draw_state); } function rhctl_draw_state(state) { - console.log(state); - $('#rhctl').text(JSON.stringify(state, null, '\t')); + $('#rhctlraw').text(JSON.stringify(state, null, '\t')); + + var 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); + switch(state.ActiveServer) { + case 'master': + srv.addClass('label-success'); + break; + case 'standby': + srv.addClass('label-warning'); + break; + default: + if(!state.ActiveServer) { + srv.text('none'); + } + srv.addClass('label-default'); + } + $('#rhctlactiveserver').empty().append($('

').append(srv)); } diff --git a/www/styles/main.css b/www/styles/main.css index 86162af..ad774b8 100644 --- a/www/styles/main.css +++ b/www/styles/main.css @@ -38,7 +38,7 @@ font-weight: bold; } -#rhctl { +#rhctlraw { background-color: white; border: 1px solid; padding: 1em; @@ -46,3 +46,14 @@ margin-top: 1em; margin-bottom: 1em; } + +@keyframes blink { + 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; +}​ -- cgit v0.10.2