The snippet you pasted assumes that in the same atlassian-plugin.xml file you have a web-resource with the key “soy” that contains of soy resource, having for example My.addOn.tpl.board.config namespace with .myConfigurationPage template inside.
and in your templates/boardConfigPage.soy the following structure:
{namespace My.addOn.tpl.board.config}
/**
Some description of this template to be filled.
If you need/pass params, do not forget to include them in SoyDoc as well.
*/
{template .myConfigurationPage}
<div>Your markup here</div>
{/template}
I am now trying to get react working on the web-panel … now that my soy template is loading…
However I am struggling to get the react components loaded on the soy template…
Any clues on why the web-resources are not loading … (The global page works for me though which is served using a servlet) . How do you specify the context for loading the web-resources in a web-panel?
Hi,
Depending on how web-panel is rendered, the calls to WRM to load contexts or web-resources may not necessary work:
it works when the page along with those web-panels is server-side rendered and there’s a point where WRM is drained and resource tags are put to the page
on the other hand when the web-panel is rendered async. or via REST there’s no point for WRM drain
In the latter case, it’s common to use the client-side WRM client to load contexts or web-resources.
For cases when the web-panel can be rendered in both ways, there are both calls: one that you have (calling WRM Java API) and the client-side call.
(a note: WRM client is aware that a given context was already loaded, so the 2nd call for the same thing will be a no-op, doesn’t hurt).
You can call WRM client inside a script type=module (but there’s an issue with that when jQuery is used later on to put such async. fetched markup on the page) or a regular script with resourcePhaseCheckpoint (since Jira 9.0). This is especially important for pages with defer scripts, such as Dashboard and Issue view since Jira 9.0, otherwise you won’t be able to access WRM client at that point.
Yet another way for case with a template with both WRM type of calls, when you know that the async one is going to happen always after DCL, which has the additional benefit of working pre and post Jira 9.0:
{webResourceManager_requireResourcesForContext('scmglobalpage_or_other_name_of_the_context')}
<script>
if (WRM.require) {
require('wrm/require')('wrc!scmglobalpage_or_other_name_of_the_context');
}
</script>