github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/ui/app/components/job-page/parts/recent-allocations.js (about) 1 import Component from '@ember/component'; 2 import { computed } from '@ember/object'; 3 import PromiseArray from 'nomad-ui/utils/classes/promise-array'; 4 5 export default Component.extend({ 6 sortProperty: 'modifyIndex', 7 sortDescending: true, 8 sortedAllocations: computed('job.allocations.@each.modifyIndex', function() { 9 return new PromiseArray({ 10 promise: this.get('job.allocations').then(allocations => 11 allocations 12 .sortBy('modifyIndex') 13 .reverse() 14 .slice(0, 5) 15 ), 16 }); 17 }), 18 19 actions: { 20 gotoAllocation(allocation) { 21 this.transitionToRoute('allocations.allocation', allocation); 22 }, 23 }, 24 });