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.
This commit is contained in:
Piotr Sarnacki 2016-03-03 11:24:57 +01:00
parent 20b72e5f10
commit 57dec8f2fc

View File

@ -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 [];