Class: SagaForge::Dashboard::SagaGraph

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/saga_forge/dashboard/saga_graph.rb

Overview

Turns a Definition#to_graph (structured nodes + typed chain/jump/stay edges) into Cytoscape.js "elements", optionally overlaying one saga instance's status onto the nodes. Rendering-only: no DB, no analysis.

Constant Summary collapse

RANK =
{"failed" => 3, "stalled" => 2, "processed" => 1}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(graph, definition, state = nil) ⇒ SagaGraph

Returns a new instance of SagaGraph.



9
10
11
12
13
# File 'app/presenters/saga_forge/dashboard/saga_graph.rb', line 9

def initialize(graph, definition, state = nil)
  @graph = graph # SagaForge::Dashboard::Graph
  @definition = definition
  @state = state
end

Instance Method Details

#to_hObject



15
16
17
# File 'app/presenters/saga_forge/dashboard/saga_graph.rb', line 15

def to_h
  {nodes: node_elements, edges: edge_elements}
end