Closed Bug 1191706 Opened 10 years ago Closed 9 years ago

When editing flag types, components do not match the selected product when classifications are enabled

Categories

(Bugzilla :: Administration, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: gdsotirov, Assigned: LpSolit)

References

()

Details

Attachments

(1 file, 3 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0 Build ID: 20150630154324 Steps to reproduce: 1. Log into into a Bugzilla installation as an administrator; 2. Go to Administration -> Flags; 3. In "Product:" select a product; 4. Check the contents of "Component:" list. Actual results: List of components do not match the product that was selected. In fact, they belong to another product. Expected results: The list of components should match the selected product, just like on Advanced Search page.
OS: Unspecified → All
Hardware: Unspecified → All
This is what I get on Advanced Search page for a product in my installation.
And this is what I get on Administer Flag Types page for the same product in my installation. In fact, those are the components of another product.
Attachment #8644192 - Attachment description: product_components_in_flag_types_list.png → Product components on Administer Flag Types page
It's the same on Edit Flag Type page and as a consequence if I try to create a flag for a specific component of the product, I get error "Product 'SlackPack' has no component named 'Applications'." (for example), so I'm not able to do so.
2 questions: 1) Is there any product in your installation which has no components at all? Newer Bugzilla versions forbid this, but older ones allowed products to have no components, and this was the reason why this problem happened in the past. 2) Can you reproduce the issue if classifications are disabled?
Assignee: ui → administration
Component: User Interface → Administration
I'm sorry for the delay of my answer, but strangely I haven't received any mail for your comment. Anyway, here are the answers: 1) No, even though my installation is quite old (about 10 years and going). Here's the prove: mysql> select P.name from products P left outer join components C on C.product_id = P.id where C.id is null; Empty set (0,00 sec) 2) No, I couldn't, so that's a catch. With useclassification set to off the problem doesn't reproduce itself. The list of components for all products is correct. Switching the parameter on again brings back the unexpected result from bug's description. Hope that helps and if there's anything else I could help hunt this bug down just let me know.
I can reproduce when classifications are enabled.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Components do not match selected product in Administer Flag Types and Edit Flag Type pages → When editing flag types, components do not match the selected product when classifications are enabled
Target Milestone: --- → Bugzilla 5.0
The problem comes from global/js-products.html.tmpl which totally ignores classifications. This means that products are listed in a different order than in the <select> list, and so indexes do not match.
Attached patch WIP 0.9 (obsolete) — Splinter Review
This fixes the problem with classifications, but I want to investigate why we have: var useclassification = false; // No classification level in use at the top of the template. Either this variable must be set to true, or it's useless and it must be killed (and its corresponding code in js/productform.js removed). Also, this code is duplicated in request/queue.html.tmpl. I will check if we can refactor it to use global/js-products.html.tmpl.
Assignee: administration → LpSolit
Attachment #8644189 - Attachment is obsolete: true
Attachment #8644192 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attached patch patch, v1Splinter Review
The useclassification variable in the JS code is no longer used since Bugzilla 4.4, see bug 636416, and so can safely go away. This same bug removed code related to versions and milestones too, and so I removed dead code from selectProduct() as well. I also refactored request/queue.html.tmpl to use the same code as flagtypes, aka global/js-products.html.tmpl. This means much less JS code in templates, which is a good thing. And finally, I fixed both editflagtypes.cgi and request.cgi to correctly take classifications into account.
Attachment #8702068 - Attachment is obsolete: true
Attachment #8702965 - Flags: review?(dkl)
Comment on attachment 8702965 [details] [diff] [review] patch, v1 Review of attachment 8702965 [details] [diff] [review]: ----------------------------------------------------------------- r=dkl
Attachment #8702965 - Flags: review?(dkl) → review+
Flags: approval5.0+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 9f5a8a2..f709156 master -> master To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 26a693a..04004a6 5.0 -> 5.0
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Blocks: 1310728
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: