fix error handling for log
This commit is contained in:
parent
0dc7e0e045
commit
de26ed2091
|
@ -2,6 +2,7 @@ import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
logBinding: 'job.log',
|
logBinding: 'job.log',
|
||||||
|
classNames: ['job-log'],
|
||||||
|
|
||||||
didReceiveAttrs: function(options) {
|
didReceiveAttrs: function(options) {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -25,7 +26,10 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setupLog(job) {
|
setupLog(job) {
|
||||||
job.get('log').fetch();
|
this.set('error', false);
|
||||||
|
job.get('log').fetch().then(function() { }, () => {
|
||||||
|
this.set('error', true);
|
||||||
|
});
|
||||||
job.subscribe();
|
job.subscribe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default function() {
|
||||||
if(log) {
|
if(log) {
|
||||||
return { log: { parts: [{ id: log.id, number: 1, content: log.content}] }};
|
return { log: { parts: [{ id: log.id, number: 1, content: log.content}] }};
|
||||||
} else {
|
} else {
|
||||||
new Mirage.Response(404, {}, {});
|
return new Mirage.Response(404, {}, {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
{{#if log.isLoaded}}
|
{{#if error}}
|
||||||
{{log-content job=job log=log}}
|
<p class="notice">There was an error while trying to fetch the log.</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{loading-indicator}}
|
{{#if log.isLoaded}}
|
||||||
|
{{log-content job=job log=log}}
|
||||||
|
{{else}}
|
||||||
|
{{loading-indicator}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -25,3 +25,24 @@ test('visiting job-view', function(assert) {
|
||||||
assert.equal(jobPage.log, 'Hello log');
|
assert.equal(jobPage.log, 'Hello log');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('handling log error', function(assert) {
|
||||||
|
|
||||||
|
let repo = server.create('repository', {slug: 'travis-ci/travis-web'});
|
||||||
|
let branch = server.create('branch', {});
|
||||||
|
let commit = server.create('commit', {author_email: 'mrt@travis-ci.org', author_name: 'Mr T', committer_email: 'mrt@travis-ci.org', committer_name: 'Mr T', branch: 'acceptance-tests', message: 'This is a message', branch_is_default: true});
|
||||||
|
let build = server.create('build', {repository_id: repo.id, state: 'passed', commit_id: commit.id});
|
||||||
|
let job = server.create('job', {number: '1234.1', reposiptoy_id: repo.id, state: 'passed', build_id: build.id, commit_id: commit.id});
|
||||||
|
|
||||||
|
visit('/travis-ci/travis-web/jobs/'+ job.id);
|
||||||
|
|
||||||
|
andThen(function() {
|
||||||
|
assert.equal(jobPage.branch, 'acceptance-tests');
|
||||||
|
assert.equal(jobPage.message, 'acceptance-tests This is a message');
|
||||||
|
assert.equal(jobPage.state, '#1234.1 passed');
|
||||||
|
assert.equal(jobPage.author, 'Mr T authored and committed');
|
||||||
|
|
||||||
|
assert.equal(jobPage.logError, 'There was an error while trying to fetch the log.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -9,5 +9,6 @@ export default PageObject.create({
|
||||||
message: text('.build-title'),
|
message: text('.build-title'),
|
||||||
state: text('.build-status'),
|
state: text('.build-status'),
|
||||||
author: text('.commit-author'),
|
author: text('.commit-author'),
|
||||||
log: text('#log')
|
log: text('#log'),
|
||||||
|
logError: text('.job-log .notice')
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user