diff --git a/ui/app/components/task-file.js b/ui/app/components/task-file.js index 9a6100402..4f982a7a6 100644 --- a/ui/app/components/task-file.js +++ b/ui/app/components/task-file.js @@ -100,15 +100,13 @@ export default Component.extend({ const timing = this.useServer ? this.serverTimeout : this.clientTimeout; const logFetch = url => RSVP.race([this.token.authorizedRequest(url), timeout(timing)]).then( - response => response, - error => { - if (this.useServer) { - this.set('noConnection', true); - } else { - this.send('failoverToServer'); + response => { + if (!response || !response.ok) { + this.nextErrorState(response); } - throw error; - } + return response; + }, + error => this.nextErrorState(error) ); return Log.create({ @@ -119,6 +117,15 @@ export default Component.extend({ }); }), + nextErrorState(error) { + if (this.useServer) { + this.set('noConnection', true); + } else { + this.send('failoverToServer'); + } + throw error; + }, + actions: { toggleStream() { this.set('mode', 'streaming'); diff --git a/ui/app/routes/allocations/allocation/task/fs.js b/ui/app/routes/allocations/allocation/task/fs.js index 12ee70fc4..cc0b6213a 100644 --- a/ui/app/routes/allocations/allocation/task/fs.js +++ b/ui/app/routes/allocations/allocation/task/fs.js @@ -9,9 +9,8 @@ export default Route.extend({ const pathWithTaskName = `${task.name}${decodedPath.startsWith('/') ? '' : '/'}${decodedPath}`; - return task - .stat(pathWithTaskName) - .then(statJson => { + return RSVP.all([task.stat(pathWithTaskName), task.get('allocation.node')]) + .then(([statJson]) => { if (statJson.IsDir) { return RSVP.hash({ path: decodedPath,