diff --git a/.changelog/24973.txt b/.changelog/24973.txt new file mode 100644 index 000000000..a82279339 --- /dev/null +++ b/.changelog/24973.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Remove unrequired node read API call when attempting to stream task logs +``` diff --git a/ui/app/components/task-log.js b/ui/app/components/task-log.js index 37085bef0..df421d63e 100644 --- a/ui/app/components/task-log.js +++ b/ui/app/components/task-log.js @@ -25,7 +25,7 @@ class MockAbortController { export default class TaskLog extends Component { @service token; @service userSettings; - + @service can; allocation = null; task = null; @@ -50,11 +50,13 @@ export default class TaskLog extends Component { @computed('allocation.{id,node.httpAddr}', 'useServer') get logUrl() { - const address = this.get('allocation.node.httpAddr'); + let address; const allocation = this.get('allocation.id'); - + if (this.can.can('read client')) { + address = this.get('allocation.node.httpAddr'); + } const url = `/v1/client/fs/logs/${allocation}`; - return this.useServer ? url : `//${address}${url}`; + return this.useServer ? url : address ? `//${address}${url}` : url; } @computed('task', 'mode') diff --git a/ui/app/routes/allocations/allocation/task/logs.js b/ui/app/routes/allocations/allocation/task/logs.js index f2e0fd9b1..c1367ccf9 100644 --- a/ui/app/routes/allocations/allocation/task/logs.js +++ b/ui/app/routes/allocations/allocation/task/logs.js @@ -7,7 +7,6 @@ import Route from '@ember/routing/route'; export default class LogsRoute extends Route { model() { - const task = super.model(...arguments); - return task && task.get('allocation.node').then(() => task); + return super.model(...arguments); } }