1234567891011121314151617181920212223242526272829303132333435363738 |
- var $ = require('jquery');
- var Pubsub = require('../lib/pubsub');
- var AppState = require('../app_state');
- var BaseView = require('./base');
- var Nodes = require('../collections/nodes');
- var NodesView = BaseView.extend({
- className: 'nodes container-fluid',
- template: require('./spinner.hbs'),
- events: {
- 'click .conn-count': 'onClickConnCount'
- },
- initialize: function() {
- BaseView.prototype.initialize.apply(this, arguments);
- this.listenTo(AppState, 'change:graph_interval', this.render);
- this.collection = new Nodes();
- this.collection.fetch()
- .done(function(data) {
- this.template = require('./nodes.hbs');
- this.render({'message': data['message']});
- }.bind(this))
- .fail(this.handleViewError.bind(this))
- .always(Pubsub.trigger.bind(Pubsub, 'view:ready'));
- },
- onClickConnCount: function(e) {
- e.preventDefault();
- $(e.target).next().toggle();
- }
- });
- module.exports = NodesView;
|