diff --git a/ui/app/components/job-page/parts/recent-allocations.js b/ui/app/components/job-page/parts/recent-allocations.js index 6b2005da05b7..9729eb47c982 100644 --- a/ui/app/components/job-page/parts/recent-allocations.js +++ b/ui/app/components/job-page/parts/recent-allocations.js @@ -1,10 +1,13 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; +import { inject as service } from '@ember/service'; import PromiseArray from 'nomad-ui/utils/classes/promise-array'; export default Component.extend({ classNames: ['boxed-section'], + router: service(), + sortProperty: 'modifyIndex', sortDescending: true, sortedAllocations: computed('job.allocations.@each.modifyIndex', function() { @@ -20,7 +23,7 @@ export default Component.extend({ actions: { gotoAllocation(allocation) { - this.transitionToRoute('allocations.allocation', allocation); + this.router.transitionTo('allocations.allocation', allocation.id); }, }, }); diff --git a/ui/tests/helpers/module-for-job.js b/ui/tests/helpers/module-for-job.js index 0cd34c5a863a..a8ad066900bd 100644 --- a/ui/tests/helpers/module-for-job.js +++ b/ui/tests/helpers/module-for-job.js @@ -54,6 +54,19 @@ export default function moduleForJob(title, context, jobFactory, additionalTests assert.ok(JobDetail.allocationsSummary, 'Allocations are shown in the summary section'); assert.notOk(JobDetail.childrenSummary, 'Children are not shown in the summary section'); }); + + test('clicking in an allocation row navigates to that allocation', async function(assert) { + const allocationRow = JobDetail.allocations[0]; + const allocationId = allocationRow.id; + + await allocationRow.visitRow(); + + assert.equal( + currentURL(), + `/allocations/${allocationId}`, + 'Allocation row links to allocation detail' + ); + }); } if (context === 'children') { diff --git a/ui/tests/pages/components/allocations.js b/ui/tests/pages/components/allocations.js index 99307e5c7826..e00c129be6dc 100644 --- a/ui/tests/pages/components/allocations.js +++ b/ui/tests/pages/components/allocations.js @@ -19,6 +19,7 @@ export default function(selector = '[data-test-allocation]', propKey = 'allocati rescheduled: isPresent('[data-test-indicators] [data-test-icon="reschedule"]'), visit: clickable('[data-test-short-id] a'), + visitRow: clickable(), visitJob: clickable('[data-test-job]'), visitClient: clickable('[data-test-client] a'), }),