core icon indicating copy to clipboard operation
core copied to clipboard

Role Filtering Select Bug

Open cfalzone opened this issue 13 years ago • 4 comments

Our Filtering Selects for roles can get into a case where they would not show the "more options" selection if there are more than the 30 roles to show.

The issue is with the class that fetches the role listing for the store that the filtering selects use: https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/ajax/WfRoleStoreAjax.java#L86

If you get count number of items in the first loop of that while (i.e. none of the if conditions to remove a role from the returned list are met in the for loop), The json list is returned to the store with less than or equal to the requested amount of items. If the store asks for 30 items and gets less than or equal to 30 items it will not show "more options".

To get this to happen you have to have a bunch roles/users that come alphabetically before any system roles. So add roles like "AA Role 1" to "AA Role 30" and you will hit the bug. I demonstrate this in the current master in my screencast linked below.

I also post a screencast to a workaround for those hit by this bug.

One possible way to resolve this bug would be to just change while loop to "while(roleList.size() < count+1)" items instead of "while (roleList.size() < count)". Not sure if this is the best option though, it seems bad logic to rely on that, dojo most likely has a better way to handle this in the store, like returning the total number of results in the response or something.

Also, I think we should move the logic that removes the default user from the list from the method that generates the json to the for loop. It seems weird to have this logic separate from the other logic: https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/ajax/WfRoleStoreAjax.java#L213

Also, a very minor deal, but I think the following line could be improved so that we are not going to the apiLocator to get the roleAPI every time in the for loop, especially since we have already retrieved the roleAPI outside of the loop. Just a thought: https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/ajax/WfRoleStoreAjax.java#L104

Screencast showing issue: http://screencast.com/t/WBNn7lNFwAB Screencast showing workaround: http://screencast.com/t/Zg22vici0mm5

cfalzone avatar Dec 19 '12 14:12 cfalzone

I don't know if I did something wrong but it did not link my first commit and close the issue:
https://github.com/dotCMS/dotCMS/commit/7b12af649620e230671e2d21bc8ad3526533482c

cfalzone avatar Dec 21 '12 13:12 cfalzone

Note to QA and others we have one more improvement still for this https://github.com/dotCMS/dotCMS/issues/1760

jtesser avatar Jan 02 '13 15:01 jtesser

Fixed.... working fine with pagination in the drop-down... Tested on dotCMS 2.5 // W7 // Chrome

http://screencast.com/t/Zci1oZfTqDht

bryanboza avatar Jan 07 '13 21:01 bryanboza

Added 40 roles and filtered with pagination finding roles not in the current displayed listing... filtering working accross entire list.. not just the ones shown on a page... good fix

DeanGonzalez avatar Feb 22 '13 17:02 DeanGonzalez