diff --git a/ui/app/controllers/csi/plugins/plugin/allocations.js b/ui/app/controllers/csi/plugins/plugin/allocations.js new file mode 100644 index 000000000..0d2168684 --- /dev/null +++ b/ui/app/controllers/csi/plugins/plugin/allocations.js @@ -0,0 +1,43 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; +import { computed } from '@ember/object'; +import { alias, readOnly } from '@ember/object/computed'; +import SortableFactory from 'nomad-ui/mixins/sortable-factory'; +import { lazyClick } from 'nomad-ui/helpers/lazy-click'; + +export default Controller.extend(SortableFactory(['updateTime', 'healthy']), { + userSettings: service(), + + queryParams: { + currentPage: 'page', + sortProperty: 'sort', + sortDescending: 'desc', + }, + + currentPage: 1, + pageSize: readOnly('userSettings.pageSize'), + + sortProperty: 'updateTime', + sortDescending: false, + + combinedAllocations: computed('model.controllers.[]', 'model.nodes.[]', function() { + return this.model.controllers.toArray().concat(this.model.nodes.toArray()); + }), + + listToSort: alias('combinedAllocations'), + sortedAllocations: alias('listSorted'), + // TODO: Add facets for filtering + filteredAllocations: alias('sortedAllocations'), + + resetPagination() { + if (this.currentPage != null) { + this.set('currentPage', 1); + } + }, + + actions: { + gotoAllocation(allocation, event) { + lazyClick([() => this.transitionToRoute('allocations.allocation', allocation), event]); + }, + }, +}); diff --git a/ui/app/templates/csi/plugins/plugin/allocations.hbs b/ui/app/templates/csi/plugins/plugin/allocations.hbs new file mode 100644 index 000000000..6ace3a5db --- /dev/null +++ b/ui/app/templates/csi/plugins/plugin/allocations.hbs @@ -0,0 +1,66 @@ +{{title "CSI Plugin " model.plainID " allocations"}} +
+