Skip to content

feat(manifest): icons for stats-block widget + page-header custom actions (closes #324, #325)#329

Merged
rubenvdlinde merged 1 commit into
betafrom
hotfix/manifest-icons-and-page-actions
May 22, 2026
Merged

feat(manifest): icons for stats-block widget + page-header custom actions (closes #324, #325)#329
rubenvdlinde merged 1 commit into
betafrom
hotfix/manifest-icons-and-page-actions

Conversation

@rubenvdlinde
Copy link
Copy Markdown
Contributor

Summary

Two manifest-renderer plumbing gaps surfaced together during the openconnector v2-manifest migration. Both unblock declarative JSON manifests that already work in JSX/code, and both ship in this single PR because they share commit-history context (manifest schema diff, CnActionsBar / CnIndexPage / CnDashboardPage edits).

#324CnStatsBlockWidget accepts iconClass

  • New iconClass: String prop (default '') on CnStatsBlockWidget.
  • Forwarded through CnDashboardPage.getStatsBlockProps allowlist so manifest widgetDef.props.iconClass reaches the widget.
  • Renders a wrapping <div :class="['cn-stats-block-widget', iconClass]"> so consumers can use NC core icon classes (icon-link, icon-mail, …). No MDI dynamic-import — pure CSS-class path.

#325CnIndexPage accepts config.headerActions[]

  • New headerActions: Array prop (default []) on CnIndexPage, mirrored by a headerActions[] config key on pages[].config (v1 + v2 schemas).
  • Same shape as existing row-level actions[] ({ id, label, icon, handler, route, ... }).
  • Forwarded to a new headerActions: Array prop on CnActionsBar, rendered inside the existing NcActions overflow dropdown after built-in Refresh and before the #action-items slot.
  • Same handler registry (navigate / emit / none / custom) as row-level actions; payload is {}-only (no row context, since these are page-level).
  • Built-in masquerade prevention: ids reserved for built-ins (refresh, import, export, copy, delete) are silently dropped with a console.warn.
  • New event: @header-action({ action, id }) on both CnActionsBar and CnIndexPage (payload aliases the id under both keys to match the row-level @action convention).

Backwards compatibility

  • All new props are optional with safe defaults ('' / []).
  • Schema keys are additive — no existing manifests break.
  • DOM diff for stats-block: a single empty wrapper <div> when iconClass is unset.

OpenSpec change

openspec/changes/manifest-icons-and-page-actions/ — proposal + design + tasks + two spec deltas (dashboard-page, index-page). Validates strict-clean.

Consumers unblocked

  • openconnector#831 — KPI tiles regain icons (currently icon-less)
  • openconnector#828 — "View logs" moves from row-level shortcut to page-level header

Test plan

  • npm run lint — 0 errors, 454 pre-existing warnings (all in unrelated files)
  • npm run check:docs — 190/190 documented, 114/114 components prop+slot covered
  • npm test — 21 new tests passing across 4 new spec files; 4 pre-existing test failures on beta are unchanged by this PR (CnDataMatrix, CnSearchPage, validateManifest.detailSidebarTabs, validateManifest.wikiStabilise)
  • npm run check:jsdoc — pre-existing red on beta (PR feat(dashboard): date-range header + chart time-bucket data source #326 introduced new events on CnDashboardPage without bumping baselines, so 16 components currently below baseline). This PR adds 0 new drops; the new events on CnActionsBar / CnIndexPage carry JSDoc. Deferred follow-up: a baseline-refresh PR can reset the post-feat(dashboard): date-range header + chart time-bucket data source #326 drops, but it's pre-existing drift unrelated to this work.
  • Manual: render an openconnector dashboard with a stats-block widget carrying props.iconClass: "icon-link" — wrapper div picks up the class.
  • Manual: declare a pages[].config.headerActions[] entry on an openconnector index page (handler: "navigate" with a route) — entry appears in the overflow dropdown after Refresh, click navigates.

…ions (closes #324, #325)

Closes #324: CnStatsBlockWidget now accepts an `iconClass: String` prop
(default `''`) forwarded from `widgetDef.props.iconClass` through the
CnDashboardPage `getStatsBlockProps` allowlist. The widget renders a
wrapping `<div :class="['cn-stats-block-widget', iconClass]">` so
consumers can use NC core icon classes (`icon-link`, `icon-mail`, ...).
No MDI dynamic-import path (deferred per issue option 1).

Closes #325: CnIndexPage now accepts `config.headerActions[]` — a
page-level analogue of the existing row-level `actions[]`, same shape
(`{ id, label, icon, handler, route, ... }`), rendered inside the
CnActionsBar overflow dropdown between built-in Refresh and the
`#action-items` slot. Handler dispatch reuses the row-level registry
pattern (`navigate` / `emit` / `none` / custom registry); built-in ids
(`refresh`, `import`, `export`, `copy`, `delete`) are dropped with a
console.warn to prevent masquerade. CnActionsBar emits
`@header-action({ action, id })` (payload aliases the id under both
keys, matching the row-level `@action` convention); CnIndexPage
re-emits after handler dispatch.

Schema: `headerActions` key added on `pages[].config` in both
`app-manifest.schema.json` (v1) and `app-manifest-v2.schema.json`
referencing the same `action` $def.

Tests: 21 new tests across 4 spec files covering iconClass prop
forwarding, dashboard dispatcher allowlist, header-action rendering /
emit semantics, built-in-id collision warning, and handler dispatch.

Backwards-compatible: new props default to safe values, schema keys
are additive, DOM diff for stats-block is a single empty wrapper div.
@rubenvdlinde rubenvdlinde merged commit 0fdd1d9 into beta May 22, 2026
2 of 3 checks passed
@rubenvdlinde rubenvdlinde deleted the hotfix/manifest-icons-and-page-actions branch May 22, 2026 07:21
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0-beta.69 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant