Hi, I am trying to add a customized button plugin to all my Jira issues. I am new to plugin dev and maven projects.
I have finished making the functionality of the button with JS, which calls Jira Rest API and automatically creates a new issue with some of the fields filled in already.
The button has a client and server side which the client (inside public directory) is triggered to read the issue key on the webpage and call server (index.js), and the server calls the api. I also have another version of the button server which uses Java.
This is the code for the client's side:
document.getElementById("create-test-case-link").addEventListener("click", findTestCase);
async function findTestCase() {
let form = document.getElementById("data-issue-key"); //input of issue key
let issueKey = form.elements[0].value; //getting the issue key from input
const data = {issueKey}; //wrapping issue key as json package to pass to server
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
};
const response = await fetch ('/api', options);
const json = await response.json();
console.log(json); //logging the response from the server
}
Currently I am stuck on how to place the button onto my issue.
I tried to create a Web Item (circle in red) on the issue page, but I don't how to proceed further to "migrate" the code over.
<web-item name="Create Test Case" i18n-name-key="create-test-case.name" key="create-test-case" section="transitions-all" weight="1000">
<description key="create-test-case.description">The Create Test Case Plugin</description>
<label key="create-test-case.label"></label>
<link linkId="create-test-case-link">/projects/PLAT/issues/</link>
</web-item>
Can someone give my any suggestions on where or how to put my code for the button onto the jira plugin? Or how to "link" my button code to the web item?
Thanks a lot
I have the same query. I know its been over 2 years, but did you find out a way to do it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.