node.js 746 B

123456789101112131415161718192021222324
  1. var Pubsub = require('../lib/pubsub');
  2. var AppState = require('../app_state');
  3. var BaseView = require('./base');
  4. var NodeView = BaseView.extend({
  5. className: 'node container-fluid',
  6. template: require('./spinner.hbs'),
  7. initialize: function() {
  8. BaseView.prototype.initialize.apply(this, arguments);
  9. this.listenTo(AppState, 'change:graph_interval', this.render);
  10. this.model.fetch()
  11. .done(function(data) {
  12. this.template = require('./node.hbs');
  13. this.render({'message': data['message']});
  14. }.bind(this))
  15. .fail(this.handleViewError.bind(this))
  16. .always(Pubsub.trigger.bind(Pubsub, 'view:ready'));
  17. }
  18. });
  19. module.exports = NodeView;