Feature description:
When workflow steps are copied and pasted, preserve the step name.
This will make it less work to use content copied from a workflow.
Current behavior:
When using the new “Workflows” core plugin, I found that I would regularly need to implement things similar to what I did in another workflow, or elsewhere in the same workflow. Fortunately, the plugin has support for copy and pasting steps.
Unfortunately, the step names are reset to default when pasted. I prefer to use custom step names in order to clearly communicate the function of the step. So this means I have to go through and rename each of the added steps after performing a paste operation. This also risks introducing errors into the workflow, since the step name is the identifier used to reference its output in subsequent steps (e.g., $("Foo step").first().json.bar).
Reproducible steps:
- Log into a Discourse forum account with admin permissions, on a site that has the new “Workflows” plugin enabled.
- Open the “Workflows” page (
/admin/plugins/discourse-workflows/workflows). - Click the “+ New workflow” button.
A new workflow will be created. - Click the + button.
The “Add step” panel will open. - Select Flow > If from the panel.
ⓘ I chose this specific step type arbitrarily. The name reset behavior occurs for any step type. - Double click on the newly added “If” step.
The configuration dialog for the step will open. - Click the pencil icon (“Edit”) to the right of the step name, near the top left hand corner of the dialog.
The step name will become an editable text field. - Type
Foo stepinto the step name field. - Click the ✓ icon to the right of the field.
The name change will be committed. - Click the X icon at the top right hand corner of the dialog.
The dialog will close. - Right click on the “Foo step” step.
A context menu will open. - Select “Copy” from the menu.
- Select the “Workflows” tab near the top of the page.
The “Workflows” page will open. - Click the “+ New workflow” button.
A new workflow will be created. - Right click on the workflow canvas.
A context menu will open. - Select “Paste” from the menu.
The pasted step has the default name “If”.
Discourse version:
1a47bbf0af779342d6762eadb6da07f9ecf68717
Additional context:
I understand that preservation of the step name verbatim will result in a name collision in the case where the step is being pasted into the source workflow. The Workflows plugin already ensures unique names when adding steps normally by adding a numeric suffix to the step name that would otherwise collide. That approach could be adopted for the paste feature. Alternatively, the plugin could simply display a dialog to inform the user of the collision, as is already done when the user manually sets a non-unique name in a step:
An error occurred: Node names must be unique within a workflow. Duplicates: Foo step