Hi
I am developing a Jira add-on for Jira Server and cloud. I am trying to leverage Conditions feature.
I followed one of the examples from this page: https://developer.atlassian.com/cloud/jira/platform/conditions/
I added the conditions in my descriptor file for Jira server plugin but it made no difference. The module will still be displayed no matter if the condition is met or not.
"webPanels": [{
"key": "issue-panel",
"location": "atl.jira.view.issue.right.context",
"url": "/app?issue_id=${issue.id}&issue_key=${issue.key}",
"weight": 50,
"conditions": [
{
"condition": "entity_property_equal_to",
"params": {
"entity": "issue",
"propertyKey": "settings",
"objectName": "isEnabled",
"value": "true"
}
}
]
}]
Then I tried to add the condition in atlassian-plugin.xml
file:
<web-panel key="issue-panel" weight="50" location="atl.jira.view.issue.right.context">
<label key="Support"/>
<resource name="view" type="${project.artifactId}-iframe" location="issue-panel"/>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.EntityPropertyEqualToCondition" invert="true">
<param name="entity">project</param>
<param name="propertyKey">settings</param>
<param name="objectName">isEnabled</param>
<param name="value">false</param>
</condition>
</web-panel>
This worked for me as I can control the module by setting the property for the project.
I wonder if I did anything wrong for the descriptor approach.
Also, if I were to apply the same logic for Jira Cloud Add-on descriptor, will it work? I haven’t tried it yet but I assume it’s the only way we can modify the behaviour of the Cloud Add-on.
Thanks
Ye