The following JSON code shows the widget structure and supported attributes. See Understanding JSON Metadata File Attributes for additional information about the attributes:
{ "name": "customWidgetName", "attributes": { "title": "A title is required", "description": "A description of your widget; optional.", "widgetCategory": "widgetCategory", "reportLocation": "widget/myWidgetData/myReport.jsp", "size_x": 2, "size_y": 1, "parameters": [ { "type": "dropdown", "name": "parameterName", "required": true, "dropdownOptions": [{ "key": "any", "value": " " }, { "key": "open", "value": "open" }] }, { "type": "text", "name": "textParameterName", "title": "textParameterTitle", "tooltip": "Tooltip text for the UI. Optional; title will be used if not set." }, { "type": "dropdown", "name": "filter", "title": "dropdownParameterTitle", "tooltip": "Tooltip text for the UI. Optional; title will be used if not set.", "inheritable": true, } ], "widgetLabels": [ { "title": "Label that will show in the UI", "name": "filterName" } ], } }
Understanding JSON Metadata File Attributes
The following list describes the file attributes within the structure of the schema.
name
: Required. The name of the widget also serves as the ID for adding widgets to custom dashboard templates. Only text (a-z) is allowed. Spaces are not allowed. See Custom Dashboard Templates.attributes
:title
: Required. Title of the widget that appears in the widget UIdescription
: Optional. Blank if not specified.widgetCategory
: Optional. Specifies a category that the widget should belong to. There are three options for specifying the widget category:- Existing category: You can view the JSON file of an existing widget in the DTP_HOME/grs/widget/builtin directory and copy its
widgetCategory
value (e.g.projectCenter
). - Custom category: If the attribute is not specified, the default custom category is used. See Custom Widgets.
- New category: The new category value can not match the value of an existing category. Spaces are not allowed. Set the
widgetCategoryLabel
attribute to specify a new category that appears in the Add Widget dialog.
- Existing category: You can view the JSON file of an existing widget in the DTP_HOME/grs/widget/builtin directory and copy its
widgetCategoryLabel
: Optional. Category that appears in the Add Widget dialog when adding a new category as defined in thewidgetCategory
attribute.reportLocation
: Required. This is a relative path from DTP_HOME/tomcat/webapps/grs/custom (e.g., myReports/myReport.jsp). Report files (HTML, JSP, etc.) should be placed in the custom folder to ensure that the files are backed up and restored when those processes occur. Do not include the beginning slash (/) when specifying the path.size_x
: width of the widget (see About the Dashboard Grid).size_y
: height of the widget (see About the Dashboard Grid).parameters
:type
: Required. Acceptable values aretext
,checkbox
,date
, anddropdown
.name
: Required. Specifies a name for the parameter. Only text (a-z) is allowed. Spaces are not allowed. When type is set todropdown
, the following special values can also be used:filter
: Enables the user to select a DTP filter.project
: Enables the user to select a DTP project.period
: Enables the user to select a date range.
required
: Optional. Acceptable values aretrue
orfalse
. Determines if a value must be specified. Default isfalse
.dropdownOptions
: Supported when type isdropdown
.key
: Parameter for the drop-down item.value
: Parameter for the drop-down item.
title
: Optional. Label for the parameter in the UI. Value of thename
attribute will be used if not specified.tooltip
: Optional. Text that appears when user mouses over the widget parameter. Specifying this text helps users understand the widget settings.inheritable
: Optional. Acceptable values aretrue
andfalse
. Determines if the settings from the dashboard can be inherited. Applies to filter, project, and period.
widgetLabels
:title
: Label that displays when the widget is added to the dashboard.name
: Name of the selected parameter when the widget is added to the dashboard. The name should match the name of the parameter unlessfilter
is used. You can also usefilterName
to display the name of the filter orfilterId
to show the ID.