From f6109be6f097d0d15e82b05fb84cdf6294a34e3c Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Tue, 6 Feb 2024 18:31:53 +0100 Subject: [PATCH] the triangle is better to read. --- lib/trailblazer/workflow/state/discovery.rb | 11 +- .../workflow/state/discovery/testing.rb | 20 ++- test/collaboration_test.rb | 124 +++++++++--------- 3 files changed, 87 insertions(+), 68 deletions(-) diff --git a/lib/trailblazer/workflow/state/discovery.rb b/lib/trailblazer/workflow/state/discovery.rb index 456e209..09f8350 100644 --- a/lib/trailblazer/workflow/state/discovery.rb +++ b/lib/trailblazer/workflow/state/discovery.rb @@ -119,17 +119,20 @@ def self.render_cli_state_table(discovery_state_table) ) # 186 for laptop 13" end - def self.readable_name_for_catch_event(position) - "#{position[:tuple][0]}: (✉)➔[#{position[:comment][1]}]" + def self.readable_name_for_catch_event(position, envelope_icon: false) + envelope_icon = "(✉)➔" # TODO: implement {envelope_icon} flag. + envelope_icon = "▶" + + "#{position[:tuple][0]}: #{envelope_icon}[#{position[:comment][1]}]" end def self.readable_name_for_resume_event(position) resume_labels = position[:comment][1] - catch_events = resume_labels.collect { |catch_label| "(✉)#{catch_label}" } + catch_events = resume_labels.collect { |catch_label| "▶#{catch_label}" } .join(" ") - "#{position[:tuple][0]}: ➔[#{catch_events}]" + "#{position[:tuple][0]}: [#{catch_events}]" end def self.render_cli_event_table(discovery_state_table, render_ids: false, hide_lanes: []) diff --git a/lib/trailblazer/workflow/state/discovery/testing.rb b/lib/trailblazer/workflow/state/discovery/testing.rb index 7c50419..430990c 100644 --- a/lib/trailblazer/workflow/state/discovery/testing.rb +++ b/lib/trailblazer/workflow/state/discovery/testing.rb @@ -60,6 +60,10 @@ def self.render_comment_header(structure) content = "#{Discovery.readable_name_for_resume_event(lane_position)}" end.join(", ") + expected_lane_positions = testing_row[:expected_lane_positions].collect do |lane_position| + content = "#{readable_name_for_resume_event_or_terminus(lane_position)}" + end.join(", ") + Hash[ "triggered catch", triggered_catch_event_label, @@ -67,9 +71,11 @@ def self.render_comment_header(structure) "input ctx", nil, - # *start_configuration_cols "start configuration", - start_configuration_cols + start_configuration_cols, + + "expected lane positions", + expected_lane_positions ] end @@ -77,6 +83,7 @@ def self.render_comment_header(structure) Hirb::Helpers::Table.render(cli_rows, fields: [ "triggered catch", "start configuration", + "expected lane positions", ], max_width: 186, ) # 186 for laptop 13" @@ -109,6 +116,15 @@ def self.serialize_lane_position(lane_position, lanes:) } end + def self.readable_name_for_resume_event_or_terminus(position) + if position[:comment][0] == :terminus + terminus_label = "End.#{position[:comment][1]}" + return "#{position[:tuple][0]}: ◉#{terminus_label}" + end + + Discovery.readable_name_for_resume_event(position) + end + end # Testing end end diff --git a/test/collaboration_test.rb b/test/collaboration_test.rb index cd5ece9..c10950d 100644 --- a/test/collaboration_test.rb +++ b/test/collaboration_test.rb @@ -384,19 +384,19 @@ def render_states(states, lanes:, additional_state_data:, task_map:) cli_state_table = Trailblazer::Workflow::State::Discovery.render_cli_state_table(state_table) puts cli_state_table assert_equal cli_state_table, -%(+---------------------------------+------------------------------------------------------+ -| state name | triggerable events | -+---------------------------------+------------------------------------------------------+ -| "> Create form" | "UI: (✉)➔[Create form]" | -| "> Create" | "UI: (✉)➔[Create]" | -| "> Update form/Notify approver" | "UI: (✉)➔[Update form]", "UI: (✉)➔[Notify approver]" | -| "> Update" | "UI: (✉)➔[Update]" | -| "> Delete? form/Publish" | "UI: (✉)➔[Delete? form]", "UI: (✉)➔[Publish]" | -| "> Revise form" | "UI: (✉)➔[Revise form]" | -| "> Delete/Cancel" | "UI: (✉)➔[Delete]", "UI: (✉)➔[Cancel]" | -| "> Archive" | "UI: (✉)➔[Archive]" | -| "> Revise" | "UI: (✉)➔[Revise]" | -+---------------------------------+------------------------------------------------------+ +%(+---------------------------------+------------------------------------------------+ +| state name | triggerable events | ++---------------------------------+------------------------------------------------+ +| "> Create form" | "UI: ▶[Create form]" | +| "> Create" | "UI: ▶[Create]" | +| "> Update form/Notify approver" | "UI: ▶[Update form]", "UI: ▶[Notify approver]" | +| "> Update" | "UI: ▶[Update]" | +| "> Delete? form/Publish" | "UI: ▶[Delete? form]", "UI: ▶[Publish]" | +| "> Revise form" | "UI: ▶[Revise form]" | +| "> Delete/Cancel" | "UI: ▶[Delete]", "UI: ▶[Cancel]" | +| "> Archive" | "UI: ▶[Archive]" | +| "> Revise" | "UI: ▶[Revise]" | ++---------------------------------+------------------------------------------------+ 9 rows in set) @@ -405,25 +405,25 @@ def render_states(states, lanes:, additional_state_data:, task_map:) cli_state_table = Trailblazer::Workflow::State::Discovery.render_cli_event_table(state_table) # puts cli_state_table assert_equal cli_state_table, -%(+-------------------+---------------------------+-------------------------+------------------------------------+-----------------------------------------------------------------+ -| event name | triggered catch event | lifecycle | UI | approver | -+-------------------+---------------------------+-------------------------+------------------------------------+-----------------------------------------------------------------+ -| "Create form" | UI: (✉)➔[Create form] | Create | Create form | [#] | -| "Create" | UI: (✉)➔[Create] | Create | Create | [#] | -| "Create" | UI: (✉)➔[Create] | Create | Create | [#] | -| "Update form" | UI: (✉)➔[Update form] | Update, Notify approver | Update form, Notify approver | [#] | -| "Notify approver" | UI: (✉)➔[Notify approver] | Update, Notify approver | Update form, Notify approver | [#] | -| "Update" | UI: (✉)➔[Update] | Update, Notify approver | Update | [#] | -| "Notify approver" | UI: (✉)➔[Notify approver] | Update, Notify approver | Update form, Notify approver | [#] | -| "Delete? form" | UI: (✉)➔[Delete? form] | Publish, Delete, Update | Update form, Delete? form, Publish | failure | -| "Publish" | UI: (✉)➔[Publish] | Publish, Delete, Update | Update form, Delete? form, Publish | failure | -| "Update" | UI: (✉)➔[Update] | Update, Notify approver | Update | [#] | -| "Revise form" | UI: (✉)➔[Revise form] | Revise | Revise form | success | -| "Delete" | UI: (✉)➔[Delete] | Publish, Delete, Update | Delete, Cancel | failure | -| "Cancel" | UI: (✉)➔[Cancel] | Publish, Delete, Update | Delete, Cancel | failure | -| "Archive" | UI: (✉)➔[Archive] | Archive | Archive | failure | -| "Revise" | UI: (✉)➔[Revise] | Revise | Revise | success | -+-------------------+---------------------------+-------------------------+------------------------------------+-----------------------------------------------------------------+ +%(+-------------------+------------------------+-------------------------+------------------------------------+-----------------------------------------------------------------+ +| event name | triggered catch event | lifecycle | UI | approver | ++-------------------+------------------------+-------------------------+------------------------------------+-----------------------------------------------------------------+ +| "Create form" | UI: ▶[Create form] | Create | Create form | [#] | +| "Create" | UI: ▶[Create] | Create | Create | [#] | +| "Create" | UI: ▶[Create] | Create | Create | [#] | +| "Update form" | UI: ▶[Update form] | Update, Notify approver | Update form, Notify approver | [#] | +| "Notify approver" | UI: ▶[Notify approver] | Update, Notify approver | Update form, Notify approver | [#] | +| "Update" | UI: ▶[Update] | Update, Notify approver | Update | [#] | +| "Notify approver" | UI: ▶[Notify approver] | Update, Notify approver | Update form, Notify approver | [#] | +| "Delete? form" | UI: ▶[Delete? form] | Publish, Delete, Update | Update form, Delete? form, Publish | failure | +| "Publish" | UI: ▶[Publish] | Publish, Delete, Update | Update form, Delete? form, Publish | failure | +| "Update" | UI: ▶[Update] | Update, Notify approver | Update | [#] | +| "Revise form" | UI: ▶[Revise form] | Revise | Revise form | success | +| "Delete" | UI: ▶[Delete] | Publish, Delete, Update | Delete, Cancel | failure | +| "Cancel" | UI: ▶[Cancel] | Publish, Delete, Update | Delete, Cancel | failure | +| "Archive" | UI: ▶[Archive] | Archive | Archive | failure | +| "Revise" | UI: ▶[Revise] | Revise | Revise | success | ++-------------------+------------------------+-------------------------+------------------------------------+-----------------------------------------------------------------+ 15 rows in set) cli_state_table_with_ids = Trailblazer::Workflow::State::Discovery.render_cli_event_table(state_table, render_ids: true) @@ -433,35 +433,35 @@ def render_states(states, lanes:, additional_state_data:, task_map:) %(+-------------------+----------------------------------------+----------------------------------------+----------------------------------------+----------------------------------------+ | event name | triggered catch event | lifecycle | UI | approver | +-------------------+----------------------------------------+----------------------------------------+----------------------------------------+----------------------------------------+ -| \"Create form\" | UI: (✉)➔[Create form] | [\"Create\"] | [\"Create form\"] | [#