open-nomad/ui/app/components/job-page/parts/recent-allocations.js
Buck Doyle 58f6e5d286
Fix navigation via clicking recent allocation row (#6087)
This fixes the recent allocation rows to navigate when clicking within them
rather than just on the link, which matches the cursor behaviour.
2019-08-08 09:26:46 -05:00

30 lines
776 B
JavaScript

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() {
return new PromiseArray({
promise: this.get('job.allocations').then(allocations =>
allocations
.sortBy('modifyIndex')
.reverse()
.slice(0, 5)
),
});
}),
actions: {
gotoAllocation(allocation) {
this.router.transitionTo('allocations.allocation', allocation.id);
},
},
});