A platform for community discussion. Free, open, simple.
UX: clarify why empty output node stop execution (#42507)
Joffrey JAFFEUXfe15f43f5fcc
diff --git a/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/executions/detail.gjs b/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/executions/detail.gjsindex d377a28ab48..5105f3c8fb8 100644--- a/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/executions/detail.gjs+++ b/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/executions/detail.gjs@@ -13,6 +13,10 @@ import {} from "../../../lib/workflows/property-engine";function formatJson(data) {+ if (Array.isArray(data) && data.length === 0) {+ return "[]";+ }+if (!data || Object.keys(data).length === 0) {return "{}";}@@ -173,6 +177,14 @@ function stepSummary(step) {return String(step.error);}+function hasNoOutput(step) {+ return (+ step.status === "success" &&+ Array.isArray(step.output) &&+ step.output.length === 0+ );+}+function isFilterStep(step) {return step.node_type === "condition:filter";}@@ -401,6 +413,14 @@ export default class ExecutionDetail extends Component {{{/if}}<div class="workflows-execution-detail__step-body">+ {{#if (hasNoOutput step)}}+ <div+ class="alert alert-info workflows-execution-detail__no-output"+ >+ {{i18n "discourse_workflows.executions.no_output_data"}}+ </div>+ {{/if}}+{{#if step.metadata.conditions}}<div class="workflows-execution-detail__conditions">{{#each step.metadata.conditions as |condition|}}diff --git a/plugins/discourse-workflows/config/locales/client.en.yml b/plugins/discourse-workflows/config/locales/client.en.ymlindex 13f0cb25261..ed843de01ac 100644--- a/plugins/discourse-workflows/config/locales/client.en.yml+++ b/plugins/discourse-workflows/config/locales/client.en.yml@@ -205,7 +205,7 @@ en:no_input_context: "No input data yet. It will appear after the first run."no_input_fields: "No input fields"environment: "Environment"- no_output_context: "No output data"+ no_output_context: "This node produced no output data, so the execution stopped and no items were passed to connected nodes. To continue the execution with an empty item, turn on Always output data in this node's Settings tab."no_output_fields: "No output fields"no_output_context_run_to_discover: "Run the workflow to discover output fields"schema_input_label: "Input %{number}"@@ -1200,6 +1200,7 @@ en:other: "Are you sure you want to delete %{count} executions?"input: "Input"output: "Output"+ no_output_data: "This node produced no output data, so the execution stopped and no items were passed to connected nodes. To continue the execution with an empty item, turn on Always output data in this node's Settings tab."items: "items"logs: "Console"workflow_call: "Workflow call"diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/context-output-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/context-output-test.gjsindex 8407c791551..60d0e5a9e1e 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/context-output-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/context-output-test.gjs@@ -243,7 +243,12 @@ module();assert.dom(".workflows-context-panel__title-meta").doesNotExist();- assert.dom(".workflows-context-panel__empty").hasText("No output data");+ assert+ .dom(".workflows-context-panel__empty")+ .hasText(+ "This node produced no output data, so the execution stopped and no items were passed to connected nodes. To continue the execution with an empty item, turn on Always output data in this node's Settings tab.",+ "the empty state explains how to continue the execution"+ );});test("shows item count and field-empty state for real empty output items", async function (assert) {@@ -315,7 +320,12 @@ module();assert.dom(".workflows-schema-field__key-title").doesNotExist();- assert.dom(".workflows-context-panel__empty").hasText("No output data");+ assert+ .dom(".workflows-context-panel__empty")+ .hasText(+ "This node produced no output data, so the execution stopped and no items were passed to connected nodes. To continue the execution with an empty item, turn on Always output data in this node's Settings tab.",+ "the latest zero-item run explains how to continue the execution"+ );});test("merges fields across output items without rendering item rows", async function (assert) {diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/executions/detail-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/executions/detail-test.gjsindex 77f05c8ef82..2d227591a34 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/executions/detail-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/executions/detail-test.gjs@@ -22,6 +22,30 @@ class WorkflowsNodeTypesStub extends Service {}}+function executionWithOutput(output) {+ return {+ id: 11473,+ workflow_id: 30,+ workflow_name: "Output workflow",+ status: "success",+ started_at: "2026-06-24T10:00:00Z",+ finished_at: "2026-06-24T10:00:01Z",+ steps: [+ {+ node_id: "code-1",+ node_name: "Code",+ node_type: "action:code",+ status: "success",+ input: [{ json: { value: 1 } }],+ output,+ metadata: {},+ started_at: "2026-06-24T10:00:00Z",+ finished_at: "2026-06-24T10:00:01Z",+ },+ ],+ };+}+module("Integration | Component | Workflows | Executions | ExecutionDetail",function (hooks) {@@ -39,6 +63,41 @@ module();});+ test("explains when a successful node returns no output", async function (assert) {+ this.execution = executionWithOutput([]);++ await render(+ <template><ExecutionDetail @execution={{this.execution}} /></template>+ );++ assert+ .dom(".workflows-execution-detail__no-output")+ .hasText(+ "This node produced no output data, so the execution stopped and no items were passed to connected nodes. To continue the execution with an empty item, turn on Always output data in this node's Settings tab.",+ "the execution explains empty-output routing and how to emit an item"+ );+ assert+ .dom(".workflows-execution-detail__step-section:last-of-type pre")+ .hasText("[]", "zero output items are displayed as an empty array");+ });++ test("does not show the explanation for an empty output item", async function (assert) {+ this.execution = executionWithOutput([{ json: {} }]);++ await render(+ <template><ExecutionDetail @execution={{this.execution}} /></template>+ );++ assert+ .dom(".workflows-execution-detail__no-output")+ .doesNotExist(+ "an empty item can continue to following nodes and needs no warning"+ );+ assert+ .dom(".workflows-execution-detail__step-section:last-of-type pre")+ .hasText("{}", "the empty item remains distinguishable from no items");+ });+test("opens workflow call child executions through the admin route", async function (assert) {this.execution = {id: 11471,