Skip to content

A platform for community discussion. Free, open, simple.

UX: Make workflow executions easier to identify and open

Régis Hanolb63b8bd13eb1
diff --git a/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/execution/manager.gjs b/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/execution/manager.gjs
index aa604e4854a..459464a05d8 100644
--- a/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/execution/manager.gjs
+++ b/plugins/discourse-workflows/admin/assets/javascripts/admin/components/workflows/execution/manager.gjs
@@ -1,7 +1,8 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
-import { concat, fn } from "@ember/helper";
+import { array, concat, fn } from "@ember/helper";
import { action } from "@ember/object";
+import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
@@ -30,11 +31,25 @@ function statusIcon(status) {
return STATUS_ICONS[status] || "circle";
}
+function hasModeBadge(execution) {
+ return execution.execution_mode && execution.execution_mode !== "normal";
+}
+
function formatTime(timestamp) {
if (!timestamp) {
return "—";
}
- return new Date(timestamp).toLocaleString();
+
+ const date = new Date(timestamp);
+ return date.toLocaleString(undefined, {
+ year:
+ date.getFullYear() === new Date().getFullYear() ? undefined : "numeric",
+ month: "short",
+ day: "numeric",
+ hour: "numeric",
+ minute: "2-digit",
+ second: "2-digit",
+ });
}
function runTime(execution, currentTime) {
@@ -55,13 +70,21 @@ export default class ExecutionsManager extends Component {
@service currentUser;
@service dialog;
@service messageBus;
- @service router;
+ @service workflowsNodeTypes;
@tracked executions = null;
@tracked loadMoreUrl = null;
@tracked loadingMore = false;
@tracked bulkMode = false;
+ triggerIcon = (trigger) => {
+ if (!this.workflowsNodeTypes.nodeTypes) {
+ return "bolt";
+ }
+
+ return this.workflowsNodeTypes.findNodeType(trigger.type)?.icon || "bolt";
+ };
+
#loadMoreToken = 0;
#loading = false;
#progress;
@@ -74,6 +97,7 @@ export default class ExecutionsManager extends Component {
onRetry: () => this.loadExecutions(),
});
this.loadExecutions();
+ this.workflowsNodeTypes.load();
}
willDestroy() {
@@ -173,15 +197,6 @@ export default class ExecutionsManager extends Component {
this.bulkMode = false;
}
- @action
- showExecution(execution) {
- this.router.transitionTo(
- "adminPlugins.show.discourse-workflows.show.executions.show",
- execution.workflow_id,
- execution.id
- );
- }
-
@action
async deleteSelected(selectedIds, clearSelection) {
const count = selectedIds.size;
@@ -254,6 +269,7 @@ export default class ExecutionsManager extends Component {
@items={{this.executions}}
@loadingMore={{this.loadingMore}}
@loadMore={{this.loadMore}}
+ @rowClass="workflows-executions-manager__row"
@selectable={{this.bulkMode}}
>
<:empty>
@@ -297,85 +313,106 @@ export default class ExecutionsManager extends Component {
{{/if}}
</:toolbar>
<:head>
- {{#if @workflowId}}
- <th class="d-table__header-cell">{{i18n
- "discourse_workflows.executions.started_at"
- }}</th>
- <th class="d-table__header-cell">{{i18n
- "discourse_workflows.executions.status"
- }}</th>
- {{else}}
- <th class="d-table__header-cell">{{i18n
+ <th class="d-table__header-cell">{{i18n
+ (if
+ @workflowId
+ "discourse_workflows.executions.execution"
"discourse_workflows.executions.workflow"
- }}</th>
- <th class="d-table__header-cell">{{i18n
- "discourse_workflows.executions.status"
- }}</th>
- <th class="d-table__header-cell">{{i18n
- "discourse_workflows.executions.started_at"
- }}</th>
- {{/if}}
+ )
+ }}</th>
+ <th class="d-table__header-cell">{{i18n
+ "discourse_workflows.executions.status"
+ }}</th>
+ <th class="d-table__header-cell">{{i18n
+ "discourse_workflows.executions.started_at"
+ }}</th>
<th class="d-table__header-cell">{{i18n
"discourse_workflows.executions.run_time"
}}</th>
<th class="d-table__header-cell"></th>
</:head>
<:row as |execution|>
- {{#if @workflowId}}
- <td class="d-table__cell --overview">
- {{formatTime execution.started_at}}
- </td>
- <td class="d-table__cell --detail">
- <div class="d-table__mobile-label">
- {{i18n "discourse_workflows.executions.status"}}
- </div>
- <span
- class="workflows-executions-manager__status --{{execution.status}}"
+ <td class="d-table__cell --overview">
+ {{#if @workflowId}}
+ <LinkTo
+ class="d-table__overview-link workflows-executions-manager__execution-link"
+ @models={{array execution.workflow_id execution.id}}
+ @route="adminPlugins.show.discourse-workflows.show.executions.show"
>
- {{#if (isRunning execution)}}
- {{dLoadingSpinner size="small"}}
- {{else}}
- {{dIcon (statusIcon execution.status)}}
- {{/if}}
- {{i18n
- (concat
- "discourse_workflows.executions.statuses." execution.status
- )
- }}
- </span>
- </td>
- {{else}}
- <td class="d-table__cell --overview">
- <strong
- class="d-table__overview-name"
- >{{execution.workflow_name}}</strong>
- </td>
- <td class="d-table__cell --detail">
- <div class="d-table__mobile-label">
- {{i18n "discourse_workflows.executions.status"}}
- </div>
- <span
- class="workflows-executions-manager__status --{{execution.status}}"
+ <strong class="d-table__overview-name">#{{execution.id}}</strong>
+ </LinkTo>
+ {{else}}
+ <LinkTo
+ class="d-table__overview-link workflows-executions-manager__workflow-link"
+ @model={{execution.workflow_id}}
+ @route="adminPlugins.show.discourse-workflows.show"
>
- {{#if (isRunning execution)}}
- {{dLoadingSpinner size="small"}}
- {{else}}
- {{dIcon (statusIcon execution.status)}}
- {{/if}}
- {{i18n
- (concat
- "discourse_workflows.executions.statuses." execution.status
- )
- }}
- </span>
- </td>
- <td class="d-table__cell --detail">
- <div class="d-table__mobile-label">
- {{i18n "discourse_workflows.executions.started_at"}}
- </div>
- {{formatTime execution.started_at}}
- </td>
- {{/if}}
+ <strong
+ class="d-table__overview-name"
+ >{{execution.workflow_name}}</strong>
+ </LinkTo>
+ {{/if}}
+ <div class="workflows-executions-manager__meta">
+ {{#unless @workflowId}}
+ <LinkTo
+ class="workflows-executions-manager__id workflows-executions-manager__execution-link"
+ @models={{array execution.workflow_id execution.id}}
+ @route="adminPlugins.show.discourse-workflows.show.executions.show"
+ >#{{execution.id}}</LinkTo>
+ {{/unless}}
+ {{#if execution.trigger}}
+ <span class="workflows-executions-manager__trigger">
+ {{dIcon (this.triggerIcon execution.trigger)}}
+ <span
+ class="workflows-executions-manager__trigger-name"
+ >{{execution.trigger.name}}</span>
+ </span>
+ {{/if}}
+ {{#if (hasModeBadge execution)}}
+ <span
+ class="workflows-executions-manager__mode --{{execution.execution_mode}}"
+ >{{i18n
+ (concat
+ "discourse_workflows.executions.modes."
+ execution.execution_mode
+ )
+ }}</span>
+ {{/if}}
+ </div>
+ {{#if execution.error}}
+ <div
+ class="workflows-executions-manager__error"
+ title={{execution.error}}
+ >{{execution.error}}</div>
+ {{/if}}
+ </td>
+ <td class="d-table__cell --detail">
+ <div class="d-table__mobile-label">
+ {{i18n "discourse_workflows.executions.status"}}
+ </div>
+ <span
+ class="workflows-executions-manager__status --{{execution.status}}"
+ >
+ {{#if (isRunning execution)}}
+ {{dLoadingSpinner size="small"}}
+ {{else}}
+ {{dIcon (statusIcon execution.status)}}
+ {{/if}}
+ {{i18n
+ (concat
+ "discourse_workflows.executions.statuses." execution.status
+ )
+ }}
+ </span>
+ </td>
+ <td
+ class="d-table__cell --detail workflows-executions-manager__started"
+ >
+ <div class="d-table__mobile-label">
+ {{i18n "discourse_workflows.executions.started_at"}}
+ </div>
+ {{formatTime execution.started_at}}
+ </td>
<td
class="d-table__cell --detail workflows-executions-manager__run-time"
>
@@ -384,14 +421,10 @@ export default class ExecutionsManager extends Component {
</div>
{{runTime execution this.currentTime}}
</td>
- <td class="d-table__cell --controls">
- <div class="d-table__cell-actions">
- <DButton
- class="btn-default btn-small"
- @action={{fn this.showExecution execution}}
- @label="discourse_workflows.executions.show"
- />
- </div>
+ <td
+ class="d-table__cell --controls workflows-executions-manager__chevron"
+ >
+ {{dIcon "chevron-right"}}
</td>
</:row>
</AdminTable>
diff --git a/plugins/discourse-workflows/app/models/discourse_workflows/execution.rb b/plugins/discourse-workflows/app/models/discourse_workflows/execution.rb
index 0f5d9d89ffd..5e395fd7b06 100644
--- a/plugins/discourse-workflows/app/models/discourse_workflows/execution.rb
+++ b/plugins/discourse-workflows/app/models/discourse_workflows/execution.rb
@@ -30,6 +30,20 @@ module DiscourseWorkflows
scope :expired_waiting, -> { where(status: :waiting).where("waiting_until < ?", Time.current) }
+ scope :with_snapshot_summary,
+ -> do
+ joins(
+ "LEFT JOIN discourse_workflows_execution_data snapshot " \
+ "ON snapshot.execution_id = discourse_workflows_executions.id",
+ ).select(
+ "discourse_workflows_executions.*",
+ "snapshot.workflow_data ->> 'name' AS snapshot_workflow_name",
+ "jsonb_path_query_first(snapshot.workflow_data, '$.nodes[*] ? (@.id == $id)', " \
+ "jsonb_build_object('id', discourse_workflows_executions.trigger_node_id)) " \
+ "AS snapshot_trigger_node",
+ )
+ end
+
TERMINAL_STATUSES_FOR_PURGE = %i[success error rate_limited skipped].freeze
PURGE_BATCH_SIZE = 5_000
@@ -54,7 +68,11 @@ module DiscourseWorkflows
)
end
end.tap do |execution|
- ExecutionProgressPublisher.publish_created(execution, workflow_name: workflow.name)
+ ExecutionProgressPublisher.publish_created(
+ execution,
+ workflow_name: workflow.name,
+ trigger_node: workflow.find_node(trigger_node_id),
+ )
end
end
@@ -83,7 +101,11 @@ module DiscourseWorkflows
)
end
end.tap do |execution|
- ExecutionProgressPublisher.publish_created(execution, workflow_name: workflow.name)
+ ExecutionProgressPublisher.publish_created(
+ execution,
+ workflow_name: workflow.name,
+ trigger_node: workflow.find_node(node_id),
+ )
end
end
@@ -138,6 +160,13 @@ module DiscourseWorkflows
execution
end
+ def self.trigger_summary(node)
+ return if node.nil?
+
+ node = node.to_workflow_node if node.respond_to?(:to_workflow_node)
+ { name: node["name"], type: node["type"] }
+ end
+
def self.compute_run_time_ms(steps)
waiting_types = NodeType.waiting_identifiers
timed =
diff --git a/plugins/discourse-workflows/app/serializers/discourse_workflows/execution_list_serializer.rb b/plugins/discourse-workflows/app/serializers/discourse_workflows/execution_list_serializer.rb
index c7c3ae33022..a8f38216031 100644
--- a/plugins/discourse-workflows/app/serializers/discourse_workflows/execution_list_serializer.rb
+++ b/plugins/discourse-workflows/app/serializers/discourse_workflows/execution_list_serializer.rb
@@ -10,10 +10,20 @@ module DiscourseWorkflows
:run_time_ms,
:started_at,
:finished_at,
- :created_at
+ :created_at,
+ :execution_mode,
+ :trigger
def workflow_name
- object.workflow_snapshot_name
+ object[:snapshot_workflow_name].presence || object.workflow.active_version&.name ||
+ object.workflow.name
+ end
+
+ def trigger
+ DiscourseWorkflows::Execution.trigger_summary(
+ object[:snapshot_trigger_node] ||
+ object.workflow.find_published_node(object.trigger_node_id),
+ )
end
end
end
diff --git a/plugins/discourse-workflows/app/services/discourse_workflows/execution/list.rb b/plugins/discourse-workflows/app/services/discourse_workflows/execution/list.rb
index 26bf601b229..18af8293115 100644
--- a/plugins/discourse-workflows/app/services/discourse_workflows/execution/list.rb
+++ b/plugins/discourse-workflows/app/services/discourse_workflows/execution/list.rb
@@ -32,7 +32,8 @@ module DiscourseWorkflows
DiscourseWorkflows::Execution
.for_workflow(params.workflow_id)
.order(id: :desc)
- .includes(:execution_data, workflow: :active_version)
+ .with_snapshot_summary
+ .includes(workflow: :active_version)
scope = scope.where("discourse_workflows_executions.id < ?", params.cursor) if params.cursor
scope.limit(params.effective_limit + 1).to_a
diff --git a/plugins/discourse-workflows/assets/stylesheets/common/executions/executions-manager.scss b/plugins/discourse-workflows/assets/stylesheets/common/executions/executions-manager.scss
index 6edfb8640bb..fef26a5d76c 100644
--- a/plugins/discourse-workflows/assets/stylesheets/common/executions/executions-manager.scss
+++ b/plugins/discourse-workflows/assets/stylesheets/common/executions/executions-manager.scss
@@ -1,4 +1,84 @@
.workflows-executions-manager {
+ &__row {
+ position: relative;
+
+ &:hover {
+ background: var(--d-hover);
+ }
+ }
+
+ &__execution-link::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ }
+
+ &__workflow-link,
+ &__row .workflows-admin-table__checkbox {
+ position: relative;
+ z-index: 1;
+ }
+
+ &__chevron {
+ color: var(--primary-low-mid);
+ text-align: right;
+ }
+
+ &__meta {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--space-1) var(--space-3);
+ margin-top: var(--space-1);
+ color: var(--primary-medium);
+ font-size: var(--font-down-1);
+ }
+
+ &__id {
+ font-variant-numeric: tabular-nums;
+
+ &,
+ &:visited {
+ color: inherit;
+ }
+
+ &:hover,
+ &:focus {
+ color: var(--tertiary);
+ }
+ }
+
+ &__trigger {
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-1);
+ white-space: nowrap;
+ }
+
+ &__mode {
+ padding: 0 var(--space-1);
+ border-radius: var(--d-border-radius);
+ background: var(--primary-very-low);
+ color: var(--primary-high);
+ font-size: var(--font-down-1);
+ }
+
+ &__error {
+ contain: inline-size;
+ max-width: 40em;
+ margin-top: var(--space-1);
+ overflow: hidden;
+ color: var(--danger);
+ font-size: var(--font-down-1);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ &__started,
+ &__run-time {
+ white-space: nowrap;
+ }
+
&__status {
display: inline-flex;
align-items: center;
diff --git a/plugins/discourse-workflows/config/locales/client.en.yml b/plugins/discourse-workflows/config/locales/client.en.yml
index a3bf0a3fb67..5bed7c395f6 100644
--- a/plugins/discourse-workflows/config/locales/client.en.yml
+++ b/plugins/discourse-workflows/config/locales/client.en.yml
@@ -1453,6 +1453,10 @@ en:
finished_at: "Finished"
run_time: "Run time"
id: "ID"
+ execution: "Execution"
+ modes:
+ manual: "Manual"
+ error_mode: "Error workflow"
expand: "Details"
collapse: "Hide"
details: "Details"
@@ -1462,7 +1466,6 @@ en:
delete_selected: "Delete selected"
select: "Select"
cancel_select: "Cancel"
- show: "Show"
delete_confirm:
one: "Are you sure you want to delete %{count} execution?"
other: "Are you sure you want to delete %{count} executions?"
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/execution_progress_publisher.rb b/plugins/discourse-workflows/lib/discourse_workflows/execution_progress_publisher.rb
index 744df29f540..c82f84ab230 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/execution_progress_publisher.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/execution_progress_publisher.rb
@@ -27,12 +27,16 @@ module DiscourseWorkflows
[last_id - MAX_BACKLOG_SIZE, 0].max
end
- def self.publish_created(execution, workflow_name:)
+ def self.publish_created(execution, workflow_name:, trigger_node: nil)
MessageBus.publish(
EXECUTIONS_CHANNEL,
{
type: "execution_created",
- execution: execution_summary(execution, workflow_name: workflow_name),
+ execution:
+ execution_summary(execution, workflow_name:).merge(
+ trigger: Execution.trigger_summary(trigger_node),
+ execution_mode: execution.execution_mode,
+ ),
},
**publish_options,
)
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/executor/execution_store.rb b/plugins/discourse-workflows/lib/discourse_workflows/executor/execution_store.rb
index bd64d2d6e98..f19ab12a495 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/executor/execution_store.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/executor/execution_store.rb
@@ -182,7 +182,11 @@ module DiscourseWorkflows
attach_workflow_call_run!
if created
- ExecutionProgressPublisher.publish_created(@execution, workflow_name: workflow.name)
+ ExecutionProgressPublisher.publish_created(
+ @execution,
+ workflow_name: workflow.name,
+ trigger_node: @workflow_snapshot&.find_node(@trigger_node_id),
+ )
end
@execution
end
diff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/execution_progress_publisher_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/execution_progress_publisher_spec.rb
index dd980a5770c..a75bf2c1176 100644
--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/execution_progress_publisher_spec.rb
+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/execution_progress_publisher_spec.rb
@@ -47,10 +47,25 @@ RSpec.describe DiscourseWorkflows::ExecutionProgressPublisher do
created_messages =
MessageBus.track_publish(described_class::EXECUTIONS_CHANNEL) do
- described_class.publish_created(execution, workflow_name: workflow.name)
+ described_class.publish_created(
+ execution,
+ workflow_name: workflow.name,
+ trigger_node: {
+ "id" => "trigger-1",
+ "name" => "When topic created",
+ "type" => "trigger:topic_created",
+ },
+ )
end
expect(created_messages.first.data).to include(type: "execution_created")
- expect(created_messages.first.data[:execution]).to include(workflow_name: workflow.name)
+ expect(created_messages.first.data[:execution]).to include(
+ workflow_name: workflow.name,
+ execution_mode: "normal",
+ trigger: {
+ name: "When topic created",
+ type: "trigger:topic_created",
+ },
+ )
end
describe ".subscription_start_id" do
diff --git a/plugins/discourse-workflows/spec/requests/discourse_workflows/executions_controller_spec.rb b/plugins/discourse-workflows/spec/requests/discourse_workflows/executions_controller_spec.rb
index 71185abd1de..331addc0e90 100644
--- a/plugins/discourse-workflows/spec/requests/discourse_workflows/executions_controller_spec.rb
+++ b/plugins/discourse-workflows/spec/requests/discourse_workflows/executions_controller_spec.rb
@@ -90,6 +90,60 @@ RSpec.describe DiscourseWorkflows::ExecutionsController do
)
end
+ it "returns the trigger node from the stored snapshot and the execution mode" do
+ execution =
+ Fabricate(
+ :discourse_workflows_completed_execution,
+ workflow:,
+ trigger_node_id: "trigger-1",
+ execution_mode: :manual,
+ )
+ Fabricate(
+ :discourse_workflows_execution_data,
+ execution:,
+ workflow_data: {
+ "name" => "Original workflow",
+ "nodes" => [
+ {
+ "id" => "trigger-1",
+ "name" => "When topic created",
+ "type" => "trigger:topic_created",
+ },
+ ],
+ "connections" => {
+ },
+ },
+ )
+
+ get "/admin/plugins/discourse-workflows/executions.json"
+
+ expect(response.parsed_body["executions"][0]).to include(
+ "execution_mode" => "manual",
+ "trigger" => {
+ "name" => "When topic created",
+ "type" => "trigger:topic_created",
+ },
+ )
+ end
+
+ it "falls back to the published trigger node without a stored snapshot" do
+ graph = build_workflow_graph { |g| g.node "trigger-1", "trigger:manual", name: "Run it" }
+ published_workflow =
+ Fabricate(:discourse_workflows_workflow, created_by: admin, published: true, **graph)
+ Fabricate(
+ :discourse_workflows_completed_execution,
+ workflow: published_workflow,
+ trigger_node_id: "trigger-1",
+ )
+
+ get "/admin/plugins/discourse-workflows/executions.json"
+
+ expect(response.parsed_body["executions"][0]["trigger"]).to eq(
+ "name" => "Run it",
+ "type" => "trigger:manual",
+ )
+ end
+
it "paginates with cursor param" do
execution_1 = Fabricate(:discourse_workflows_execution, workflow: workflow)
execution_2 = Fabricate(:discourse_workflows_execution, workflow: workflow)
diff --git a/plugins/discourse-workflows/spec/system/executions_spec.rb b/plugins/discourse-workflows/spec/system/executions_spec.rb
index d7da4512c18..9edd1891977 100644
--- a/plugins/discourse-workflows/spec/system/executions_spec.rb
+++ b/plugins/discourse-workflows/spec/system/executions_spec.rb
@@ -16,6 +16,40 @@ RSpec.describe "Discourse Workflows - Executions" do
expect(executions_page).to have_execution_with_status("success")
end
+ it "links each execution to its detail view and its workflow" do
+ execution = Fabricate(:discourse_workflows_completed_execution, workflow: workflow)
+
+ executions_page.visit_index.open_execution(execution.id)
+
+ expect(page).to have_current_path(
+ "/admin/plugins/discourse-workflows/workflows/#{workflow.id}/executions/#{execution.id}",
+ )
+ expect(executions_page).to have_detail
+
+ executions_page.visit_index.open_workflow(workflow.name)
+
+ expect(page).to have_current_path("/admin/plugins/discourse-workflows/workflows/#{workflow.id}")
+ end
+
+ it "opens the execution when clicking anywhere on its row" do
+ execution = Fabricate(:discourse_workflows_completed_execution, workflow: workflow)
+
+ executions_page.visit_index.click_row(execution.id)
+
+ expect(page).to have_current_path(
+ "/admin/plugins/discourse-workflows/workflows/#{workflow.id}/executions/#{execution.id}",
+ )
+ end
+
+ it "keeps row checkboxes selectable in bulk mode" do
+ execution = Fabricate(:discourse_workflows_completed_execution, workflow: workflow)
+
+ executions_page.visit_index.enable_bulk_select.select_row(execution.id)
+
+ expect(executions_page).to have_delete_selected_button
+ expect(page).to have_current_path("/admin/plugins/discourse-workflows/executions")
+ end
+
it "shows the execution detail view with steps" do
execution = Fabricate(:discourse_workflows_completed_execution, workflow: workflow)
Fabricate(
diff --git a/plugins/discourse-workflows/spec/system/page_objects/pages/executions.rb b/plugins/discourse-workflows/spec/system/page_objects/pages/executions.rb
index 6521fb8b18e..3149d6c408a 100644
--- a/plugins/discourse-workflows/spec/system/page_objects/pages/executions.rb
+++ b/plugins/discourse-workflows/spec/system/page_objects/pages/executions.rb
@@ -16,6 +16,43 @@ module PageObjects
self
end
+ def open_execution(execution_id)
+ page.find(".workflows-executions-manager__id", text: "##{execution_id}").click
+ self
+ end
+
+ def click_row(execution_id)
+ page.find(".d-table__row[data-item-id='#{execution_id}']").click
+ self
+ end
+
+ def select_row(execution_id)
+ page.find(
+ ".d-table__row[data-item-id='#{execution_id}'] .workflows-admin-table__checkbox",
+ ).click
+ self
+ end
+
+ def enable_bulk_select
+ page.find(
+ ".workflows-admin-table__toolbar .btn",
+ text: I18n.t("js.discourse_workflows.executions.select"),
+ ).click
+ self
+ end
+
+ def has_delete_selected_button?
+ page.has_css?(
+ ".btn-danger",
+ text: I18n.t("js.discourse_workflows.executions.delete_selected"),
+ )
+ end
+
+ def open_workflow(name)
+ page.find(".d-table__overview-link", text: name).click
+ self
+ end
+
def has_execution_with_status?(status)
page.has_css?(".workflows-executions-manager__status.--#{status}")
end
diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/execution/manager-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/execution/manager-test.gjs
index 0dd50ecffa2..97e9b70093a 100644
--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/execution/manager-test.gjs
+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/execution/manager-test.gjs
@@ -22,6 +22,16 @@ class MessageBusStub extends Service {
}
}
+class WorkflowsNodeTypesStub extends Service {
+ nodeTypes = [];
+
+ load() {}
+
+ findNodeType(identifier) {
+ return identifier === "trigger:topic_created" ? { icon: "plus" } : null;
+ }
+}
+
module(
"Integration | Component | Workflows | Execution | ExecutionsManager",
function (hooks) {
@@ -30,6 +40,11 @@ module(
hooks.beforeEach(function () {
this.owner.unregister("service:message-bus");
this.owner.register("service:message-bus", MessageBusStub);
+ this.owner.unregister("service:workflows-node-types");
+ this.owner.register(
+ "service:workflows-node-types",
+ WorkflowsNodeTypesStub
+ );
this.clock = fakeTime("2026-08-13T05:00:02Z", "UTC", true);
this.executionStatus = "running";
this.requestCount = 0;
@@ -46,6 +61,9 @@ module(
workflow_id: 30,
workflow_name: "Running workflow",
status: this.executionStatus,
+ execution_mode: this.executionMode,
+ trigger: this.trigger,
+ error: this.executionError,
run_time_ms: null,
started_at: "2026-08-13T05:00:00Z",
finished_at: null,
@@ -159,6 +177,46 @@ module(
.hasText("Pending", "the newer execution is placed first");
});
+ test("identifies each execution", async function (assert) {
+ this.executionStatus = "error";
+ this.executionMode = "manual";
+ this.executionError = "Something went wrong";
+ this.trigger = { name: "New topic", type: "trigger:topic_created" };
+
+ await render(
+ <template><ExecutionsManager @workflowId={{30}} /></template>
+ );
+ await waitFor(".workflows-executions-manager__status");
+
+ assert
+ .dom(".d-table__overview-link")
+ .hasText("#11473", "the id matches the detail page breadcrumb");
+ assert
+ .dom(".workflows-executions-manager__trigger-name")
+ .hasText("New topic", "the trigger that started the run is shown");
+ assert
+ .dom(".workflows-executions-manager__trigger .d-icon-plus")
+ .exists("the trigger uses its node type icon");
+ assert
+ .dom(".workflows-executions-manager__mode.--manual")
+ .hasText("Manual", "manual runs are labelled");
+ assert
+ .dom(".workflows-executions-manager__error")
+ .hasText("Something went wrong", "the error is shown in the list");
+ });
+
+ test("does not label normal executions", async function (assert) {
+ this.executionMode = "normal";
+
+ await render(
+ <template><ExecutionsManager @workflowId={{30}} /></template>
+ );
+ await waitFor(".workflows-executions-manager__status");
+
+ assert.dom(".workflows-executions-manager__mode").doesNotExist();
+ assert.dom(".workflows-executions-manager__error").doesNotExist();
+ });
+
test("distinguishes queued executions from active processing", async function (assert) {
this.executionStatus = "pending";