+++ This bug was initially created as a clone of Bug #406181 +++ Description: On certain pages Ajax optimizations are used to speed up page loading time. Red Hat has a high number of components for certain products. The component lists cause a large amount of HTML having to be downloaded by the client browser. The Ajax functions allow the UI to only show the components needed depending on which products are selected. Function Requirements: Only load full list products, components, and versions on show_bug.cgi if user requests it. Link is located next to the appropriate drop down that when clicked will download the full list and re-populate the drop down menu with the full list of choices.
LOC Estimation: Code is shared with other pages such as query.cgi. Javascript code libraries is counted in bug 426374. templates: 60 selenium tests to verify the proper operation of product/version/components: 2 hours LOC Total: 60
Created attachment 300091 [details] Patch to use ajax to update component drop down on show_bug.cgi (v1) I have created a patch to convert the component drop down on show_bug.cgi to update its list using ajax on demand. This cuts down the page load time for products with large number of components such as Fedora. It starts out as a single value which is the current component for the bug. If a use clicks on Update Components it then updates the list to include all components, reselecting the current component. The Update Components links should then disappear. This is using an updated bugzilla.getProductDetails() XMLRPC call instead of a custom ajax server side method. This allows code to be reused for multiple purposes. I have this patch running on https://bugdev.devel.redhat.com/bugzilla if you want to test it. Please review. Dave
Hi Dave,, is the attached patch missing aything? I applied it to my localhost and couldn't see update components link in show_bug.cgi also checked bugdev and couldn't see it.
Dave ,, Just in case you will wonder if i have javascript enabled ,, I doubled checked firefox and it was enabled. Noura
(In reply to comment #4) > Dave ,, Just in case you will wonder if i have javascript enabled ,, I doubled > checked firefox and it was enabled. > > Noura I have two many patches going on at once unfortunately :) This one requires the user.javascript patch to be applied in bug 426386 to work. Also I need to add a new patch for this since I have found some bugs that I have fixed. New patch coming. Dave
Is this on bugdev?
Created attachment 302663 [details] Patch to use ajax to update component drop down on show_bug.cgi (v2) Attaching new patch. Redesigned the way this is done pretty significantly. Using a new Product.get method to get the component info. Also made the component field look similar to assignee, qa contact, etc. on the UI. It shows the value as a readonly with the (edit) link beside it if the user can edit the field. Once you click on the (edit) link, it displays an updated drop down with the full list of components. Please review Dave
Comment on attachment 302663 [details] Patch to use ajax to update component drop down on show_bug.cgi (v2) Noura please review paying close attention to the new Product.get method I added. Please let me know if that could be done better. Thanks Dave
Comment on attachment 302663 [details] Patch to use ajax to update component drop down on show_bug.cgi (v2) + my @ids = ref($params->{ids}) ? @{$params->{ids}} : ($params->{ids}); + my $obj_by_ids = Bugzilla::Product->new_from_list(\@ids) if $params->{ids}; + + my @names = ref($params->{names}) =~ /ARRAY/ ? @{$params->{names}} : + ($params->{names}); XXX-kab-start Nitpik on: why pull @names like this and @ids above differently? And using a regex like that is very very slightly error prone. my @names = ref($params->{names}) =~ /ARRAY/ ? @{$params->{names}} : Howabout + my @names = ref($params->{names}) eq 'ARRAY' ? @{$params->{names}} : + ($params->{names}); Is $params->{names} always guaranteed to have a value? If not then this will cause lots of annoying warnings in the log. And is a ref in $params->{ids} always guaranteed to be an ARRAY ref? + my @ids = ref($params->{ids}) eq 'ARRAY' ? @{$params->{ids}} : ($params->{ids}); nitpik off XXX-kab-end
Comment on attachment 302663 [details] Patch to use ajax to update component drop down on show_bug.cgi (v2) Looks ok to me. My javascript chops aren't that hot to pick up any subtle issues but looks straight forward.
(In reply to comment #9) > XXX-kab-start > > Nitpik on: > why pull @names like this and @ids above differently? > And using a regex like that is very very slightly error prone. > my @names = ref($params->{names}) =~ /ARRAY/ ? @{$params->{names}} : > Howabout > + my @names = ref($params->{names}) eq 'ARRAY' ? @{$params->{names}} : > + ($params->{names}); > Is $params->{names} always guaranteed to have a value? If not then this will > cause lots of annoying warnings in the log. > And is a ref in $params->{ids} always guaranteed to be an ARRAY ref? > + my @ids = ref($params->{ids}) eq 'ARRAY' ? @{$params->{ids}} : > ($params->{ids}); > nitpik off > XXX-kab-end > Pulled from work done by Noura in Bugzilla/WebService/Component::_get_accessible_components(). This was the code style that was accepted upstream.
Comment on attachment 302663 [details] Patch to use ajax to update component drop down on show_bug.cgi (v2) Hi Dave,, Patch looks good to me and the xmlrpc function Product.get works nicely. Only one thing i noticed while testing in bugdev.devel was that when updating component and clicking the submit button you get redirected to process_bug.cgi,, if you try to update the component in that process_bug.cgi the component list fails to load which is not the case currently in RHBZ 2.18 Noura
(In reply to comment #12) > (From update of attachment 302663 [details] [edit]) > Hi Dave,, > > Patch looks good to me and the xmlrpc function Product.get works nicely. Only > one thing i noticed while testing in bugdev.devel was that when updating > component and clicking the submit button you get redirected to > process_bug.cgi,, if you try to update the component in that process_bug.cgi > the component list fails to load which is not the case currently in RHBZ 2.18 > > Noura Thanks for the review Noura. You did in fact find a bug where I was forgetting to load the necessary js files in bug/create/created.html.tmpl and bug/process/header.html.tmpl in the PROCESS header section. I have added them in and it is working fine now. Will check this in to CVS. Dave >
Worked 8 hours.
Comment on attachment 300091 [details] Patch to use ajax to update component drop down on show_bug.cgi (v1) newer version has been reviewed.