// Do not display these columns
@Input() hiddenColumns: string[] = [];
+ @Input() hostname = '';
+
+ @Input() diskType = '';
+
// Show filters for these columns, specify empty array to disable
@Input() filterColumns = [
'hostname',
if (col) {
col.filterable = true;
}
+
+ if (col?.prop === 'human_readable_type' && this.diskType === 'ssd') {
+ col.filterInitValue = this.diskType;
+ }
+
+ if (col?.prop === 'hostname' && this.hostname) {
+ col.filterInitValue = this.hostname;
+ }
});
if (this.fetchInventory.observers.length > 0) {
}
showSelectionModal() {
- let filterColumns = ['human_readable_type', 'sys_api.vendor', 'sys_api.model', 'sys_api.size'];
- if (this.type === 'data') {
- filterColumns = ['hostname', ...filterColumns];
- }
+ const filterColumns = [
+ 'hostname',
+ 'human_readable_type',
+ 'sys_api.vendor',
+ 'sys_api.model',
+ 'sys_api.size'
+ ];
+ const diskType = this.name === 'Primary' ? 'hdd' : 'ssd';
const initialState = {
hostname: this.hostname,
deviceType: this.name,
+ diskType: diskType,
devices: this.availDevices,
filterColumns: filterColumns
};
<cd-inventory-devices #inventoryDevices
[devices]="devices"
[filterColumns]="filterColumns"
- [showAvailDeviceOnly]="true"
+ [hostname]="hostname"
+ [diskType]="diskType"
[hiddenColumns]="['available', 'osd_ids']"
(filterChange)="onFilterChange($event)">
</cd-inventory-devices>
-import { AfterViewInit, Component, EventEmitter, Output, ViewChild } from '@angular/core';
+import {
+ AfterViewInit,
+ ChangeDetectorRef,
+ Component,
+ EventEmitter,
+ Output,
+ ViewChild
+} from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { TableColumnProp } from '@swimlane/ngx-datatable';
hostname: string;
deviceType: string;
+ diskType: string;
formGroup: CdFormGroup;
action: string;
constructor(
private formBuilder: CdFormBuilder,
+ private cdRef: ChangeDetectorRef,
public activeModal: NgbActiveModal,
public actionLabels: ActionLabelsI18n,
public wizardStepService: WizardStepsService
this.capacity = _.sumBy(this.filteredDevices, 'sys_api.size');
this.event = event;
}
+ this.cdRef.detectChanges();
}
onSubmit() {
[availDevices]="availDevices"
[canSelect]="dataDeviceSelectionGroups.devices.length !== 0"
(selected)="onDevicesSelected($event)"
- (cleared)="onDevicesCleared($event)">
+ (cleared)="onDevicesCleared($event)"
+ [hostname]="hostname">
</cd-osd-devices-selection-groups>
<!-- WAL slots -->
[availDevices]="availDevices"
[canSelect]="dataDeviceSelectionGroups.devices.length !== 0"
(selected)="onDevicesSelected($event)"
- (cleared)="onDevicesCleared($event)">
+ (cleared)="onDevicesCleared($event)"
+ [hostname]="hostname">
</cd-osd-devices-selection-groups>
<!-- DB slots -->
onDevicesCleared(event: DevicesSelectionClearEvent) {
if (event.type === 'data') {
+ this.hostname = '';
this.availDevices = [...this.allDevices];
this.walDeviceSelectionGroups.devices = [];
this.dbDeviceSelectionGroups.devices = [];