Opened 9 years ago
Closed 5 years ago
#12609 closed defect (fixed)
Hide rules not working with new installation
Reported by: | rpshaw | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | DynamicFieldsPlugin |
Severity: | major | Keywords: | |
Cc: | rpshaw@… | Trac Release: | 1.0 |
Description (last modified by )
Hello,
I just installed this DynamicFields into my installation to replace the deprecation CondFieldsPlugin. To replicate CondFields behavior, I made extensive use of hide_always
and show_when_type
. This does not appear to work for two reasons:
- All possible fields show up for all possible ticket types under the "Modify Fields" form
- The properties table underneath the ticket title shows a small subset of the ticket fields (none of the custom fields except for the very last field in the list)
To prove that DynamicFields is installed and working, I tried to utilize the invalid_if
rule, and that works. I am using Trac 1.0 and the trunk
version of DynamicFields. This issue shows up on both Firefox 38.3.0 and Internet Explorer 11.
Since my setup includes a lot of other plugins, I've included my [components]
section from trac.ini. Is there any known incompatibility between DynamicFields and any of the other active plugins?
Thanks, Ryan
[components] announcer.* = enabled announcer.distributors.mail.emaildistributor = disabled color.* = enabled condfields.* = disabled customfieldadmin.api.customfields = enabled customfieldadmin.customfieldadmin.customfieldadminpage = enabled defaultcc.* = enabled defaultcc.admin.defaultccadmin = enabled defaultcc.main.ticketdefaultcc = enabled dynfields.* = enabled includemacro.macros.includemacro = enabled iniadmin.iniadmin.iniadminplugin = enabled navadd.* = enabled quiet.* = enabled sensitivetickets.sensitivetickets.sensitiveticketspolicy = enabled simpleticket.* = enabled ticketcharts.ticketcharts.ticketchartmacro = disabled ticketdep.macro.ticketblockees = enabled ticketdep.macro.ticketblockers = enabled ticketdep.web_ui.ticketdepmodule = enabled ticketstats.* = enabled ticketstats.macro.ticketstatsmacro = disabled ticketstats.ticketstats.ticketstatsplugin = disabled tracadvparseargs.parseargs.parseargstestmacro = enabled tracdragdrop.* = enabled tracinclude.* = enabled tracnav.tracnav.tracnav = enabled tracopt.perm.config_perm_provider.extrapermissionsprovider = enabled tracopt.ticket.clone.ticketclonebutton = enabled tracopt.ticket.deleter = enabled tracopt.versioncontrol.svn.svn_fs.subversionconnector = enabled tracopt.versioncontrol.svn.svn_prop.subversionmergepropertydiffrenderer = enabled tracopt.versioncontrol.svn.svn_prop.subversionmergepropertyrenderer = enabled tracopt.versioncontrol.svn.svn_prop.subversionpropertyrenderer = enabled tracrpc.* = enabled tractags.api.tagengine = enabled tractags.api.tagsystem = enabled tractags.macros.listtaggedmacro = enabled tractags.macros.tagcloudmacro = enabled tractags.macros.tagmacros = enabled tractags.model.tagmodelprovider = enabled tractags.ticket.tickettagprovider = enabled tractags.ticket.tickettags = enabled tractags.web_ui.tagrequesthandler = enabled tractags.web_ui.tagsmodule = enabled tractags.web_ui.tagsuserinterface = enabled tractags.web_ui.tagswikimodule = enabled tractags.web_ui.tagtemplateprovider = enabled tractags.wiki.tagwikisyntaxprovider = enabled tractags.wiki.wikitaginterface = enabled tractags.wiki.wikitagprovider = enabled tractags.wiki.wikitags = enabled tractoc.macro.tocmacro = enabled tracwysiwyg.templateprovider = enabled tracwysiwyg.wysiwygwikifilter = enabled
Attachments (0)
Change History (27)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Here it is. I have 3 ticket types - defect, enhancement, and RandArequest.
[ticket-custom] customer = text customer.format = plain customer.label = Company customer.order = 0 customer.show_when_type = defect|enhancement customer.value = defectph = select defectph.hide_always = true defectph.label = Defect Detection defectph.options = |development|release|testing defectph.order = 5 defectph.value = defectsrc = select defectsrc.label = Defect Source defectsrc.options = |src1|src2|src3 defectsrc.order = 4 defectsrc.show_when_type = defect defectsrc.value = defectstatus = select defectstatus.hide_always = true devteam = select devteam.label = Dev Team devteam.options = team1|team2|team3 devteam.order = 10 devteam.show_when_type = defect|enhancement devteam.value = Other due_date.format = plain duedate = text duedate.format = plain duedate.label = Due Date duedate.options = duedate.order = 3 duedate.show_when_type = defect|enhancement duedate.value = MM-DD-YYYY ra_contact_name = text ra_contact_name.format = plain ra_contact_name.label = Sandia Contact ra_contact_name.order = 16 ra_contact_name.show_when_type = RandArequest ra_contact_name.value = ra_contact_phone = text ra_contact_phone.format = plain ra_contact_phone.label = Contact Phone No. ra_contact_phone.order = 20 ra_contact_phone.show_when_type = RandArequest ra_contact_phone.value = storypoints = text storypoints.format = plain storypoints.label = Story Points storypoints.order = 12 storypoints.show_when_type = enhancement storypoints.value = timeactual = text timeactual.format = plain timeactual.label = Actual Work timeactual.order = 11 timeactual.show_when_type = defect|enhancement timeactual.value = 0.0 user = text user.format = plain user.invalid_if = user.label = User user.order = 1 user.show_when_type = defect|enhancement user.value = versionfixedin = text versionfixedin.format = plain versionfixedin.label = Version(s) Changed versionfixedin.options = versionfixedin.order = 13 versionfixedin.value = versionsfixedin.show_when_type = defect|enhancement
comment:4 Changed 9 years ago by
Replying to rpshaw:
- The properties table underneath the ticket title shows a small subset of the ticket fields (none of the custom fields except for the very last field in the list)
I found the same behavior, however if I switched the type to enhancement the proper limited set of fields displayed, and then if I switched back to defect the proper set of fields was also displayed. So it appears to only be a problem when the page loads, and invoking the change
callback results in the proper behavior.
Further tested showed that this was a regression in [15095]/[[15098]. That doesn't surprise me too much because I felt that change was rather risky given that I don't have a full understanding of this code.
Please let me know if the next change fixes the issue for you. If not, please look in the browser console to see if there are any errors.
comment:5 Changed 9 years ago by
Owner: | changed from Rob Guttman to Ryan J Ollos |
---|---|
Status: | new → accepted |
comment:7 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Feel free to follow-up if you find any more issues.
comment:8 follow-up: 13 Changed 9 years ago by
comment:9 Changed 9 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Hi again,
I just tested the newest version of trunk with your changes and things look better but still seems flawed.
The "Change Properties" section now shows the correct set of fields and changes dynamically when I change the ticket type. So this is good.
However, some bad things persist:
- The table at the top of the ticket (just below the ticket title) still shows a limited set of fields - the same as what I described when I opened the ticket. This doesn't change even when I reload the page or change ticket type.
- When I change the ticket type from "defect" to "enhancement" then back to "defect," one of the populated fields that is set only for defect (
defectstatus
) gets deleted. I can revert this in the preview, but it's annoying. - Fields that are set to be
hide_always
are set to their default value now when I modify a ticket. This is annoying to see and will likely be confusing for users. - Page reloads cause odd things to happen - sometimes ALL fields will be displayed, sometimes the "Change Properties" section will not be even (i.e., too many fields in one column), and sometimes the correct behavior is shown.
I looked in the Firefox Browser Console and saw these error when I loaded a ticket:
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsITaskbarTabPreview.invalidate]
- I see this error every time I load/reload a ticket page.
GET (XHR) https://prod.sandia.gov/sierra-trac/quietmode/status [HTTP/1.1 401 Authorization Required 51ms]
- This error doesn't occur every time and "Quiet Mode" still seems to work properly.
Let me know if you need any more information, and I'll be happy to test any change you make.
Thanks, Ryan
comment:10 Changed 9 years ago by
Please post the versions of all the plugins you have installed. The aggregated information can be found on the /about
page.
comment:11 Changed 9 years ago by
Here they are:
Name Version Color Rev Default-CC 0.2 DuplicateTicketSearch 1.0.3 IniAdmin 0.3 NavAdd 0.3 sensitivetickets 0.22 TracAdvParseArgsPlugin 0.4 TracAnnouncer 1.0dev TracCondFields 3.0dev TracCustomFieldAdmin 0.2.8 TracDragDrop 0.12.0.12 TracDynamicFields 2.2.0.dev0 TracForms 0.5dev TracIncludeMacro 3.0.0dev TracMath 0.6 TracNav 4.2.dev TracQuiet 1.0.1 TracSimpleTicket 5.0dev-r0 TracTags 0.7 TracTocMacro 11.0.0.4 TracWysiwyg 0.12.0.5 TracXMLRPC 1.1.2
comment:12 Changed 9 years ago by
Oops, minus the CondFields. This is the current view with CondFields enabled and DynFields disabled.
comment:13 Changed 9 years ago by
comment:14 Changed 8 years ago by
Similiar behaviour on our installation. We were using the plugin for a year now but we have just upgraded to new version for this plugin. Now, on ticket page all fields that have a 'show_when_type' definition is hidden even if the shall be visible due to type match. For new and modify view, plugin works OK.
comment:16 follow-up: 17 Changed 8 years ago by
We had a similar issue when viewing existing tickets in the Chrome browser, but not in Firefox.
Ticket.properties with the show_when_type
option are hidden in the initial ticket_box rendering. After making any modifications to the ticket the ticket_box refreshes and all appropriate ticket.properties are displayed. When creating a new ticket every thing works as expected.
We found that when viewing an existing ticket,in Chrome, line 168 of rules.js was evaluating to true because we had the default value set for the option clear_on_hide
. Our 'fix' was simply to add this option to our ticket-custom
section and set it to false
for all associated ticket.properties.
comment:17 Changed 8 years ago by
Adding the show_when_type = false
option to all the associated ticket-custom
properties helped with some aspects, but not all. The following issues were still noted:
- The ticket properties summary at the top of the ticket shows all ticket properties, even those that should be hidden based on ticket type. However, the "Change Properties" box shows the correct fields based on ticket type.
- This issue shows up in both the Chrome (51.0.2704.84) and Firefox (45.2.0).
comment:18 follow-up: 19 Changed 8 years ago by
I guess I didn't test well enough after setting clear_on_hide
to false. I have a workaround that partially works for us without having to mess with clear_on_hide
.
-
dynamicfieldsplugin/trunk/dynfields/htdocs/rules.js
163 163 var target = spec.target; 164 164 165 165 // hide field in the header if cleared or always hidden 166 var clear_on_hide = spec.clear_on_hide.toLowerCase() == 'true'; 167 var hide_always = spec.hide_always.toLowerCase() == 'true' 168 if (clear_on_hide || hide_always) { 166 //var clear_on_hide = spec.clear_on_hide.toLowerCase() == 'true'; 167 var hide_always = spec.hide_always.toLowerCase() == 'true'; 168 var v; 169 if (input.attr('type') == 'checkbox') 170 v = (input.is(':checked')) ? "1" : "0"; 171 else 172 v = input.val(); 173 var l = spec.trigger_value.split('|'); // supports list of trigger values 174 var should_hide = ( (jQuery.inArray(v, l) != -1 && spec.op == 'hide') || 175 (jQuery.inArray(v, l) == -1 && spec.op == 'show') ) 176 if (hide_always || should_hide) { 169 177 th = jQuery('#h_' + spec.target); 170 178 td = th.next('td'); 171 179 td.addClass('dynfields-hide dynfields-' + trigger); … … 176 184 return; 177 185 178 186 // process hide rule 179 var v;180 if (input.attr('type') == 'checkbox')181 v = (input.is(':checked')) ? "1" : "0";182 else183 v = input.val();184 var l = spec.trigger_value.split('|'); // supports list of trigger values185 187 if ((jQuery.inArray(v, l) != -1 && spec.op == 'hide') || 186 188 (jQuery.inArray(v, l) == -1 && spec.op == 'show')) {
When viewing tickets without modifying them, the yellow ticket_box displays the expected ticket properties. There are issues with certain options, however.
When we used the invalid_if
option in conjunction with the invalid_when_type
option we see the behavior of unexpectedly hiding ticket fields. I haven't had a chance to look at why this is occurring.
If a preview is generated during a ticket modification all bets are off. That problem seems to be discussed in trac:#11719 and #11923.
comment:19 follow-up: 20 Changed 8 years ago by
Replying to christiano@…:
I guess I didn't test well enough after setting
clear_on_hide
to false. I have a workaround that partially works for us without having to mess withclear_on_hide
. [...] If a preview is generated during a ticket modification all bets are off. That problem seems to be discussed in th:ticket:11719 and th:ticket:11923
Well, my little 'work around' breaks firefox.
comment:20 Changed 8 years ago by
Replying to christiano@…:
Well, my little 'work around' breaks firefox.
Sorry for the spam. I wasn't logged into our wiki when using firefox. It appears to work if I'm logged in.
comment:21 Changed 8 years ago by
Description: | modified (diff) |
---|
comment:22 Changed 7 years ago by
Have just upgraded from trac 1.0 to 1.2 and am getting the header issue (#comment:16). Have installed the latest of the plugin (v2.2.1) and am still seeing this issue, i.e. the plugin is hiding all field headers in the ticket box with clear_on_hide
set irrespective of the truth of the trigger.
Are you still planning to fix this?
Thanks, James.
comment:23 Changed 7 years ago by
Installed v2.3.0.dev0 on trac 1.0.1 and defined rules to show/hide custom fields depending on ticket type but am experiencing the same issue:
Ticket Modify View: works as intended Ticket View + Preview: shows no fields (regardless of type) Delete Ticket preview: shows all fields (regardless of type)
Confirmed in Firefox and Chrome. Changing the clear_on_hide setting has no effect on behavior. I did not see any js console errors, and while all fields are written into the page html as expected, the class "dynfields-hide" is not applied as needed to achieve the desired behavior.
comment:24 Changed 6 years ago by
Owner: | Ryan J Ollos deleted |
---|---|
Status: | reopened → new |
comment:25 Changed 5 years ago by
Owner: | set to Ryan J Ollos |
---|---|
Status: | new → accepted |
comment:27 Changed 5 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Please reopen if you can reproduce with the latest release.
Could you post your
[ticket-custom]
section? I'll try to reproduce.