#12856 closed defect (fixed)
The hierarchy is not shown in the new ticket's component dropdown list
Reported by: | GaLaKtIkUs | Owned by: | falkb |
---|---|---|---|
Priority: | normal | Component: | ComponentHierarchyPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description (last modified by )
Attachments (3)
Change History (29)
Changed 8 years ago by
Attachment: | newticket.png added |
---|
comment:1 Changed 8 years ago by
Trac Release: | → 1.0 |
---|
comment:3 Changed 8 years ago by
Description: | modified (diff) |
---|---|
Severity: | blocker → normal |
comment:4 follow-up: 7 Changed 8 years ago by
Replying to mehdiru:
The component hierarchy is not displayed in the "new ticket" component field as shown in the following screenshot:
Does it display correctly after the ticket is created, on the "ticket" page?
comment:5 follow-up: 6 Changed 8 years ago by
- Does it work for you with a very simple example test system, just containing a component "software" with its only child "VirtualMachines"?
- Can you debug if browser:componenthierarchyplugin/trunk/componenthierarchy/ticket.py#L31 returns useful data in _ChModel.get_direct_children()?
comment:6 follow-up: 8 Changed 8 years ago by
Replying to falkb: Sorry for the delay. I created a dedicated test environment for the plugin with the following components:
- comp1
- comp1.1
- comp2
- Does it work for you with a very simple example test system, just containing a component "software" with its only child "VirtualMachines"?
Doesn't work ((
- Can you debug if browser:componenthierarchyplugin/trunk/componenthierarchy/ticket.py#L31 returns useful data in _ChModel.get_direct_children()?
Added the following line just after browser:componenthierarchyplugin/trunk/componenthierarchy/ticket.py#L31 with the following content
self.log.debug('%s has %s', comp.name, comp_children)
Got the following entries in the log file:
2016-08-29 18:55:26,396 Trac[ticket] DEBUG: comp1 has [u'comp1.1'] 2016-08-29 18:55:26,398 Trac[ticket] DEBUG: comp1.1 has [] 2016-08-29 18:55:26,400 Trac[ticket] DEBUG: comp2 has []
comment:7 Changed 8 years ago by
Replying to rjollos:
Replying to mehdiru:
The component hierarchy is not displayed in the "new ticket" component field as shown in the following screenshot:
Does it display correctly after the ticket is created, on the "ticket" page?
Can you please tell what is the expected result? The created ticket has the same look as ordinary tickets.
comment:8 follow-up: 9 Changed 8 years ago by
Replying to mehdiru:
I created a dedicated test environment for the plugin with the following components:
- comp1
- comp1.1
- comp2
Firefox renders this for me:
</th><td class="col1"> <select id="field-component" name="field_component"><option class="indention_level_1" value="comp1">comp1</option><option level="2" class="indention_level_2" value="comp1.1">comp1.1</option></select>
What does Firefox render for your combobox? Which browser do you use?
comment:9 Changed 8 years ago by
Replying to falkb:
Replying to mehdiru:
I created a dedicated test environment for the plugin with the following components:
- comp1
- comp1.1
- comp2
Firefox renders this for me:
</th><td class="col1"> <select id="field-component" name="field_component"><option class="indention_level_1" value="comp1">comp1</option><option level="2" class="indention_level_2" value="comp1.1">comp1.1</option></select>What does Firefox render for your combobox? Which browser do you use?
I have the same rendering problem in Chrome and in Firefox. Just forgot to mention it. I got the following rendered (in both firefox and chrome):
<select id="field-component" name="field_component"> <option value="comp1">comp1</option><option value="comp1.1">comp1.1</option><option value="comp2">comp2</option> </select>
comment:10 follow-ups: 11 13 Changed 8 years ago by
Somehow JS-function ch_updateComponentOptions() is not working for you, but I think, JavaScript is allwed in your browser, right?
Can you see the tracing in your browsers developer console when you insert
console.log("hallo");
to browser:componenthierarchyplugin/trunk/componenthierarchy/htdocs/create_component_hierarchy.js#L45 ?
comment:11 Changed 8 years ago by
Replying to anonymous:
Somehow JS-function ch_updateComponentOptions() is not working for you, but I think, JavaScript is allwed in your browser, right?
Can you see the tracing in your browsers developer console when you insert
console.log("hallo");
to browser:componenthierarchyplugin/trunk/componenthierarchy/htdocs/create_component_hierarchy.js#L45 ?
JS is normally working as I know. I use other plugins that use JS. I'll try to follow your instructions. But I'm pretty weak in web debugging. Hope to do it in a few hours.
comment:12 Changed 8 years ago by
I thought about the call of add_script()
in componenthierarchy/ticket.py also, but I cannot imagine why that could fail there... somehow strange. Hoping we can see in your browser console at least the call of jQuery(document).ready(function($)
after inserting that console logging... Thanks already for staying tuned!
comment:13 Changed 8 years ago by
Replying to anonymous:
Somehow JS-function ch_updateComponentOptions() is not working for you, but I think, JavaScript is allwed in your browser, right?
Can you see the tracing in your browsers developer console when you insert
console.log("hallo");
to browser:componenthierarchyplugin/trunk/componenthierarchy/htdocs/create_component_hierarchy.js#L45 ?
Got only that "hallo" in the console ...
jQuery(document).ready(function($) { console.log("hallo"); $('#field-component').bind("onUpdate", function() { ch_updateComponentOptions(); }); });
comment:14 Changed 8 years ago by
That's good news, means the .js file has loaded. Now try to spread those console.log messages in ch_updateComponentsOptions(), please. I wonder where it fails to get to the adding of the "indention_level" stuff, you know.
comment:15 Changed 8 years ago by
Hi again. Added some logging:
function ch_updateComponentOptions() { var options = $('#field-component option'); var handled = []; var alle = []; options.each(function() { var jThis = $(this); var opt_text = jThis.text(); var opt_val = jThis.val(); console.log("hallo-10"); alle.push(opt_val); var thisLevel = jThis.attr('level'); if (!thisLevel) { thisLevel = 1; jThis.attr('class', 'indention_level_1'); console.log("hallo-11"); } console.log("hallo-12"); if ($.inArray(opt_val, handled) == -1 && component_children[opt_val]) { thisLevel++; console.log("hallo-13"); var nbsp = ""; if ($.browser.msie) { // The IE does not support css styling for option tags for (var i = 1; i < thisLevel; i++) { nbsp = nbsp + " "; } } console.log("hallo-14"); $.each(component_children[opt_val].reverse(), function(idx, value) { var jChildOpt = $('#field-component option[value="' + value + '"]'); jChildOpt.attr('level', thisLevel); jChildOpt.attr('class', 'indention_level_' + thisLevel); if ($.browser.msie) { jChildOpt.text(nbsp + value); console.log("hallo-15"); } jChildOpt.insertAfter(jThis); console.log("hallo-16"); }); handled.push(opt_val); console.log("hallo-17"); } }); } jQuery(document).ready(function($) { console.log("hallo-00"); $('#field-component').bind("onUpdate", function() { ch_updateComponentOptions(); console.log("hallo-01"); }); console.log("hallo-02"); });
In the console I got:
hallo-00 hallo-02
That indicated that the ch_updateComponentOptions() is never being called.
comment:16 follow-up: 17 Changed 8 years ago by
Hahaha, now it's clear to me. :-) I thought "onUpdate" is a common jQuery function but it's just a custom event we trigger from within the SimpleMultiProjectPlugin (see here and look for $(field_id).trigger("onUpdate");
). This means the plugin currently only works for user of the SimpleMultiProjectPlugin. :)
Well, to get it working for all, I think, we could try to call ch_updateComponentOptions()
also immediately in this ready-function. Does this work for you?:
--8<---snip--- ... jQuery(document).ready(function($) { console.log("hallo-00"); $('#field-component').bind("onUpdate", function() { ch_updateComponentOptions(); console.log("hallo-01"); }); + ch_updateComponentOptions(); console.log("hallo-02"); });
comment:17 follow-up: 23 Changed 8 years ago by
Replying to falkb:
Hahaha, now it's clear to me. :-) I thought "onUpdate" is a common jQuery function but it's just a custom event we trigger from within the SimpleMultiProjectPlugin (see here and look for
$(field_id).trigger("onUpdate");
). This means the plugin currently only works for user of the SimpleMultiProjectPlugin. :)Well, to get it working for all, I think, we could try to call
ch_updateComponentOptions()
also immediately in this ready-function. Does this work for you?:--8<---snip--- ... jQuery(document).ready(function($) { console.log("hallo-00"); $('#field-component').bind("onUpdate", function() { ch_updateComponentOptions(); console.log("hallo-01"); }); + ch_updateComponentOptions(); console.log("hallo-02"); });
The patch works. Will later make some additional test to ensure that there are no other problems such as compatibility issues with other plugins I use. I'll let you informed in the next few hours.
comment:18 Changed 8 years ago by
Cool! Yeah, I don't exactly know, if the ready-function is late enough to update the component combobox, though it seems it works this way.
Maybe someone else can help out, and suggest which standard jQuery event can be used to bind to, I mean to be sure that Trac and its plugins are all ready with their things they do in all those other .js scripts on page load...
comment:19 follow-up: 20 Changed 8 years ago by
Also it would be cool if the component's hierarchy is shown in the component's name in the ticket and in the report windows after the ticket is created ...
comment:20 follow-up: 21 Changed 8 years ago by
Replying to mehdiru:
Also it would be cool if the component's hierarchy is shown in the component's name in the ticket and in the report windows after the ticket is created ...
The question is how it should be displayed and what should happen if its path is very long because of a deep hierarchy...
comment:21 follow-up: 22 Changed 8 years ago by
Replying to falkb:
Replying to mehdiru:
Also it would be cool if the component's hierarchy is shown in the component's name in the ticket and in the report windows after the ticket is created ...
The question is how it should be displayed and what should happen if its path is very long because of a deep hierarchy...
It would be nice if it is displayed as a unix path (comp1/comp1.1). Some option in the trac.ini file would configure how many levels to show up from the component, for example: for the parameter set to 2, the comp0/comp0.0/comp0.0.0/comp0.0.0.0 component's name should display as .../comp0.0.0/comp0.0.0.0 with ... indicating that there are more hierarchy levels up.
comment:22 Changed 8 years ago by
Replying to mehdiru:
It would be nice if it is displayed as a unix path (comp1/comp1.1). Some option in the trac.ini file would configure how many levels to show up from the component, for example: for the parameter set to 2, the comp0/comp0.0/comp0.0.0/comp0.0.0.0 component's name should display as .../comp0.0.0/comp0.0.0.0 with ... indicating that there are more hierarchy levels up.
Sounds good, although I can imagine the plugin has to keep it configurable, because some people want backslashes or some people don't want to see the path... Furthermore, the abbreviation and also the appropriate resizing of the combobox is more complex than it seems... But please, create a new ticket for this feature wish, although I don't have time for coding new stuff at present, but who knows, things are changing fast.
comment:23 follow-up: 24 Changed 8 years ago by
Replying to mehdiru:
Will later make some additional test to ensure that there are no other problems such as compatibility issues with other plugins I use. I'll let you informed in the next few hours.
Still works? I can't suppose other plugins tweaking the components...
comment:24 Changed 8 years ago by
Replying to falkb:
Replying to mehdiru:
Will later make some additional test to ensure that there are no other problems such as compatibility issues with other plugins I use. I'll let you informed in the next few hours.
Still works? I can't suppose other plugins tweaking the components...
Tomorrow evening I'll report the results. I'm in GMT+3 timezone.
A screenshot of the bug