Merge pull request #425 from travis-ci/lp-bring-back-branch
bring back branch name
This commit is contained in:
commit
493bf72605
|
@ -4,8 +4,22 @@ import Ember from 'ember';
|
||||||
import Model from 'travis/models/model';
|
import Model from 'travis/models/model';
|
||||||
import DurationCalculations from 'travis/utils/duration-calculations';
|
import DurationCalculations from 'travis/utils/duration-calculations';
|
||||||
import DS from 'ember-data';
|
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(),
|
ajax: Ember.inject.service(),
|
||||||
state: DS.attr(),
|
state: DS.attr(),
|
||||||
number: DS.attr('number'),
|
number: DS.attr('number'),
|
||||||
|
@ -18,7 +32,6 @@ export default Model.extend(DurationCalculations, {
|
||||||
pullRequestTitle: DS.attr(),
|
pullRequestTitle: DS.attr(),
|
||||||
pullRequestNumber: DS.attr('number'),
|
pullRequestNumber: DS.attr('number'),
|
||||||
eventType: DS.attr('string'),
|
eventType: DS.attr('string'),
|
||||||
branch: DS.belongsTo('branch', { async: false, inverse: 'builds' }),
|
|
||||||
repo: DS.belongsTo('repo', { async: true }),
|
repo: DS.belongsTo('repo', { async: true }),
|
||||||
commit: DS.belongsTo('commit', { async: false }),
|
commit: DS.belongsTo('commit', { async: false }),
|
||||||
jobs: DS.hasMany('job', { async: true }),
|
jobs: DS.hasMany('job', { async: true }),
|
||||||
|
@ -124,4 +137,7 @@ export default Model.extend(DurationCalculations, {
|
||||||
return moment(finishedAt).format('lll');
|
return moment(finishedAt).format('lll');
|
||||||
}
|
}
|
||||||
}.property('finishedAt')
|
}.property('finishedAt')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default Build;
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default Model.extend(DurationCalculations, {
|
||||||
build: DS.belongsTo('build', { async: true }),
|
build: DS.belongsTo('build', { async: true }),
|
||||||
commit: DS.belongsTo('commit', { async: true }),
|
commit: DS.belongsTo('commit', { async: true }),
|
||||||
branch: Ember.computed.alias('build.branch'),
|
branch: Ember.computed.alias('build.branch'),
|
||||||
|
branchName: Ember.computed.alias('build.branchName'),
|
||||||
|
|
||||||
log: function() {
|
log: function() {
|
||||||
this.set('isLogAccessed', true);
|
this.set('isLogAccessed', true);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<small class="commit-branch" title={{item.pullRequestTitle}}>Pull Request #{{item.pullRequestNumber}}</small>
|
<small class="commit-branch" title={{item.pullRequestTitle}}>Pull Request #{{item.pullRequestNumber}}</small>
|
||||||
{{item.pullRequestTitle}}
|
{{item.pullRequestTitle}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<small class="commit-branch" title={{item.branch.name}}>{{item.branch.name}}</small>
|
<small class="commit-branch" title={{item.branchName}}>{{item.branchName}}</small>
|
||||||
{{format-message commit.subject repo=item.repo}}
|
{{format-message commit.subject repo=item.repo}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user