Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add design note for UI Module #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HiroyasuNishiyama
Copy link
Member

Node-RED Dashboard is convenient tool for creating GUIs. But creating complex dashboard screen is difficult with current Node-RED Dashboard because the screen should be created by combining basic set of dashboard widgets.
This design note is aimed at addressing this problem by providing UI module that creates reusable UI components consisting of existing UI widgets.

Copy link
Member

@dceejay dceejay left a comment

Choose a reason for hiding this comment

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

Possible actions for Dashboard groups in groups capability

(Notes from whiteboard)

Rather than a new ui_module node we propose that ui_groups be extended to allow ui_group nodes to include other nested ui_group nodes. In order to allow this the following sub-tasks are required.

  • A) Config node allow select node for ui

  • B) Create/modify layout tool to layout single group

    • Add button to ui_group edit dialogue to open this layout tool
  • C1) Move Widget Order property into Group Node.

  • C2) Modify layout tool to allow Group within group.

  • C3) Group may have Heigh property added.

  • D) Change sidebar to support group in group

    • Don't add widgets from subflow to tree
    • Do add group from subflow (fixed size only)
  • D) When widgets added to subflow disable setting of group/tab

    • Generate Group node (add and auto assign widgets)

@KazuhiroItoh
Copy link
Contributor

I updated design note for UI Module.

@knolleary
Copy link
Member

I'm on vacation so cannot look at this until next week, but can you please provide a summary of the updates you have made?

@KazuhiroItoh
Copy link
Contributor

KazuhiroItoh commented Aug 19, 2020

Thank you for confirmation.
Used by the UI module, SUBFLOW instantiates the nodes defined in the template to generate the nodes.
Since the widget node has layout information for each node definition, it cannot be arranged correctly when multiple instances are created from the SUBFLOW template.
Therefore, I changed it to use two configuration nodes, template and instance.
Also, the original design note was the implementation in the Node-RED runtime/editor, but I changed to implementing the Node-RED dashboard.

@KazuhiroItoh
Copy link
Contributor

In order to support the UI-Module function, two functions that need to be added to Node-RED added to design notes.

  1. Acquisition of subflow information
  2. Remapping node ID during flow import

@KazuhiroItoh
Copy link
Contributor

  1. Acquisition of subflow information

I considered countermeasures for this matter.
Reference implementation: get subflow info

Measures are taken so that the subflow instance to which the widget belongs can be referred to when the widget is instantiated.
The content is the same as the modification of the design note, but added the process to delete unnecessary instances after the widget is generated.

If there is no problem, I would like to issue a PR.
Please check.
Thank you and best regards.

@KazuhiroItoh KazuhiroItoh mentioned this pull request Dec 23, 2020
Copy link
Member

@knolleary knolleary left a comment

Choose a reason for hiding this comment

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

Thanks @KazuhiroItoh.

I have read through this design a couple times and I think I see what the ui_subgroup_t and ui_subgroup_i nodes are. I was expecting to see something called ui_module given the name of the design. Not a massive fan of the _i and _t naming... but don't have anything better to suggest.

I need to understand a bit more about why you need access to the subflow instance information. The design doesn't give the details and I can't quite see it.

Comment on lines +210 to +213
6. SUBFLOW property support(optional)
If UI_GROUP is defined as the environment variable for the property definition of SUBFLOW, UI_GROUP of Node-RED dashboard can be specified in step 3.
In this case, the procedure for setting UI_GROUP in step 4 can be omitted. (See below)

Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why this is needed? Why do we need two different ways for the UI_GROUP to be set? Is there a particular scenario it addresses?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for checking.
By using _UI_GROUP, I would like to be able to use the UI Module with the same operation as a widget.
For UI Module users, it's easy to understand because it can be treated like a widget.
image
However, the creator of the UI Module (subflow) must add the _UI_GROUP property to the subflow.
The subflow also needs the ability to set the Config node in the property.
Therefore, it is proposed as an optional function.

Comment on lines +226 to +234
### Specification of UI_GROUP by SUBFLOW environment variable (optional function)

By specifying UI_GROUP config node using the property editing of SUBFLOW,
you can specify the group that displays the UI component when placing SUBFLOW instance like normal widget.

Property name : `_UI_GROUP`

UI_SUBGROUP_I instance node sets the value specified in the corresponding SUBFLOW instance _UI_GROUP property to the value specified in group.

Copy link
Member

Choose a reason for hiding this comment

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

As above - why is this needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

By linking the value of _UI_GROUP to ui_subgroup_i, you can omit the setting of ui_group.

1. Acquisition of subflow information

- Additional functions
Server-side RED.nodes.getNode () supports getting subflow instance information.
Copy link
Member

Choose a reason for hiding this comment

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

Exactly what information is needed from the subflow instance?

Is it the subflow env properties? If so, they will already be visible to the node as environment variables - this._flow.getSetting("...") can be used to access its value in the subflow.

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to get the ID information of the subflow instance to which the widget being generated belongs.
For widgets nested within a subflow, IDs are required up to the parent subflow.
Specifically, this is the value set for the subflow path.

Example:
"fda95d7e.fb54/3b5a5523.01d41a/d771a7ef.6586e8/cc844746.a516f8"

In node-red-dashbord ui.js#function add(opt), I want to use the above value when arranging the widget, so I considered the idea of getting the subflow instance from the value of opt.node.z.
I checked the argument opt, but it seems that the '._flow' you pointed out does not exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would appreciate it if you could consider this matter.

Reference implementation: get subflow info

I recognize that it is necessary to make corrections based on this measure in order to acquire subflow information in the process of UI node generation.

The following usage is assumed.

node-red-dashboard#ui.js:

function add(opt) {
var subflow = nodes.getNode(opt.node.z);

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.

4 participants