Class: Docit::UiController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/docit/ui_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
# File 'app/controllers/docit/ui_controller.rb', line 7

def index
  render_ui(Docit.configuration.default_ui)
end

#scalarObject



15
16
17
# File 'app/controllers/docit/ui_controller.rb', line 15

def scalar
  render_ui(:scalar)
end

#specObject



44
45
46
47
# File 'app/controllers/docit/ui_controller.rb', line 44

def spec
  RouteInspector.eager_load_controllers!
  render json: SchemaGenerator.generate
end

#swaggerObject



11
12
13
# File 'app/controllers/docit/ui_controller.rb', line 11

def swagger
  render_ui(:swagger)
end

#systemObject



19
20
21
# File 'app/controllers/docit/ui_controller.rb', line 19

def system
  render_ui(:system)
end

#system_insightsObject



32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/docit/ui_controller.rb', line 32

def system_insights
  graph = system_graph
  insight = Ai::SystemInsightGenerator.new(
    graph: graph,
    selected_node_ids: selected_node_ids,
    mode: insight_mode
  ).generate
  render json: { insight: insight }
rescue Docit::Error => e
  render json: { error: e.message }, status: :unprocessable_entity
end

#system_specObject



23
24
25
26
27
28
29
30
# File 'app/controllers/docit/ui_controller.rb', line 23

def system_spec
  unless Docit.configuration.system_graph_enabled
    return render(json: { error: "System graph disabled" }, status: :not_found)
  end

  RouteInspector.eager_load_controllers!
  render json: SystemGraph::Generator.generate
end