Issue Context

This module will eventually replace the Issue Glance module (soon to be deprecated from both Connect and Forge). The Issue context module is designed to provide better visibility for your app and improve the experience of updating your app. If your app uses the Issue Glance module, refer to our instructions in the How to future-proof your Issue Glance implementation document for this transition.

The Issue context module creates a collapsible panel on the right-hand side of the Issue view, below Field groups. This panel lets your app provide specified information to users relating to the issue.

In addition, the panel also remembers whether a user expanded or collapsed it last time. If a user expands the panel before they exit the issue, it'll be expanded again when they revisit it.

issue context panel collapsed issue context panel expanded

The Issue context object

The Issue context object (which includes your icon, content, and URL) is defined using the Issue context module.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "modules": {
    "jiraIssueContexts": [
      {
        "icon": {
          "width": 0,
          "height": 0,
          "url": "my_icon.svg"
        },
        "content": {
          "type": "label",
          "label": {
            "value": "my label"
          }
        },
        "target": {
          "type": "web_panel",
          "url": "/panel_url"
        },
        "jiraNativeAppsEnabled": true,
        "name": {
          "value": "My Issue Context Panel "
        },
        "key": "my-issue-context-panel"
      }
    ]
  }
}

This will show up like below:

issue context panel example app expanded issue context panel example app collapsed

Setting the status for an Issue Context panel

The status of an Issue Context panel for a specific an issue can be set using the Set issue property API.

The issue property key needs to be formatted as com.atlassian.jira.issue:[addonKey]:[moduleKey]:status to set the status.

The JSON in your PUT request to set the status should follow this format depending on the type of status you wish you display:

More recommended usage and user experience suggestions are available in the design guidelines.

ISSUE_CHANGED event

Apps can receive a frontend event notifying them that an issue changed, either by being updated or commented on. This event is only available for Jira issue view modules.

1
2
3
AP.events.on('ISSUE_CHANGED', function (data) {
  console.log('ISSUE_CHANGED (Connect)', data);
});

However, if you have multiple issue view modules in your app, you should use the Jira issue view background script module. This will give you a central place for fetching issue details, thus reducing the number of network requests and improving the user experience. Fetching issue details separately for every module would introduce unnecessary overhead and degrade performance.

Data shape

1
2
3
4
5
6
7
8
{
  "issueId": string,
  "projectId": string,
  "changes":[{
    "changeType": "updated" | "commented",
    "atlassianId": string
  }]
}

  • issueId - ID of the issue the app is rendered on
  • projectId - ID of the project the issue belongs to
  • changes - the list of issue changes
  • changeType - type of the change
  • commented - a new comment was added to the page
  • updated - the issue has been updated
  • atlassianId - ID of the user who made the change

Limitations

  • UI kit apps don't have an event system in place and so aren't supported.
  • There is a delay between the moment the issue is modified and when the event is emitted. It might take up to a few seconds.
  • We can't guarantee that all issue change events will be received by Jira. Therefore, the issue view may sometimes remain stale.
  • When the issue is modified by the user who is currently viewing it, it will not be refreshed. This is because we assume the change was made by that same user and there is no need for an update.

To use this module, add the jiraIssueContexts module to your app descriptor. This module uses the following properties:

Properties

content
Type
Required
Yes
Description

This content becomes the label next to the icon. It's handy for communicating a small amount of information.

Read about Issue Context Content Label.


icon
Type
Required
Yes
Description

Specifies an icon to display at the left of the context view control. The icon resource provided in this field should be 24x24 pixels or larger, preferably in SVG format.

Defines an icon to display.

Example

1
2
3
4
5
6
7
8
{
  "icon": {
    "width": 16,
    "height": 16,
    "url": "/my-icon.png"
  }
}

Properties

url
Type
Format
uri
Required
Yes
Description

The URL of the icon. Your icon needs to be hosted remotely at a web-accessible location. You can specify the URL as an absolute URL or relative to the add-on's base URL.

height
Type
Description

The height in pixels of the icon image.

width
Type
Description

The width in pixels of the icon image.


key
Type
Max length
100
Required
Yes
Pattern
^[a-zA-Z0-9-]+$
Description

A key to identify this module.

This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique.

Keys must only contain alphanumeric characters and dashes.

The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like:

1
2
3
4
5
6
7
8
9
{
    "key": "my-addon",
    "modules": {
        "configurePage": {
            "key": "configure-me",
        }
    }
}

Will have a configuration page module with a URL of /plugins/servlet/ac/my-addon/configure-me.


name
Type
Required
Yes
Description

A human readable name.

Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

Example

1
2
3
4
{
  "value": "My text"
}

Properties

value
Type
Max length
1500
Required
Yes
Description

The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

i18n
Type
Max length
300
Description

The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


target
Type
Required
Yes
Description

Specifies the target action when clicking on the context panel.

Read about Issue Context Target Web Panel.


conditions
Type
Description

Conditions can be added to display only when all the given conditions are true.


jiraNativeAppsEnabled
Type
Defaults to
true
Description

Specifies whether the issue context will be shown in the Jira mobile clients.

The issue context panel will be shown in Jira Cloud for iOS from version 165, and in Jira Cloud for Android from version 103.

Read about enabling your app for the Jira mobile and desktop clients.