summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-09-29 21:47:03 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-09-29 21:47:17 (GMT)
commit786f5228e92312695568e26bb38e0ce37775f539 (patch)
treeec83cd3436bff50daf1326691acf12f272dde99e /www/js
parente884cb9cd018043b4ac4599ce577bf8b7bc22ae1 (diff)
rudimentary renderings work now
Diffstat (limited to 'www/js')
-rw-r--r--www/js/rhctl.js29
1 files changed, 26 insertions, 3 deletions
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 = $('<img>').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 = $('<span>').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($('<h1>').append(srv));
}