Sort allocation tables by modify index

This commit is contained in:
Michael Lange 2020-04-04 17:11:58 -07:00
parent a1d2e585a1
commit 25f4f5a61d
1 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
export default Controller.extend({
system: service(),
sortedReadAllocations: computed('model.readAllocations.@each.modifyIndex', function() {
return this.model.readAllocations.sortBy('modifyIndex').reverse();
}),
sortedWriteAllocations: computed('model.writeAllocations.@each.modifyIndex', function() {
return this.model.writeAllocations.sortBy('modifyIndex').reverse();
}),
actions: {
gotoAllocation(allocation) {
this.transitionToRoute('allocations.allocation', allocation);