mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* DHV UI init * /csi routes to /storage routes and a routeRedirector util (#25163) * /csi routes to /storage routes and a routeRedirector util * Tests and routes move csi/ to storage/ * Changelog added * [ui] Storage UI overhaul + Dynamic Host Volumes UI (#25226) * Storage index page and DHV model properties * Naive version of a storage overview page * Experimental fetch of alloc data dirs * Fetch ephemeral disks and static host volumes as an ember concurrency task and nice table stylings * Playing nice with section header labels to make eslint happy even though wcag was already cool with it * inlined the storage type explainers and reordered things, plus tooltips and keynav * Bones of a dynamic host volume individual page * Woooo dynamic host volume model, adapter, and serializer with embedded alloc relationships * Couple test fixes * async:false relationship for dhv.hasMany('alloc') to prevent a ton of xhr requests * DHV request type at index routemodel and better serialization * Pagination and searching and query params oh my * Test retrofits for csi volumes * Really fantastic flake gets fixed * DHV detail page acceptance test and a bunch of mirage hooks * Seed so that the actions test has a guaranteed task * removed ephemeral disk and static host volume manual scanning * CapacityBytes and capabilities table added to DHV detail page * Debugging actions flyout test * was becoming clear that faker.seed editing was causing havoc elsewhere so might as well not boil the ocean and just tell this test to do what I want it to * Post-create job gets taskCount instead of count * CSI volumes now get /csi route prefix at detail level * lazyclick method for unused keynav removed * keyboard nav and table-watcher for DHV added * Addressed PR comments, changed up capabilities table and id references, etc. * Capabilities table for DHV and ID in details header * Testfixes for pluginID and capabilities table on DHV page
121 lines
2.8 KiB
JavaScript
121 lines
2.8 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Controller from '@ember/controller';
|
|
import { inject as service } from '@ember/service';
|
|
import { action, 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';
|
|
import {
|
|
serialize,
|
|
deserializedQueryParam as selection,
|
|
} from 'nomad-ui/utils/qp-serialize';
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
@classic
|
|
export default class AllocationsController extends Controller.extend(
|
|
SortableFactory(['updateTime', 'healthy'])
|
|
) {
|
|
@service userSettings;
|
|
|
|
queryParams = [
|
|
{
|
|
currentPage: 'page',
|
|
},
|
|
{
|
|
sortProperty: 'sort',
|
|
},
|
|
{
|
|
sortDescending: 'desc',
|
|
},
|
|
{
|
|
qpHealth: 'healthy',
|
|
},
|
|
{
|
|
qpType: 'type',
|
|
},
|
|
];
|
|
|
|
currentPage = 1;
|
|
@readOnly('userSettings.pageSize') pageSize;
|
|
|
|
sortProperty = 'updateTime';
|
|
sortDescending = false;
|
|
|
|
qpType = '';
|
|
qpHealth = '';
|
|
|
|
@selection('qpType') selectionType;
|
|
@selection('qpHealth') selectionHealth;
|
|
|
|
@computed
|
|
get optionsType() {
|
|
return [
|
|
{ key: 'controller', label: 'Controller' },
|
|
{ key: 'node', label: 'Node' },
|
|
];
|
|
}
|
|
|
|
@computed
|
|
get optionsHealth() {
|
|
return [
|
|
{ key: 'true', label: 'Healthy' },
|
|
{ key: 'false', label: 'Unhealthy' },
|
|
];
|
|
}
|
|
|
|
@computed('model.{controllers.[],nodes.[]}')
|
|
get combinedAllocations() {
|
|
return this.model.controllers.toArray().concat(this.model.nodes.toArray());
|
|
}
|
|
|
|
@computed(
|
|
'combinedAllocations.[]',
|
|
'model.{controllers.[],nodes.[]}',
|
|
'selectionType',
|
|
'selectionHealth'
|
|
)
|
|
get filteredAllocations() {
|
|
const { selectionType: types, selectionHealth: healths } = this;
|
|
|
|
// Instead of filtering the combined list, revert back to one of the two
|
|
// pre-existing lists.
|
|
let listToFilter = this.combinedAllocations;
|
|
if (types.length === 1 && types[0] === 'controller') {
|
|
listToFilter = this.model.controllers;
|
|
} else if (types.length === 1 && types[0] === 'node') {
|
|
listToFilter = this.model.nodes;
|
|
}
|
|
|
|
if (healths.length === 1 && healths[0] === 'true')
|
|
return listToFilter.filterBy('healthy');
|
|
if (healths.length === 1 && healths[0] === 'false')
|
|
return listToFilter.filterBy('healthy', false);
|
|
return listToFilter;
|
|
}
|
|
|
|
@alias('filteredAllocations') listToSort;
|
|
@alias('listSorted') sortedAllocations;
|
|
|
|
resetPagination() {
|
|
if (this.currentPage != null) {
|
|
this.set('currentPage', 1);
|
|
}
|
|
}
|
|
|
|
setFacetQueryParam(queryParam, selection) {
|
|
this.set(queryParam, serialize(selection));
|
|
}
|
|
|
|
@action
|
|
gotoAllocation(allocation, event) {
|
|
lazyClick([
|
|
() => this.transitionToRoute('allocations.allocation', allocation.id),
|
|
event,
|
|
]);
|
|
}
|
|
}
|