Dashboard Item

Want your dashboard to automatically refresh?

Jira dashboard gadget in Forge supports auto-refresh, as well as UI Kit 2.

Already have a Connect app? Start adding Forge features in less than an hour.

Dashboard items allow add-on to display a summary information data on the dashboard. Each dashboard-item can be configured to display information relevant to a particular user.

Example

For a full add-on example, see dashboard item example add-on.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "jiraDashboardItems": [
    {
      "description": {
        "value": "Dashboard item description"
      },
      "url": "/dashboard-item-test?dashboardItemId={dashboardItem.id}&dashboardId={dashboard.id}&view={dashboardItem.viewType}",
      "configurable": true,
      "thumbnailUrl": "atlassian-icon-16.png",
      "refreshable": false,
      "name": {
        "value": "Dashboard item title"
      },
      "key": "dashboard-item-key"
    }
  ]
}

Properties

description
Type
Required
Yes
Description

Description of the dashboard item. This will be displayed for a user in the directory.

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.


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.


thumbnailUrl
Type
Format
uri-template
Required
Yes
Description

URI of the dashboard item thumbnail which is displayed in the directory.


url
Type
Format
uri-template
Required
Yes
Description

The URL of the service which will render the dashboard item. Following context parameters are supported in url.

  • dashboard.id unique id of the dashboard on which the item is rendered. This parameter is passed only on default view
  • dashboardItem.id unique id of the dashboard item which is rendered. This parameter is passed only on default view
  • dashboardItem.key key of the dashboard item. This parameter is passed in both: default and directory view
  • dashboardItem.viewType type of the view in which dashboard item is displayed. Default (for dashboard) and directory. This list may be extended

conditions
Type
Description

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


configurable
Type
Defaults to
false
Description

Specify if the dashboard-item is configurable or not. Configurable dashboard items should render configuration view if there is no configuration stored for the dashboard item. Dashboard item properties can be used for configuration storage.

In addition, configurable dashboard items should register a javascript callback for edit click.

1
2
3
4
5
6
 AP.require(['jira'], function (jira) {
    jira.DashboardItem.onDashboardItemEdit(function() {
       // render dashboard item configuration now
    });
 });

It is a common case to give users ability to set the name of the dashboard item. This can be achieved with a following JS code:

1
2
3
4
 AP.require(['jira'], function(jira) {
    jira.setDashboardItemTitle("Setting title works");
 });

refreshable
Type
Defaults to
true
Description

Set the refreshable property of the dashboard item to false to override native Jira behavior.

With this setting, the iframe will no longer be reloaded on refresh, and instead you can register a callback that listens for refresh events. This callback will then be triggered each time the entire dashboard is refreshed and when the gadget-specific refresh button is clicked.

1
2
3
4
5
6
7
 AP.jira.DashboardItem.onDashboardItemRefresh(
  // payload.origin can hold two values 'gadget' when the gadget's refresh button is clicked and 'dashboard' when the dashboard's refresh button is clicked
  // payload.gadgetId is only available when payload.origin is equal to 'gadget' and contains the ID of the gadget initiating the refresh
  function (payload) {
     // specify your own refresh logic here
  });