Sha256: 0196f216114ec68ed78b0ba85cd75906cabdb368c955bd29415eb0788066a043
Contents?: true
Size: 1.45 KB
Versions: 23
Compression:
Stored size: 1.45 KB
Contents
define( [ 'jquery', 'underscore', 'backbone', 'model/monitor' ], function( $, _, Backbone, MonitorModel ) { /** * MonitorCollection * * Route that pulls back all available monitors. * NOTE : jobs & monitors are synonymous in this web application * context. Dash & dashboard are synonymous as well. **/ var MonitorCollection = Backbone.Collection.extend({ model : MonitorModel, url : function() { return ( this.dashboardId ) ? '/dashboards/' + this.dashboardId + '/jobs.json' : '/jobs.json'; }, initialize : function(models, options) { _.bindAll(this, 'url'); this.dashboardId = options.dashboardId; this.cb = options.cb; this.fetch({ success : function(result) { if ( this.cb ) this.cb(result); }.bind(this), async : false }); }, filterById: function(orderArray) { var filteredOrder = []; _.each(orderArray, function(monitorId) { if(!_.isUndefined(this.get(monitorId))) { filteredOrder.push(monitorId); } }, this); return this.reset(_.map(filteredOrder, function(monitorId) { return this.get(monitorId); }, this)); } }); return MonitorCollection; });
Version data entries
23 entries across 23 versions & 1 rubygems