Bug 1445235 - Storage subtab is unsorted and keeps sorting its items
Summary: Storage subtab is unsorted and keeps sorting its items
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Frontend.WebAdmin
Version: 4.1.1.8
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ovirt-4.1.6
: 4.1.6
Assignee: Vojtech Szocs
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-25 10:20 UTC by nicolas
Modified: 2017-09-19 10:02 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-09-19 10:02:41 UTC
oVirt Team: UX
Embargoed:
rule-engine: ovirt-4.1+
rule-engine: ovirt-4.2+
lsvaty: testing_ack+


Attachments (Terms of Use)
resorting (91.96 KB, application/octet-stream)
2017-08-11 10:15 UTC, Lucie Leistnerova
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 76639 0 master MERGED webadmin: Use default grid item comparator 2017-08-01 19:20:28 UTC
oVirt gerrit 80127 0 ovirt-engine-4.1 MERGED webadmin: Use default grid item comparator 2017-08-08 07:39:48 UTC
oVirt gerrit 80544 0 ovirt-engine-4.1 MERGED frontend: Ensure consistent item order with client-side sorting 2017-08-14 07:25:44 UTC
oVirt gerrit 80545 0 master MERGED frontend: Ensure consistent item order with client-side sorting 2017-08-11 22:59:03 UTC

Description nicolas 2017-04-25 10:20:25 UTC
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

Comment 1 Tal Nisan 2017-04-25 14:04:18 UTC
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?

Comment 2 Allon Mureinik 2017-05-07 11:31:43 UTC
Does this happen in earlier versions, or is this a regression introduced by 4.1?

Comment 3 nicolas 2017-05-08 12:32:39 UTC
As far as I can say, this already happened in 4.0 (and not sure if even earlier), I just reported it now.

Comment 4 Vojtech Szocs 2017-05-09 16:21:38 UTC
(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.

Comment 5 Vojtech Szocs 2017-06-02 18:51:13 UTC
Note: the posted fix should affect all UI tables (including the one reported in this BZ).

Comment 6 Vojtech Szocs 2017-08-02 16:05:22 UTC
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.

Comment 7 Lucie Leistnerova 2017-08-11 10:14:30 UTC
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

Comment 8 Red Hat Bugzilla Rules Engine 2017-08-11 10:14:35 UTC
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.

Comment 9 Lucie Leistnerova 2017-08-11 10:15:10 UTC
Created attachment 1312048 [details]
resorting

Comment 10 Vojtech Szocs 2017-08-11 15:33:22 UTC
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.

Comment 11 Lucie Leistnerova 2017-08-28 07:35:52 UTC
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


Note You need to log in before you can comment on or make changes to this bug.