Description of problem: In the Data Centers tab, Storage subtabs, the list of storage domains is unsorted and when you click on one of them, after a few seconds, the list resorts its values and make the mouse selection "jump" to a different place, which is quite confusing. Version-Release number of selected component (if applicable): 4.1.1.8 How reproducible: Always Steps to Reproduce: 1. Open the Storage Domains tab 2. Make sure the Storage subtab is opened 3. Click on any of the values in the list. Actual results: After a while, the list is re-sorted and the selected item moved to a different place in the list Expected results: The list should be kept alphabetically sorted
Just reproduced, the key to reproduce is to select a sorting by a value that is similar to a few storage domains such as "Status", in that case the sorting can change while actually keeping the order we've selected (as for instance "Active" items are still grouped together and sorted accordingly but reordered between themselves). Vojtech, Alex, do we have a solution for that?
Does this happen in earlier versions, or is this a regression introduced by 4.1?
As far as I can say, this already happened in 4.0 (and not sure if even earlier), I just reported it now.
(In reply to Tal Nisan from comment #1) > Just reproduced, the key to reproduce is to select a sorting by a value that > is similar to a few storage domains such as "Status", in that case the > sorting can change while actually keeping the order we've selected (as for > instance "Active" items are still grouped together and sorted accordingly > but reordered between themselves). > Vojtech, Alex, do we have a solution for that? IMO the proper solution is to apply a "sort by ID" fallback on top of any user-selected sorting. What's happening here is following (Tal, please correct me if I'm wrong here): 1, user selects some item in "Data Centers" main-tab, sub-tab panel appears 2, user switches to "Storage" sub-tab, which loads its data via `GetStorageDomainsByStoragePoolId` query [DataCenterStorageListModel#syncSearch] 3, user applies sorting in the sub-tab 4, **all sub-tabs DO NOT support server-side sorting, they sort their data locally** 5, after a few seconds, the main-tab automatically refreshes its data (based on the value selected in refresh drop-down), which triggers `RefreshActiveModelEvent` 6, the currently active sub-tab responds to that event and calls Engine query again, but this time, items are rendered in different order (grouping works, but order within a group can differ) This bug is related to ColumnResizeCellTable#initModelSortHandler method, see the code below "Otherwise, fall back to client-side sorting" comment. Specifically, the following code: Comparator<? super T> comparator = sortableColumn.getComparator(); can be modified to apply the "sort by ID" fallback on top of the user-provided comparator, which can yield consistent sorting within a given group (same value for multiple rows, e.g. multiple storages with same "status") Note: SortedListModel + SearchableListModel should be merged together, they create unnecessary confusion and complicate our code.
Note: the posted fix should affect all UI tables (including the one reported in this BZ).
This issue still exists on Network / Vnic Profiles detail grid, pressing the refresh button repeatedly can cause "jumpy" item order. Note that this issue disappears (forever for the given grid) once the user applies UI column sort.
The issue still appears, see video Steps to reproduce: 1. have more active storages, go to DC -> Storage subtab 2. sort by Status and select one of the storages 3. open new window and log into admin portal 4. here rename one storage 5. go to the first window and stay with mouse in the Storage subtab 6. sometimes after a while storages are resorted (not depending on the new storage name) I reproduced it 3 times. Tested in ovirt-engine-4.1.5.2-0.1.el7.noarch
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.
Created attachment 1312048 [details] resorting
This fix (apply consistent item order) currently applies only when the given table is not explicitly sorted by the user. In the video posted by Lucie the DC/Storage table is explicitly sorted by the "Status" column, therefore the fix doesn't apply. The assumption was that once explicitly sorted, the sort algorithm will be consistent. Looks like this assumption was incorrect and we'll need to apply default item order after the specific sort happens. Working on a solution now.
Order in storages doesn't change when sorted by user or by default. verified in ovirt-engine-webadmin-portal-4.1.6-0.1.el7.noarch