Class: ChronoForge::Dashboard::WorkflowsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/chrono_forge/dashboard/workflows_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/chrono_forge/dashboard/workflows_controller.rb', line 4

def index
  @hide_branches = params[:hide_branches] != "0" # on by default
  @query = WorkflowsQuery.new(**list_params, exclude_branched: @hide_branches)
  @workflows = @query.records
  @waits = WaitStatePresenter.active_map(@workflows)
  # Stats track the toggle so the counts match the visible list — a large
  # fan-out's children don't dominate the totals while hidden from the list.
  stats_base = @hide_branches ? ChronoForge::Workflow.where(parent_execution_log_id: nil) : ChronoForge::Workflow.all
  stats = StatsQuery.new(base: stats_base)
  @stats = stats.counts
  @stats_cap = stats.cap
end

#showObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/chrono_forge/dashboard/workflows_controller.rb', line 17

def show
  @workflow = ChronoForge::Workflow.find(params[:id])
  @timeline = TimelinePresenter.new(@workflow)
  @context = ContextPresenter.new(@workflow)
  @wait = WaitStatePresenter.new(@workflow).active
  @periodic = PeriodicHealthPresenter.new(@workflow).tasks
  @branches = BranchesPresenter.new(@workflow)
  @parent_log = @workflow.parent_execution_log
end