Bug 1010624 - Select None/All/Default unreliable in 'Toggle Result Columns'
Select None/All/Default unreliable in 'Toggle Result Columns'
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: web UI (Show other bugs)
develop
Unspecified Unspecified
medium Severity low (vote)
: 0.15
: ---
Assigned To: Dan Callaghan
tools-bugs
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-22 01:48 EDT by wangjing
Modified: 2013-10-02 22:27 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-02 22:27:18 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description wangjing 2013-09-22 01:48:57 EDT
Description of problem:
cannot shift 'Select None', 'Select All', and 'Select Default' repeatedly.

Version-Release number of selected component (if applicable):
Version 0.14.1 beaker-devel

How reproducible:
always

Steps to Reproduce:
1. page: Systems->all, click 'show Search Options'.
2. click 'Toggle Result Columns'.
3. click 'Select All', then click 'Select None'.
4. click 'Select All' again, or click 'Select Default'.

Actual results:
after step4, no response on web.

Expected results:
after step4, 'Select All' or 'Select Default' should take effect.

Additional info:
I must reopen the page, then clicking 'Select Default' would take effect.
Comment 2 Raymond Mancy 2013-09-23 03:23:30 EDT
(In reply to wangjing from comment #0)
> Description of problem:
> cannot shift 'Select None', 'Select All', and 'Select Default' repeatedly.
> 
> Version-Release number of selected component (if applicable):
> Version 0.14.1 beaker-devel
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1. page: Systems->all, click 'show Search Options'.
> 2. click 'Toggle Result Columns'.
> 3. click 'Select All', then click 'Select None'.
> 4. click 'Select All' again, or click 'Select Default'.
> 
> Actual results:
> after step4, no response on web.
> 
> Expected results:
> after step4, 'Select All' or 'Select Default' should take effect.
> 
> Additional info:
> I must reopen the page, then clicking 'Select Default' would take effect.

I could not reproduce this bug. What version of what browser are you running?
Comment 3 Nick Coghlan 2013-09-23 20:45:33 EDT
I can reproduce this - Firefox 23.0.1 under KDE in Fedora 19.

First time I opened "Toggle Result Columns" the Select None/All/Default links did nothing.

Second time (after hitting Ctrl-F5) they worked for during one cycle of clicking None->All->Default->None but then stopped responding.
Comment 4 Nick Coghlan 2013-09-23 22:11:25 EDT
Poking around in the JS debugger, looking at the final search toggle (System/Vendor)

Immediately after loading the page, run this in the console:

    $("input[name *= 'systemsearch_column_']")

Item 29 (the System/Vendor toggle) shows it has no checked attribute listed in "attributes" and the "checked" property is shown as false

Then run the same code that clicking Select All runs:

    $("input[name *= 'systemsearch_column_']").attr('checked', 1);

Item 29 now shows a new attribute ("checked") in the attribute list, and the "checked" property is shown as "true". The checkboxes in the web page are all also checked as expected.

Now run the equivalent of clicking Select None:

    $("input[name *= 'systemsearch_column_']").removeAttr('checked');

Item 29 appears to have reverted to the same state it was in when the page was first loaded and all the checkboxes are cleared as expected. However, now try running the Select All code again:

    $("input[name *= 'systemsearch_column_']").attr('checked', 1);

The "checked" attribute once again is added back to the attribute list, but the "checked" property remains "false", and the checkboxes in the web UI remain unchecked. The "checked" property can be forced back to "true" through the JS console and then the web UI checkbox updates as expected.

So, any theories on what state might have changed between the first and second attempts to set the attribute to cause the same JS to react differently?
Comment 5 Dan Callaghan 2013-09-23 22:20:40 EDT
Sounds like it might be a problem of properties vs. attributes, which was changed a bit in jQuery 1.9+ (so this might be a regression from upgrading to jQuery 2):

http://api.jquery.com/prop/

It might just be a matter of changing all the .attr('checked', 1) to .prop('checked', true) resp. .removeAttr('checked') to .prop('checked', false).
Comment 6 Dan Callaghan 2013-09-23 22:22:13 EDT
(In reply to Dan Callaghan from comment #5)
> Sounds like it might be a problem of properties vs. attributes, which was
> changed a bit in jQuery 1.9+

Actually in jQuery 1.6 but we were upgrading from jQuery 1.5 so the theory stands.
Comment 7 Nick Coghlan 2013-09-24 00:26:17 EDT
Trying Dan's suggested changes in the JS console result in the checkboxes being set and cleared appropriately, so sounds good to me.
Comment 8 Dan Callaghan 2013-09-25 02:51:21 EDT
On Gerrit: http://gerrit.beaker-project.org/2296
Comment 10 wangjing 2013-09-27 04:57:31 EDT
verified on beaker-devel Version 0.15.0rc2(2013-927)-->pass

Steps:
1. page: Systems->all, click 'show Search Options'.
2. click 'Toggle Result Columns'.
3. click 'Select All', then click 'Select None'.
4. click 'Select All' again, or click 'Select Default'.

Actual results:
same as expected results

Expected results:
after step4, 'Select All' or 'Select Default' should take effect.
Comment 11 Nick Coghlan 2013-10-02 22:27:18 EDT
Beaker 0.15 has been released.

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