We develop a JIRA plugin that adds a new web panel and web item to JIRA. We use the JIRA version 7.11.1. The code and some screenshots of our JIRA plugin can be found here:
https://github.com/cures-hub/cures-condec-jira
We want to add a page to the general view of JIRA. This is the current view using a web-panel:
The atlassian-plugin.xml looks like this:
<web-item name="Link to the ConDec Plug-in in Side Bar" key="side-bar-link"
section="jira.project.sidebar.plugins.navigation" weight="1000">
<description>Provides the "Decision Knowledge" link to the plug-in page in the project's navigation side
bar.
</description>
<label>Decision Knowledge</label>
<param name="iconClass" value="aui-icon aui-icon-small aui-iconfont-decision" />
<link> /projects/$pathEncodedProjectKey?selectedItem=decisions-page</link>
<conditions type="AND">
<condition class="de.uhd.ifi.se.decision.management.jira.config.ActivationCondition">
<param name="projectKey" value="$pathEncodedProjectKey" />
</condition>
</conditions>
</web-item>
<web-panel name="ConDec Plug-in Page" key="decisions-page" location="decisions-page">
<description>
Provides the plug-in page that developers use to manage decision knowledge.
</description>
<resource name="view" type="velocity" location="templates/decisionKnowledgePage.vm" />
</web-panel>
We want to pass the key of a selected issue to the link/location of the web panel.
It should be possible to reach the web panel via the link
/projects/$pathEncodedProjectKey?selectedItem=decisions-page?elementKey=ANY_ISSUE_KEY
When we append
?elementKey=ANY_ISSUE_KEY
to the link, the page location cannot be found anymore. How can we pass arguments (an issue key) to the web panel via the link URL? Thanks!
Hi Anja,
Please refer to below URLs for the solution
Thanks,
Santwana
Hi @Santwana Sarangi {Appfire}, thanks for your reply!
I now replaced the web-panel with a Servlet that renders the velocity template.
I added the following Java code:
public class DecisionKnowledgePageServlet extends HttpServlet {
private static final long serialVersionUID = 5841622939653557805L;
// private static final Logger LOGGER =
// LoggerFactory.getLogger(DecisionKnowledgePageServlet.class);
@ComponentImport
protected TemplateRenderer templateRenderer;
@Inject
public DecisionKnowledgePageServlet(@ComponentImport TemplateRenderer renderer) {
super();
this.templateRenderer = renderer;
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
String projectKey = request.getParameter("projectKey");
String elementKey = request.getParameter("elementKey");
AbstractPersistenceStrategy strategy = StrategyProvider.getPersistenceStrategy(projectKey);
DecisionKnowledgeElement element = strategy.getDecisionKnowledgeElement(elementKey);
Map<String, Object> velocityParameters = new ConcurrentHashMap<String, Object>();
velocityParameters.put("projectKey", projectKey);
velocityParameters.put("elementKey", elementKey);
velocityParameters.put("elementId", element.getId());
templateRenderer.render("templates/decisionKnowledgePage.vm", velocityParameters, response.getWriter());
}
}
I added the following to the atlassian-plugin.xml:
<servlet name="Servlet for Decision Knowledge Page" key="servlet-for-decisions-page"
class="de.uhd.ifi.se.decision.management.jira.view.DecisionKnowledgePageServlet">
<description>Provides the page that developers use to manage decision knowledge.</description>
<url-pattern>/decisions-page</url-pattern>
</servlet>
Now, I can get the elementId in the velocity template file via: $elementId
Great, thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I now face the issue that I don't know how to show the side bar on the left side when rendering the velocity template file with the Servlet.
I currently only use this decorator in the velocity template file:
<meta name="decorator" content="atl.general" />
@Santwana Sarangi {Appfire}, do you know which page decorators to use to show the sidebar? Thanks!
I posted this new issue here: https://community.atlassian.com/t5/Jira-questions/Which-page-decorators-show-the-sidebar-in-the-atl-general-view/qaq-p/909348
...and also to the developer community: https://community.developer.atlassian.com/t/which-page-decorators-show-the-sidebar-in-the-atl-general-view/24440
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.