travis-web/app/components/builds-wrapper.js
2016-01-12 16:55:22 +01:00

31 lines
782 B
JavaScript

import Ember from 'ember';
import Polling from 'travis/mixins/polling';
export default Ember.Component.extend({
store: Ember.inject.service('store'),
pollHook: function(store) {
var contentType, repositoryId;
contentType = this.get('contentType');
repositoryId = this.get('repo.id');
store = this.get('store');
if (contentType === 'builds') {
return store.query('build', {
event_type: 'push',
repository_id: repositoryId
});
} else if (contentType === 'pull_requests') {
return store.filter('build', {
event_type: 'pull_request',
repository_id: repositoryId
});
} else {
return store.query('build', {
repository_id: repositoryId,
branches: true
});
}
}
});