Skip to content

Commit

Permalink
Fix navigation via clicking recent allocation row (#6087)
Browse files Browse the repository at this point in the history
This fixes the recent allocation rows to navigate when clicking within them
rather than just on the link, which matches the cursor behaviour.
  • Loading branch information
backspace committed Aug 8, 2019
1 parent ad43dc8 commit a8c90f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/app/components/job-page/parts/recent-allocations.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -20,7 +23,7 @@ export default Component.extend({

actions: {
gotoAllocation(allocation) {
this.transitionToRoute('allocations.allocation', allocation);
this.router.transitionTo('allocations.allocation', allocation.id);
},
},
});
13 changes: 13 additions & 0 deletions ui/tests/helpers/module-for-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
1 change: 1 addition & 0 deletions ui/tests/pages/components/allocations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
}),
Expand Down

0 comments on commit a8c90f5

Please sign in to comment.