POST /flow - label optional but not generated, causing issues #75
Shaquu
started this conversation in
Design Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
During writing Swagger API based on Admin API Methods I noticed that Node-RED might behave incorrectly.
Current state
Editor
When clicking
which is responsible for adding new flow, new flow will be generated in editor with some properties preassigned, label will be generated providing unique value.

Label
Label generation is based only on flows with labels matching localized format (for eng it is
Flow __number__
).Number assigned will be the first missing in the ordered collection.
Flow 1
,Flow 2
the new generated label will beFlow 3
Flow 1
,Flow 3
,Flow 5
the new generated label will beFlow 2
As mentioned in the precondition labels with names not matching the format will be ignored.
Flow 1
,Flow 2
,My Flow
the new generated label will beFlow 3
Flow 1
,My Flow
,Flow 3
the new generated label will beFlow 2
API
In API, we have a POST /flow method.
As described, it should be used to
Add a flow to the active configuration. A flow is represented as a tab within the editor.
.Method accepts following body:
Only
nodes
is mandatory - as both documentation page and api code proves.Label
In code,
label
is optional and if not available is leftundefined
.Issue
While we have added flow with empty label via API it will be displayed as below in the editor.

First of all, you can see that label is empty.
Why could it not be generated just like in the editor?
Secondly, once you try to interact with the flow (to change it's name) you can notice that flow editing is no longer possible for any flow until you refresh the website.

Solutions
API
label
should be generated if emptyFor me it is the most user friendly solution (preferred).
Keeping in mind that we would keep API compatibility and the flow would be generated just like in the editor.
Problem is that we need localization services (i18n) so we can found out how the label should look like.
API
label
should be mandatoryProbably the easiest, we brake API compatibility (new version required) but we make it clear that API client must provide valid label.
Beta Was this translation helpful? Give feedback.
All reactions