From 57dec8f2fca94060a3d0964233167ecac543ae25 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 3 Mar 2016 11:24:57 +0100 Subject: [PATCH] Don't fetch /jobs when not in pro We pass runningJobsCount to repos-list-tabs component, which essentially is a binding and a binding will call the property that we're passing, which in turn will fetch running and queued jobs. In order to avoid this, I added guards in computed properties. --- app/controllers/repos.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/repos.js b/app/controllers/repos.js index 0ce24511..76d8ce00 100644 --- a/app/controllers/repos.js +++ b/app/controllers/repos.js @@ -103,6 +103,7 @@ var Controller = Ember.Controller.extend({ }, runningJobs: function() { + if(!this.get('config.pro')) { return [] }; var result; result = this.store.filter('job', {}, function(job) { @@ -114,9 +115,11 @@ var Controller = Ember.Controller.extend({ }); return result; - }.property(), + }.property('config.pro'), queuedJobs: function() { + if(!this.get('config.pro')) { return [] }; + var result; result = this.get('store').filter('job', function(job) { return ['created'].indexOf(job.get('state')) !== -1; @@ -127,7 +130,7 @@ var Controller = Ember.Controller.extend({ }); return result; - }.property(), + }.property('config.pro'), recentRepos: function() { return [];