Bug 1010624

Summary: Select None/All/Default unreliable in 'Toggle Result Columns'
Product: [Retired] Beaker Reporter: wangjing <jingwang>
Component: web UIAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: developCC: aigao, asaha, dcallagh, llim, qwan, rmancy
Target Milestone: 0.15Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-03 02:27:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description wangjing 2013-09-22 05:48:57 UTC
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 07:23:30 UTC
(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-24 00:45:33 UTC
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-24 02:11:25 UTC
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-24 02:20:40 UTC
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-24 02:22:13 UTC
(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 04:26:17 UTC
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 06:51:21 UTC
On Gerrit: http://gerrit.beaker-project.org/2296

Comment 10 wangjing 2013-09-27 08:57:31 UTC
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-03 02:27:18 UTC
Beaker 0.15 has been released.