Skip to content

Commit

Permalink
the triangle is better to read.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Feb 6, 2024
1 parent 38501e2 commit f6109be
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 68 deletions.
11 changes: 7 additions & 4 deletions lib/trailblazer/workflow/state/discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: [])
Expand Down
20 changes: 18 additions & 2 deletions lib/trailblazer/workflow/state/discovery/testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,30 @@ 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,

"input ctx",
nil,

# *start_configuration_cols
"start configuration",
start_configuration_cols
start_configuration_cols,

"expected lane positions",
expected_lane_positions
]
end


Hirb::Helpers::Table.render(cli_rows, fields: [
"triggered catch",
"start configuration",
"expected lane positions",
],
max_width: 186,
) # 186 for laptop 13"
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit f6109be

Please sign in to comment.