Problem/Motivation

1. create a new entity queue for nodes with "Simple queue" type. Enable the "Reverse order in admin view" option.
2. create nodes: node1, node2, node3, node4
3. add node1 to the queue with the 'Add item' button
4. add node2 to the queue with the 'Add item' button
5. add node3 to the queue with the 'Add item' button
6. add node4 to the queue with the 'Add item' button

Expected results are in this order:
node4
node3
node2
node1

Actual results in the table are in this order:
node4
node2
node1
node3

The whole queue is reversed when I remove entries, too. Steps to reproduce that:
1. Make sure the queue has these elements displayed in the table in this order:
node4
node3
node2
node1

2. remove node3

Expected results are in this order:
node4
node2
node1

Actual results in the table are in this order:
node1
node2
node4

Proposed resolution

It looks like when I click to a button and there's an AJAX request on that form and the "Reverse order in admin view" is enabled, it reverses the whole queue every time. Even when it was reversed before. Checking for the triggering element in the form could fix this behavior.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

kaszarobert created an issue. See original summary.

kaszarobert’s picture

Status: Active » Needs review
StatusFileSize
new2.11 KB
ocastle’s picture

I also have this same issue, but the patch doesn't quite fix it for me.
The order isn't (re)reversed upon adding a new item, which works, but the new item is added to the top of the list instead of the bottom...

ocastle’s picture

Status: Needs review » Needs work
maseyuk’s picture

Thanks the patch in #2 works well

sdstyles’s picture

Status: Needs work » Needs review
StatusFileSize
new3.18 KB
new1.94 KB

Patch #2 apparently works fine, its covering the use case when only new items are added to subqueue, the real chaos starts when you have reordered items, and a new one is added, the items order are mixed with each new added item.

I updated #2 to keep item weight order, for existing (not saved) reordered items, and newly added.
IMHO since queue is reversed new items should be added on top of others.

sdstyles’s picture

amateescu’s picture

StatusFileSize
new16.27 KB

I've been looking into this in the past few days and, as the great issue summary says, the current reverse_in_admin feature is quite broken and kind of useless IMO, so I'd like to introduce a new reverse setting that works at the storage level, not just in the UI.

Can you try out this patch and let me know if everything works as expected?

amateescu’s picture

Adding credit to @toxaviking who has been working on a very similar approach #3120866: Ability to add items to the front of the list and delete items at the bottom.

amateescu’s picture

amateescu’s picture

Title: Subqueue order flips multiple times with 'Reverse order in admin view' enabled » Replace the broken 'Reverse order in admin view' setting with a generic 'Reverse' feature
Status: Needs review » Fixed

Wrote a change record for this since it is a breaking change that we can't cover with an automatic upgrade path, and committed the patch from #8 to 8.x-1.x.

  • amateescu committed 3e56a51 on 8.x-1.x
    Issue #3093203 by sdstyles, kaszarobert, amateescu, ToxaViking: Replace...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.