diff --git a/.changelog/23306.txt b/.changelog/23306.txt new file mode 100644 index 00000000000..36c48fa0bd9 --- /dev/null +++ b/.changelog/23306.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: unbind job detail running allocations count from job-summary endpoint +``` diff --git a/ui/app/components/job-status/panel/steady.hbs b/ui/app/components/job-status/panel/steady.hbs index 9ae423798d8..1c6aa1c2ef1 100644 --- a/ui/app/components/job-status/panel/steady.hbs +++ b/ui/app/components/job-status/panel/steady.hbs @@ -32,7 +32,7 @@ All allocations have completed successfully {{else}} - {{@job.runningAllocs ~}} + {{this.runningAllocs.length ~}} {{#unless this.atMostOneAllocPerNode ~}} {{#if (eq @job.type "batch") ~}} /{{this.totalNonCompletedAllocs}} @@ -42,7 +42,7 @@ {{/unless}} {{#if (eq @job.type "batch") ~}}Remaining{{/if}} - {{pluralize "Allocation" @job.runningAllocs}} Running + {{pluralize "Allocation" this.runningAllocs.length}} Running {{/if}} diff --git a/ui/app/components/job-status/panel/steady.js b/ui/app/components/job-status/panel/steady.js index ac03654b7dd..a4aabdd0c79 100644 --- a/ui/app/components/job-status/panel/steady.js +++ b/ui/app/components/job-status/panel/steady.js @@ -185,6 +185,10 @@ export default class JobStatusPanelSteadyComponent extends Component { return this.job.allocations.filter((a) => !a.isOld && a.hasBeenRestarted); } + get runningAllocs() { + return this.job.allocations.filter((a) => a.clientStatus === 'running'); + } + get completedAllocs() { return this.job.allocations.filter( (a) => !a.isOld && a.clientStatus === 'complete' diff --git a/ui/tests/acceptance/job-status-panel-test.js b/ui/tests/acceptance/job-status-panel-test.js index be98f631f06..8939723317e 100644 --- a/ui/tests/acceptance/job-status-panel-test.js +++ b/ui/tests/acceptance/job-status-panel-test.js @@ -979,19 +979,6 @@ module('Acceptance | job status panel', function (hooks) { 'job', JSON.stringify([job.id, 'default']) ); - // Weird Mirage thing: job summary factory is disconnected from its job and therefore allocations. - // So we manually create the number here. - let summary = await storedJob.get('summary'); - summary - .get('taskGroupSummaries') - .objectAt(0) - .set( - 'runningAllocs', - server.schema.allocations.where({ - jobId: job.id, - clientStatus: 'running', - }).length - ); await settled(); @@ -1020,17 +1007,8 @@ module('Acceptance | job status panel', function (hooks) { nodeId: newNode.id, }); - summary - .get('taskGroupSummaries') - .objectAt(0) - .set( - 'runningAllocs', - server.schema.allocations.where({ - jobId: job.id, - clientStatus: 'running', - }).length - ); - + // simulate a blocking query update from /allocations + storedJob.allocations.reload(); await settled(); assert.dom('.running-allocs-title').hasText('4 Allocations Running');