diff --git a/ui/app/controllers/clients/client.js b/ui/app/controllers/clients/client.js index 26dfc9b64..9044fd1f7 100644 --- a/ui/app/controllers/clients/client.js +++ b/ui/app/controllers/clients/client.js @@ -10,6 +10,7 @@ export default Controller.extend(Sortable, Searchable, { searchTerm: 'search', sortProperty: 'sort', sortDescending: 'desc', + onlyPreemptions: 'preemptions', }, currentPage: 1, @@ -20,10 +21,25 @@ export default Controller.extend(Sortable, Searchable, { searchProps: computed(() => ['shortId', 'name']), - listToSort: alias('model.allocations'), + onlyPreemptions: false, + + visibleAllocations: computed( + 'model.allocations.[]', + 'preemptions.[]', + 'onlyPreemptions', + function() { + return this.onlyPreemptions ? this.preemptions : this.model.allocations; + } + ), + + listToSort: alias('visibleAllocations'), listToSearch: alias('listSorted'), sortedAllocations: alias('listSearched'), + preemptions: computed('model.allocations.@each.wasPreempted', function() { + return this.model.allocations.filterBy('wasPreempted'); + }), + sortedEvents: computed('model.events.@each.time', function() { return this.get('model.events') .sortBy('time') @@ -38,5 +54,9 @@ export default Controller.extend(Sortable, Searchable, { gotoAllocation(allocation) { this.transitionToRoute('allocations.allocation', allocation); }, + + setPreemptionFilter(value) { + this.set('onlyPreemptions', value); + }, }, }); diff --git a/ui/app/styles/components/badge.scss b/ui/app/styles/components/badge.scss index 60f4f2c74..98087d9d8 100644 --- a/ui/app/styles/components/badge.scss +++ b/ui/app/styles/components/badge.scss @@ -4,6 +4,7 @@ line-height: 1; border-radius: $radius; padding: 0.25em 0.75em; + border: none; @each $name, $pair in $colors { $color: nth($pair, 1); @@ -43,3 +44,7 @@ background: lighten($grey-blue, 10%); } } + +button.badge { + cursor: pointer; +} diff --git a/ui/app/templates/clients/client.hbs b/ui/app/templates/clients/client.hbs index 99e36f697..87a30f58f 100644 --- a/ui/app/templates/clients/client.hbs +++ b/ui/app/templates/clients/client.hbs @@ -95,7 +95,17 @@