diff --git a/.changelog/28137.txt b/.changelog/28137.txt new file mode 100644 index 00000000000..7956c7b6967 --- /dev/null +++ b/.changelog/28137.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: fixes an issue where streaming task logs would error +``` diff --git a/ui/app/routes/allocations/allocation/task/logs.js b/ui/app/routes/allocations/allocation/task/logs.js index 987283e4c39..ef2cfc1e41e 100644 --- a/ui/app/routes/allocations/allocation/task/logs.js +++ b/ui/app/routes/allocations/allocation/task/logs.js @@ -4,9 +4,20 @@ */ import Route from '@ember/routing/route'; +import { service } from '@ember/service'; export default class LogsRoute extends Route { + @service abilities; model() { - return this.modelFor('allocations.allocation.task'); + const task = this.modelFor('allocations.allocation.task'); + // streaming logs can require the node object to be loaded + // in order for the logUrl() function to correctly use the + // allocation.node.httpAddr property. + // An alternative option here is to use just allocation.node + // as the computed property for logUrl() + if (this.abilities.can('read client')) { + return task && task.get('allocation.node').then(() => task); + } + return task; } }