app/helpers/application_helper.rb
# Convert a db name to a controller name and an action
Convert a db name to a controller name and an action
Convert a db name to a controller name and an action
def db_to_controller(db, action = "show")
    action = "x_show" if @explorer
    case db
    when "ActionSet"
      controller = "miq_action"
      action = "show_set"
    when "AutomationRequest"
      controller = "miq_request"
      action = "show"
    when "CimBaseStorageExtent"
      controller = request.parameters[:controller]
      action = "cim_base_storage_extents"
    when "ConditionSet"
      controller = "condition"
    when "ScanItemSet"
      controller = "ops"
      action = "ap_show"
    when "MiqEventDefinition"
      controller = "event"
      action = "_none_"
    when "User", "Group", "Patch", "GuestApplication"
      controller = "vm"
      action = @lastaction
    when "MiqReportResult"
      controller = "report"
      action = "show_saved"
    when "MiqSchedule"
      if request.parameters["controller"] == "report"
        controller = "report"
        action = "show_schedule"
      else
        controller = "ops"
        action = "schedule_show"
      end
    when "MiqAeClass"
      controller = "miq_ae_class"
      action = "show_instances"
    when "MiqAeInstance"
      controller = "miq_ae_class"
      action = "show_details"
    when "MiqCimInstance"
      controller = @view ? @view.db.underscore : @record.class.to_s.underscore
      action = "show"
    when "SecurityGroup"
      controller = "security_group"
      action = "show"
    when "ServiceResource", "ServiceTemplate"
      controller = "catalog"
    when "SniaLocalFileSystem"
      controller = request.parameters[:controller]
      action = "snia_local_file_systems"
    when "MiqWorker"
      controller = request.parameters[:controller]
      action = "diagnostics_worker_selected"
    when "CloudNetwork", "OrchestrationStackOutput", "OrchestrationStackParameter", "OrchestrationStackResource"
      controller = request.parameters[:controller]
    when /^ManageIQ::Providers::(\w+)Manager$/
      controller = "ems_#{$1.underscore}"
    when /^ManageIQ::Providers::(\w+)Manager::(\w+)$/
      controller = "#{$2.underscore}_#{$1.underscore}"
    else
      controller = db.underscore
    end
    return controller, action
  end
def db_to_controller ( db , action = "show" ) action = "x_show" if @explorer case db when "ActionSet" controller = "miq_action" action = "show_set" when "AutomationRequest" controller = "miq_request" action = "show" when "CimBaseStorageExtent" controller = request . parameters [ :controller ] action = "cim_base_storage_extents" when "ConditionSet" controller = "condition" when "ScanItemSet" controller = "ops" action = "ap_show" when "MiqEventDefinition" controller = "event" action = "_none_" when "User" , "Group" , "Patch" , "GuestApplication" controller = "vm" action = @lastaction when "MiqReportResult" controller = "report" action = "show_saved" when "MiqSchedule" if request . parameters [ "controller" ] == "report" controller = "report" action = "show_schedule" else controller = "ops" action = "schedule_show" end when "MiqAeClass" controller = "miq_ae_class" action = "show_instances" when "MiqAeInstance" controller = "miq_ae_class" action = "show_details" when "MiqCimInstance" controller = @view ? @view . db . underscore : @record . class . to_s . underscore action = "show" when "SecurityGroup" controller = "security_group" action = "show" when "ServiceResource" , "ServiceTemplate" controller = "catalog" when "SniaLocalFileSystem" controller = request . parameters [ :controller ] action = "snia_local_file_systems" when "MiqWorker" controller = request . parameters [ :controller ] action = "diagnostics_worker_selected" when "CloudNetwork" , "OrchestrationStackOutput" , "OrchestrationStackParameter" , "OrchestrationStackResource" controller = request . parameters [ :controller ] when / ^ManageIQ::Providers::( \w +)Manager$ / controller = "ems_#{$1.underscore}" when / ^ManageIQ::Providers::( \w +)Manager::( \w +)$ / controller = "#{$2.underscore}_#{$1.underscore}" else controller = db . underscore end return controller , action end
Convert a db name to a controller name and an action
Convert a db name to a controller name and an action
db
<not_specific>
action
<not_specific>