Hi, I am porting one of my cloud plugins to run as a P2 plugin. If I can run my pages in an IFrame it would make life a lot simpler for supporting two platforms. In my searches I have noticed the Atlassian Connect JS repository. Has anyone managed to use this in Jira server and if so how do you use the JS files (connect-host.js and iframe.js) to get the AP functionality working.
@Paul given that the P2 infrastructure really differs from connect I would not recommend trying to merge these two. The best way to share a code base is:
share static resources, more specifically create a front-end which only consumes data from an API.
recreate the API (both in terms of endpoints and DTO output) you have for Connect in P2 (which can also be shared code if your connect API is written in Java
Minimize the dependencies on private API or features that are specific to server products.
By doing this you can achieve 90%+ code sharing between connect and P2 environments. The only differences would potentially be velocity placeholders / spring scanner components / atlassian-plugin.xml entries.
Hi @remie, my thinking was that my html classes, ids and javascript were created in isolated iframes with no chance of conflicts. Now I’ll need to rename a lot of these, which will probably then have to be back ported to the cloud to keep them the same. For this plugin over 50% of the complexity is in the velocity templates and javascript so any help in this area would be handy.
As you suggested I am planning on reusing all of the endpoints and Java classes.
@Paul the best way to avoid element ID’s on html and use CSS modules for classes, where the class name is replaced by a generic hash.
For my add-ons, I use VueJS (you can also use React) components with included HTML templates and modularised CSS. My velocity templates are limited to placeholders. For instance, a regular page would be