feature flag Build

This commit is contained in:
Lisa P 2016-01-05 13:57:14 +01:00
parent 5a0618b22e
commit 8e2b3a86c6
3 changed files with 20 additions and 3 deletions

View File

@ -4,8 +4,22 @@ import Ember from 'ember';
import Model from 'travis/models/model';
import DurationCalculations from 'travis/utils/duration-calculations';
import DS from 'ember-data';
import Config from 'travis/config/environment';
export default Model.extend(DurationCalculations, {
var Build;
if (Config.useV3API) {
Build = DS.Model.extend({
branch: DS.belongsTo('branch', { async: false, inverse: 'builds' }),
branchName: Ember.computed.alias('branch.name')
});
} else {
Build = DS.Model.extend({
branchName: Ember.computed.alias('commit.branch')
});
}
Build.reopen({
ajax: Ember.inject.service(),
state: DS.attr(),
number: DS.attr('number'),
@ -18,7 +32,6 @@ export default Model.extend(DurationCalculations, {
pullRequestTitle: DS.attr(),
pullRequestNumber: DS.attr('number'),
eventType: DS.attr('string'),
branch: DS.belongsTo('branch', { async: false, inverse: 'builds' }),
repo: DS.belongsTo('repo', { async: true }),
commit: DS.belongsTo('commit', { async: false }),
jobs: DS.hasMany('job', { async: true }),
@ -124,4 +137,7 @@ export default Model.extend(DurationCalculations, {
return moment(finishedAt).format('lll');
}
}.property('finishedAt')
});
export default Build;

View File

@ -24,6 +24,7 @@ export default Model.extend(DurationCalculations, {
build: DS.belongsTo('build', { async: true }),
commit: DS.belongsTo('commit', { async: true }),
branch: Ember.computed.alias('build.branch'),
branchName: Ember.computed.alias('build.branchName'),
log: function() {
this.set('isLogAccessed', true);

View File

@ -5,7 +5,7 @@
<small class="commit-branch" title={{item.pullRequestTitle}}>Pull Request #{{item.pullRequestNumber}}</small>
{{item.pullRequestTitle}}
{{else}}
<small class="commit-branch" title={{commit.branch}}>{{commit.branch}}</small>
<small class="commit-branch" title={{item.branchName}}>{{item.branchName}}</small>
{{format-message commit.subject repo=item.repo}}
{{/if}}
</h2>