Class: DurableFlow::WorkflowRunsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- DurableFlow::WorkflowRunsController
- Defined in:
- app/controllers/durable_flow/workflow_runs_controller.rb
Instance Method Summary collapse
Instance Method Details
#definition ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/durable_flow/workflow_runs_controller.rb', line 28 def definition @workflow_run = WorkflowRun.find_by!(run_id: params[:run_id]) @workflow_class = @workflow_run.workflow_class.safe_constantize @workflow_timeline = @workflow_run.timeline @step_statuses_by_name = @workflow_run.workflow_steps.index_by(&:name).transform_values(&:status) if @workflow_class.nil? @definition_error = "Could not constantize #{@workflow_run.workflow_class.inspect}" elsif !(@workflow_class <= DurableFlow::Workflow) @definition_error = "#{@workflow_run.workflow_class} is not a DurableFlow::Workflow" else @definition_graph = DurableFlow::DefinitionAnalyzer.call(@workflow_class) end rescue StandardError => error @definition_error = "#{error.class}: #{error.}" end |
#index ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/durable_flow/workflow_runs_controller.rb', line 17 def index @workflow_runs = WorkflowRun.order(created_at: :desc).limit(100) @status_counts = @workflow_runs.group_by(&:status).transform_values(&:count) @active_count = @workflow_runs.count { |run| !run.terminal? } end |
#show ⇒ Object
23 24 25 26 |
# File 'app/controllers/durable_flow/workflow_runs_controller.rb', line 23 def show @workflow_run = WorkflowRun.find_by!(run_id: params[:run_id]) @workflow_timeline = @workflow_run.timeline end |