def show
authorize :inspect, :graph?
if primary_type.nil?
render plain:
"You don't have permission to view object type: #{params[:object_type].to_s.downcase.singularize}",
status: :bad_request and return
end
if params[:relationships].blank? &&
GraphRecords::DEFAULT_TRAVERSALS.key?(primary_type)
default_rels = GraphRecords::DEFAULT_TRAVERSALS[primary_type] || {}
new_params = params.to_unsafe_h.merge("relationships" => default_rels)
redirect_to inspect_path(new_params) and return
end
@graph_record =
GraphRecords.new(
traversals_config:,
primary_type:,
clickable: true,
show_pii:
)
@mermaid = @graph_record.graph(**graph_params).join("\n")
end