Documentation

Jira

A JavaScript module which provides functions to interact with JIRA.

See:

Methods

getWorkflowConfiguration(callback)

Retrieves a workflow configuration object.

Parameters:
Name Type Description
callback WorkflowConfiguration

the callback that handles the response.

isDashboardItemEditable(callback)

Returns whether the current user is permitted to edit the dashboard item

Parameters:
Name Type Description
callback function

the callback that handles the response

openCreateIssueDialog(callback, params)

Open the quick create issue dialog. The dialog fields may be pre-filled with supplied data. A callback will be invoked when the dialog is closed and will include an array of issues created.

Parameters:
Name Type Description
callback function

invoked when dialog is closed, takes a single parameter - array of issues created

params Object

contains data to pre-fill the dialog with

Properties
Name Type Description
pid number

Project to pre-fill the dialog with

issueType number

Issue type to pre-fill the dialog with

fields Object

Optional data to pre-fill the dialog with, you can find out field key by checking it's html 'name' attribute.

Example
AP.jira.openCreateIssueDialog(function(issues){
  alert(issues[0]['fields']['summary']);
}, {
  pid: 10000,
  issueType: 1,
  fields : {
    summary: "Hello World",
    environment : "My environment",
    priority : 2,
    assignee: "tom",
    reporter: "bob",
    labels : ["Mylabel","MyOtherLabel"],
    description : "My first Issue",
    duedate : "11/Oct/16",
    fixVersions : 10001,
    versions : 10000,
    components : "My component",
    timetracking_originalestimate: "2w",
    timetracking_remainingestimate: "3d",
    worklog_activate: true,
    worklog_timeLogged: "2"
  }
});

openDatePicker(options)

Shows a date picker component. A callback will be invoked when the date (and time) is selected by the user.

Parameters:
Name Type Description
options DatePicker~options

Configuration of the date picker.

Example
var dateField = document.querySelector("#date-field");
var dateTrigger = document.querySelector("#date-trigger");

dateTrigger.addEventListener("click", function(e) {
  e.preventDefault();
  AP.jira.openDatePicker({
    element: dateTrigger,
    date: "2011-12-13T15:20+01:00",
    showTime: true,
    onSelect: function (isoDate, date) {
      dateField.value = date;
      dateField.setAttribute("data-iso", isoDate);
      dateField.focus();
    }
  });
});

refreshIssuePage()

Refresh an issue page without reloading the browser.

This is helpful when your add-on updates information about an issue in the background.

Example
AP.jira.refreshIssuePage();

setDashboardItemTitle(title)

Set the title of a dashboard item to the given text.

Parameters:
Name Type Description
title String

the title of the dashboard item. Any HTML is escaped.