Class: ChronoForge::Dashboard::TimelinePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/chrono_forge/dashboard/timeline_presenter.rb

Defined Under Namespace

Classes: Entry

Constant Summary collapse

RUN_PATTERN =

Per-iteration run logs of a durably_repeat step are excluded from the timeline (they get their own paginated page) and summarized instead.

"durably_repeat#{StepNameParser::DELIM}%#{StepNameParser::DELIM}%".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow) ⇒ TimelinePresenter

Returns a new instance of TimelinePresenter.



12
# File 'app/presenters/chrono_forge/dashboard/timeline_presenter.rb', line 12

def initialize(workflow) = @workflow = workflow

Instance Attribute Details

#workflowObject (readonly)

Returns the value of attribute workflow.



14
15
16
# File 'app/presenters/chrono_forge/dashboard/timeline_presenter.rb', line 14

def workflow
  @workflow
end

Instance Method Details

#current_positionObject



29
30
31
32
33
34
# File 'app/presenters/chrono_forge/dashboard/timeline_presenter.rb', line 29

def current_position
  logs = ordered_logs
  logs.reverse.find { |l| l.failed? } ||
    logs.reverse.find { |l| l.pending? && StepNameParser.parse(l.step_name).kind == :wait } ||
    logs.last
end

#entriesObject



16
17
18
# File 'app/presenters/chrono_forge/dashboard/timeline_presenter.rb', line 16

def entries
  @entries ||= build
end

#orphan_errorsObject

Error logs not shown on any step — workflow-level failures whose step_name is nil and that aren’t linked to a $workflow_failure$ marker. Surfaced so a failure is never invisible. (Repeat-run errors live on the repetitions page, so they’re excluded.)



24
25
26
27
# File 'app/presenters/chrono_forge/dashboard/timeline_presenter.rb', line 24

def orphan_errors
  entries
  @orphan_errors
end