Giving a panel two locations (Jira Data Center)

Hello, I want to display the same panel with the same VM, Condition and ContextProvider in both the issue right view and the details tab in the scrum board. Is there a way to do so by only using one panel and specifying two locations or a location that works for both to avoid the following code duplication?

    <web-panel key="createActionPanel" location="atl.jira.view.issue.right.context">
        <resource name="view" type="velocity" location="templates/panels/createAction.vm"/>
        <label key="create-action-panel.name"/>
        <condition class="com.plugin.jira.condition.CreateActionCondition"/>
        <context-provider key="action-context-provider"
                          class="com.plugin.jira.panel.CreateActionContextProvider"/>
    </web-panel>
    <web-panel name="createActionBoardPanel" i18n-name-key="action-panel.name" key="create-action-panel" location="atl.gh.issue.details.tab" weight="1000">
        <condition class="com.plugin.jira.condition.CreateActionCondition"/>
        <context-provider key="m-action-provider-panel" class="com.plugin.jira.panel.CreateActionContextProvider"/>

        <resource name="view" type="velocity" location="templates/panels/createAction.vm"/>
        <resource name="iconUpgrade" type="download" location="images/upgradeIcon.png"/>

        <label key="create-action-panel.name" />
        <tooltip key="create-action-panel.name" />
    </web-panel>

As you can see, the condition, context-provider, label and resource view tags are the same in both panels which creates code duplication, if I want to change one, I’ll have to change the other too for example.

hi @JeanBecharaFrancis

In Jira plugins, when you want to add a panel that appears in multiple locations (like both the issue view and the scrum board details tab) without duplicating your code, you’re faced with a challenge because the Atlassian SDK and the descriptor file (usually atlassian-plugin.xml ) typically require you to define each panel separately for each location.

Sorry for the bad news :smile:

1 Like