Hey, all, how you doin?
I have a question to ask if someone can help. I’m tryna disable the right sidebar web-panels (dates, people, etc) based on certain parameters. I tracked these web-panels to the jira-issue-view-plugin, which all have a condition class of their own, which if I could somehow hook into to add a condition parameter of my own.
I’m tryna do this as a plugin, so far, I’ve managed to get the web-panel module of the plugin using PluginAccessor, and used PluginController to disable it, however, that happens to be global.
The ModuleDescriptor that I can get seems to be implementing several XYModuleDescriptor of which several have the Condition class, but don’t seem to have a getter.
I can use Javascript, but yeah … I tried it and what I get is a flicker on these webpanels whenever something reloads on the page.
I think that should still be done on the frontend - way easier.
Instead of using JavaScript you could hide your stuff using CSS, then it shouldn’t flicker.
Thanks for the reply. Yes, I was planning to use CSS which is added to the page via servlet-filter; main reason to use servlet-filter is so I can have a config page and add CSS dynamically.
But I was worried that using CSS would still have to load the components, when they don’t need to be loaded.
I actually managed to find some info on the internet about Reflection, and that seems to work, untill the plugin with the module is re-enabled again. I don’t know that much about Java to tell if this is safe or good practice, but here is the code I used:
Field field = ReflectionUtils.findField(AbstractWebFragmentModuleDescriptor.class, "condition");
ReflectionUtils.makeAccessible(field);
ReflectionUtils.setField(field, peopleModule, c);
“c” is my own instantiated condition class.