Skip to content

Support add flow action#192

Merged
Steve-Mcl merged 10 commits intomainfrom
171-add-flow
Mar 19, 2026
Merged

Support add flow action#192
Steve-Mcl merged 10 commits intomainfrom
171-add-flow

Conversation

@Steve-Mcl
Copy link
Copy Markdown
Contributor

Description

Adds support for creating new flow tabs via automation.
This PR lead to a need for "command and await" functionalilty and re-use of import logic. For that reason, it also adds a new abstraction RedOps (for Node-RED operations) which refactors handles the command and wait and hosts the refactored flow import logic.

The changes improve modularity, enable asynchronous action handling, and extend the automation capabilities for Node-RED flows.

Core abstractions and refactoring:

  • Introduced a new RedOps class in redOps.js to encapsulate Node-RED operations such as validating flow strings, invoking actions, and waiting for events. Flow validation and action invocation logic previously in ExpertComms are now moved to this class. ([resources/redOps.jsR1-R111](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-bce14e6301073e2e83f84d706245cb0e56d8015087e546ee1b9292b1095ede61R1-R111))
  • Refactored ExpertActionsInterface and ExpertAutomations to use the new RedOps abstraction, initializing it and delegating relevant operations to it. ([resources/expertActionsInterface.jsR1-R16](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-084ec314ef40d6a2ff14b9d8308f400d3e188ab7770c04621a80df19e3ec30b7R1-R16))

Automation and flow handling improvements:

  • Added a new automation action automation/add-flow-tab in ExpertAutomations, including support for an optional title. Implemented the addFlowTab method to create new flow tabs, either via a core action or by importing a flow with a custom label. ([[1]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-b89bcd54930b5abba7a5ccddc78ddc849b36e62d572f817a4aa31d49900cf09dR8-R11), [[2]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-b89bcd54930b5abba7a5ccddc78ddc849b36e62d572f817a4aa31d49900cf09dR89-R99), [[3]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-b89bcd54930b5abba7a5ccddc78ddc849b36e62d572f817a4aa31d49900cf09dR180-R231), [[4]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-b89bcd54930b5abba7a5ccddc78ddc849b36e62d572f817a4aa31d49900cf09dR296-R301))
  • Refactored flow import logic, moving it from ExpertComms to ExpertAutomations and updating the invocation to support new options and error handling. ([[1]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-b89bcd54930b5abba7a5ccddc78ddc849b36e62d572f817a4aa31d49900cf09dR180-R231), [[2]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL539-R552))

Asynchronous action handling:

  • Changed invokeAction methods in ExpertActionsInterface and ExpertAutomations to be asynchronous, allowing for actions that require waiting for events or responses. Updated ExpertComms to handle async action invocation and properly await results. ([[1]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-084ec314ef40d6a2ff14b9d8308f400d3e188ab7770c04621a80df19e3ec30b7L21-R27), [[2]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-b89bcd54930b5abba7a5ccddc78ddc849b36e62d572f817a4aa31d49900cf09dL185-R249), [[3]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL550-R561), [[4]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL330-R343), [[5]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL498-R508))

Naming and interface changes:

  • Renamed nodeRedAutomationHelper to nrAutomations in ExpertComms for clarity, and updated all references accordingly. ([[1]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL74-R74), [[2]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL124-R124), [[3]](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-637659b6869108e05c4538455e7101b71e09643c68b841248750f09e14dbc35aL204-R204))

Testing updates:

  • Updated unit tests in expertAutomations.test.js to reflect the new supported action automation/add-flow-tab. ([test/unit/resources/expertAutomations.test.jsL67-R68](https://github.com/FlowFuse/nr-assistant/pull/192/files#diff-e7d4959cdf64517d5730ac48875efaee722475ceccf92228d6c086bf67ee6af1L67-R68))

These changes collectively improve modularity, enable more robust automation features, and lay the groundwork for future extensibility.

Related Issue(s)

closes #171

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@Steve-Mcl Steve-Mcl requested a review from cstns March 16, 2026 10:38
@Steve-Mcl Steve-Mcl requested a review from cstns March 16, 2026 16:21
@Steve-Mcl Steve-Mcl merged commit bf79995 into main Mar 19, 2026
7 checks passed
@Steve-Mcl Steve-Mcl deleted the 171-add-flow branch March 19, 2026 17:40
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.

Support for Add Flow Tab action

2 participants