Skip to content

feat: [2376] Show and hide tabs with ui-control - #2382

Merged
n-lark merged 4 commits into
FlowFuse:mainfrom
officialasishkumar:2376-show-hide-tabs
Nov 16, 2026
Merged

n-lark merged 4 commits into
FlowFuse:mainfrom
officialasishkumar:2376-show-hide-tabs

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Description

Lets ui-control show and hide a tab on a Tabs layout page directly. Until now you had to hide every group in the tab.

msg.payload

tabs is already an alias for pages, so tabs use a new pageTabs key:

msg.payload = {
    pageTabs: {
        show: ['Inbox', '<Tab Id>', 'Mail:Inbox', { page: 'Mail', tab: 'Inbox' }],
        hide: ['Mail:Settings']
    }
}
  • Tabs are identified the same way as groups: "tab", "page:tab" or { page, tab }, by id or name. Ids are checked before names. A name without a page matches the first page that has a tab with that name. Escaped colons work as they do for groups.
  • An unknown tab or page is reported as an error. If any entry in the list doesn't resolve, nothing is stored.

Runtime / UI

  • Tabs aren't nodes, so the ids of hidden tabs are stored in the state store as a hiddenTabs list on their page. Page state is already merged into the ui-config, so clients that connect later see the same tabs.
  • The UI is sent { page, tab } id pairs, because tab ids are only unique within a page. A copied page keeps its tab ids.
  • tabsByPage skips hidden tabs. Groups in a hidden tab are hidden too. They don't become their own tabs. If the selected tab is hidden, the existing watcher in the Tabs layout selects the first remaining tab.

Editor

  • tab is a new target for the Show and Hide actions. It lists the tabs of the dashboard's Tabs layout pages as "Page / Tab". The target is saved as <page id>:<tab id>. The row is marked invalid if the tab is deleted, the page stops using the Tabs layout, or the action is changed to something other than Show or Hide.
  • A msg property target can't name a tab. Adding tabs to that lookup would make names that are already used by a group ambiguous, and Tabs pages often have a tab and a group with the same name. The docs point to msg.payload.pageTabs for that case.

Docs (en/de), the editor help and the action tips are updated.

Testing

  • npm run lint and npm test pass (327 tests). The new unit tests in ui_control.spec.js and test/store/ui.spec.js fail without the change.
  • Cypress layouts.spec.js passes (20 tests). It includes new tests for hiding and showing a tab, selecting the first remaining tab when the selected one is hidden, and keeping the tab hidden after a reload. button.spec.js, form.spec.js and control.spec.js also pass.
  • Manual check in the Node-RED editor: the tab target is only offered for Show and Hide and lists "Layout: Tabs / Compose", "Layout: Tabs / Inbox", and so on. Switching the action to Enable removes it. Saving stores <page id>:<tab id>. Rows with a deleted tab, a non-Tabs page or an Enable action are flagged as invalid.

Related Issue(s)

Closes #2376

Until now a tab on a Tabs layout page could only be hidden by hiding
every group assigned to it. ui-control can now show and hide a tab
directly.

msg.payload:
- New `pageTabs` key with `show` and `hide` lists. `tabs` is already an
  alias for `pages` (Dashboard 1 compatibility), so tabs need their own
  key.
- A tab is identified by "tabName", "tabId", "pageName:tabName",
  "pageId:tabName" or { page, tab }, mirroring how groups are
  identified. Ids are matched before names, and a name without a page
  matches the first page with such a tab. Escaped colons work as they do
  for groups and widgets.
- Unknown tabs or pages are reported as errors, and nothing is stored
  when any identifier in a list fails to resolve.

Runtime:
- Tabs are not nodes, they live in the `tabs` list of their ui-page, so
  the ids of hidden tabs are kept in the state store as a `hiddenTabs`
  list on the page. emitConfig already merges page state into the
  ui-config, so clients that connect later get the same tabs.
- The UI receives { page, tab } id pairs, because tab ids are only
  unique within a page (a copied page keeps its tab ids).

UI:
- The tabsByPage getter skips hidden tabs. Groups assigned to a hidden
  tab are hidden with it rather than turning into tabs of their own.
- The existing Tabs layout watcher already moves the selection to the
  first remaining tab when the selected tab disappears.

Editor:
- "tab" is a new target for the Show and Hide actions, listing the tabs
  of the dashboard's Tabs layout pages as "Page / Tab". The row is
  stored as "<page id>:<tab id>" and marked invalid if the tab is
  deleted, the page no longer uses the Tabs layout, or the action is not
  Show or Hide.

Docs (en/de), editor help and tips are updated. Tests cover id/name
resolution, errors, state store updates, the ui-config sent to new
clients, editor actions, the tabsByPage getter, and Cypress tests for
hiding, showing, selection fallback and reloads.

@n-lark n-lark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thank you for the contribution, tested and looks great.

Comment thread docs/en/nodes/widgets/ui-control.md Resolved
Comment thread docs/de/nodes/widgets/ui-control.md Resolved
@n-lark n-lark changed the title feat: [2376] Show and hide tabs with ui-control feat: [2376] Show and hide tabs with ui-control - edit Nov 16, 2026
@n-lark n-lark changed the title feat: [2376] Show and hide tabs with ui-control - edit feat: [2376] Show and hide tabs with ui-control Nov 16, 2026
@n-lark
n-lark merged commit ba1ac24 into FlowFuse:main Nov 16, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show/hide tabs with ui-control

2 participants