If the hostname is selected for the primary devices, then we can
preselect the hostname filter for the db/wal devices because osds will
be deployed only on the hostname of the primary device. If preselected
it'll be clear that only this devices will be used to deploy.
Addition to this, usually ssd devices are used for db/wal devices. So I
am preselecting these too in the filters.
Fixes: https://tracker.ceph.com/issues/57118
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit
5f8eff3beff7b8aa0066811dedf0024b76001a6e)
// 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 = [];