In the Physical Disks page, the uids for multiple devices are coming in
as same and that causes the selection to go berserk and select multiple
rows with same UID. The uid is generated in the frontend service call
itself. I just added some more parameters to it inorder to make it more
unique.
The second issue is the number of selected number getting multiplied
exponentially. Its because each time the table is updated or refreshed,
we push the row with the number of selected items we had before and that
causes the number of selection to multiply.
Fixes: https://tracker.ceph.com/issues/55523
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit
9fe18a62529037c0586edd032411f863f81b8f27)
const devices = _.flatMap(hosts, (host) => {
return host.devices.map((device) => {
device.hostname = host.name;
- device.uid = device.device_id ? device.device_id : `${device.hostname}-${device.path}`;
+ device.uid = device.device_id
+ ? `${device.device_id}-${device.hostname}-${device.path}`
+ : `${device.hostname}-${device.path}`;
return device;
});
});
if (this.updateSelectionOnRefresh === 'never') {
return;
}
- const newSelected: any[] = [];
+ const newSelected = new Set();
this.selection.selected.forEach((selectedItem) => {
for (const row of this.data) {
if (selectedItem[this.identifier] === row[this.identifier]) {
- newSelected.push(row);
+ newSelected.add(row);
}
}
});
+ const newSelectedArray = Array.from(newSelected.values());
if (
this.updateSelectionOnRefresh === 'onChange' &&
- _.isEqual(this.selection.selected, newSelected)
+ _.isEqual(this.selection.selected, newSelectedArray)
) {
return;
}
- this.selection.selected = newSelected;
+ this.selection.selected = newSelectedArray;
this.onSelect(this.selection);
}