Dashboard gadget: configurable approvals gadget (table mode)

Description

Add a single Jira dashboard gadget that presents approvals from the Approval Path list, defaulting to a data table and allowing the type to be switched to a chart. The entire ticket concerns the table type; the chart types are part of the same gadget and will be added in other tasks.

The gadget author configures everything in the gadget's edit view; viewers get a ready-made, read-only result. Data is always computed per viewing user, consistent with the personal / space / global admin views.

Layout

The edit view is a split layout: a header on top, configuration on the left, live preview on the right (expandable to full width). The preview reflects the author's own permissions and is indicative only; actual content for each viewer is computed per viewer.

Header

  • Type selector on the left, defaulting to data table. Supported types: table, pie, bar, line, 2D table. The chart types are specified in other tasks.

  • A Group by control appears next to the type, only when a chart type is selected (charts are in AP-2309); it is not shown for the table type.

  • Gadget name input on the right, showing a placeholder when empty (no label).

Configuration (edit view, three tabs)

Tab 1: Source

  • Approval source, set through the same filters reused from the approvals list (Approval name, Definition, Status, Priority, Space, JQL, More filters), including the awaiting-decision-by-user filter with a "current user" option (a dynamic filter that uses the context of the user viewing the gadget, distinct from selecting a fixed named user). By default the gadget shows all approvals from the instance visible to the viewing user, shown in the preview on the right.

Tab 2: Format

Format is contextual to the selected type and lets the author tailor how the data is presented:

  • Choose which columns are shown, reorder them, add/remove columns.

  • Override the displayed name of each column.

  • Add a custom field from the work item as a column.

  • Set the display format of date columns (e.g. "Jan 2026", "2026-01-15", "15 Jan 2026") for approval date fields (Created, Decision deadline, Validity expiration).

Tab 3: Display options

  • Results per page.

  • Detailed mode enabled (whether viewers can switch to detailed mode when the gadget is maximized).

  • Default sort column and direction.

  • Common options for all types:

    • Auto-refresh interval.

    • Whether export is enabled.

Visibility model (computed server-side, per viewing user)

The set of approvals a gadget shows is scoped to what the viewing user is entitled to see:

  • Global admin: all approvals in the instance.

  • Regular user: only their own approvals, consistent with the personal view.

  • If a single space is configured and the regular user is a space admin of that space, they see all approvals in that space; otherwise they see only their own.

Filtering by the author's configuration and by viewer entitlement is done server-side before data reaches the gadget view; the view never receives approvals the viewer is not entitled to see. The "current user" filter resolves to the viewing user, not the author.

Viewer experience (view mode, read-only)

Viewers do not see any configuration controls. Available actions:

  • Edit configuration: shown only to users who can edit the dashboard (native gadget behaviour, i.e. dashboard Editors).

  • Export: shown only if enabled in configuration; exports exactly what the viewer sees (their filtered, entitled set, with current columns and sort), never the author's full set.

  • Refresh the values.

  • Switch list / detailed mode, only if detailed is enabled in configuration and the gadget is maximized.

  • Sort by clicking a column header (ad hoc), on top of the configured default sort.

  • Reorder columns via drag and drop in the table preview.

Approval actions in the gadget

The gadget exposes only navigation and voting; state-changing destructive actions are not surfaced on the dashboard:

  • Available: open the work item, open the approval.

  • Voting (approve / reject / abstain) cast as the viewing user and only when they are an approver of the step.

Modes

  • List mode: the approvals list with the configured columns and sort.

  • Detailed mode: the full three-column detailed view (list, approval/step details, work item details), reused from the app. Because this needs width, detailed mode is available only when detailed is enabled in configuration and the gadget is maximized; in normal size the gadget shows the list only. "Read-only" refers to configuration and filtering, not to an approver's right to vote.

Persistence

  • Gadget configuration: per gadget instance, native gadget configuration (edit view): gadget name, type, source filters, format (columns with renamed labels, order, custom fields, date column format), display options.

  • Auto-refresh interval: stored via the refresh field on edit-view submit.

Acceptance criteria

  • The gadget is a single dashboard gadget that defaults to a data table and allows switching the type to a chart.

  • The edit view has a header (type selector and Group by on the left, gadget name input with an empty-state placeholder on the right) and a split body with configuration on the left and a live preview on the right (expandable to full width).

  • Configuration has three tabs: Source (filters), Format (contextual to type), Display options.

  • Source tab lets the author set all full-view filters, including a "current user" option that uses the viewing user's context; by default the gadget shows all approvals visible to the viewing user.

  • The Format tab allows choosing, reordering, adding/removing columns, renaming displayed column labels, adding a work item custom field as a column, and setting the display format of date columns.

  • The Display options tab sets results per page, whether detailed mode is enabled, default sort, auto-refresh interval, and whether export is enabled.

  • The view is read-only for configuration: viewers see no configuration controls; the Edit action is available only to users who can edit the dashboard.

  • A global admin sees all approvals in the instance; a regular user sees only their own approvals, consistent with the personal view; if a single space is configured and the regular user is a space admin of that space, they see all approvals in that space. The "current user" filter resolves to the viewing user.

  • Data is filtered server-side by both the author's configuration and viewer entitlement before reaching the view.

  • Export (when enabled) outputs exactly what the viewer currently sees; the viewer can refresh, sort by clicking a column header, reorder columns via drag and drop in the preview, and switch to detailed mode only when enabled and the gadget is maximized.

  • The gadget exposes navigation (open work item, open approval) and voting cast as the viewing user when they are an approver of the step.

  • Custom field columns and user-defined labels/names are escaped in the gadget the same way as in the full view.

Notes / open points

  • JQL input must be validated/sanitized; queries execute within the resolved visibility set.

  • The refresh field / JIRA_DASHBOARD_GADGET_REFRESH handling should filter by gadgetId, since the refresh event is broadcast to all Forge gadgets.