diff options
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/rhctl.js | 29 |
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)); } |