Skip to content

Commit e24adc9

Browse files
authored
Merge pull request ceph#46174 from rhcs-dashboard/physical-disks-selection
mgr/dashboard: devices with same UID causes multiselection Reviewed-by: Sarthak0702 <NOT@FOUND> Reviewed-by: Aashish Sharma <[email protected]> Reviewed-by: Avan Thakkar <[email protected]> Reviewed-by: Ernesto Puerta <[email protected]> Reviewed-by: Pere Diaz Bou <[email protected]>
2 parents 84f7da7 + 9fe18a6 commit e24adc9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ export class HostService extends ApiClient {
141141
const devices = _.flatMap(hosts, (host) => {
142142
return host.devices.map((device) => {
143143
device.hostname = host.name;
144-
device.uid = device.device_id ? device.device_id : `${device.hostname}-${device.path}`;
144+
device.uid = device.device_id
145+
? `${device.device_id}-${device.hostname}-${device.path}`
146+
: `${device.hostname}-${device.path}`;
145147
return device;
146148
});
147149
});

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,21 +668,22 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
668668
if (this.updateSelectionOnRefresh === 'never') {
669669
return;
670670
}
671-
const newSelected: any[] = [];
671+
const newSelected = new Set();
672672
this.selection.selected.forEach((selectedItem) => {
673673
for (const row of this.data) {
674674
if (selectedItem[this.identifier] === row[this.identifier]) {
675-
newSelected.push(row);
675+
newSelected.add(row);
676676
}
677677
}
678678
});
679+
const newSelectedArray = Array.from(newSelected.values());
679680
if (
680681
this.updateSelectionOnRefresh === 'onChange' &&
681-
_.isEqual(this.selection.selected, newSelected)
682+
_.isEqual(this.selection.selected, newSelectedArray)
682683
) {
683684
return;
684685
}
685-
this.selection.selected = newSelected;
686+
this.selection.selected = newSelectedArray;
686687
this.onSelect(this.selection);
687688
}
688689

0 commit comments

Comments
 (0)