Permalink
Browse files

Reset app status properly on ever start/stop change.

Fixes problems with the way status was shown after start/stop.
  • Loading branch information...
1 parent 94a40fe commit b5990bef4775b5656d186bb12abc63d14e6d7dac @akavlie akavlie committed Apr 7, 2012
Showing with 10 additions and 5 deletions.
  1. +9 −4 public/javascripts/main.js
  2. +1 −1 views/frontend-templates.jade
View
@@ -46,15 +46,20 @@
idAttribute: 'name',
initialize: function() {
+ this.setStatus();
+ this.on('change:running', this.setStatus, this);
+ },
+
+ setStatus: function() {
var appStatus = this._parseRunning(this.get('running'));
- this.set({up: appStatus[0], status: appStatus[1]});
+ this.set({up: appStatus[0], appStatus: appStatus[1]});
},
-
+
_parseRunning: function(running) {
- if(running === undefined){
+ if (running === undefined) {
running = 'Application failed to start';
}
- switch(running) {
+ switch (running) {
case 'true':
case true:
return [true, 'running'];
@@ -12,7 +12,7 @@ script(id="app-tmpl", type="text/html")
a(href="http://{{name}}.nodester.com", target="_blank") {{name}}
td.port {{port}}
td.status <span class="label {{#up}}label-success{{/up}}
- | {{^up}}label-important{{/up}}">{{status}}</span>
+ | {{^up}}label-important{{/up}}">{{appStatus}}</span>
td.actions
a.start(href="/app") start
a.stop(href="/app") stop

0 comments on commit b5990be

Please sign in to comment.