From 512c1051c358d75a3f9fef42497ba2dac8b0d8f8 Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Wed, 7 Aug 2019 12:16:41 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Add=20test=20for=20clicking=20job=E2=80=99s?= =?UTF-8?q?=20recent=20allocation=20row?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/tests/helpers/module-for-job.js | 13 +++++++++++++ ui/tests/pages/components/allocations.js | 1 + 2 files changed, 14 insertions(+) diff --git a/ui/tests/helpers/module-for-job.js b/ui/tests/helpers/module-for-job.js index 0cd34c5a863..a8ad066900b 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 99307e5c782..e00c129be6d 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'), }), From 036919c7341459032c5fd2f08d9bb4a5924f214c Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Wed, 7 Aug 2019 12:25:01 -0500 Subject: [PATCH 2/2] Fix navigation to recent allocation --- ui/app/components/job-page/parts/recent-allocations.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/app/components/job-page/parts/recent-allocations.js b/ui/app/components/job-page/parts/recent-allocations.js index 6b2005da05b..9729eb47c98 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); }, }, });