app/helpers/application_helper.rb
# Create a url to show a record from the passed in view
Create a url to show a record from the passed in view
Create a url to show a record from the passed in view
def view_to_url(view, parent = nil)
    association = view_to_association(view, parent)
    if association.nil?
      controller, action = db_to_controller(view.db)
      if controller == "ems_cloud" && action == "show"
        return ems_clouds_path
      end
      if parent && parent.class.base_model.to_s == "MiqCimInstance" && ["CimBaseStorageExtent", "SniaLocalFileSystem"].include?(view.db)
        return url_for(:controller => controller, :action => action, :id => parent.id) + "?show="
      else
        if @explorer
          if %w(OntapStorageSystem
                OntapLogicalDisk
                OntapStorageVolume
                OntapFileShare
                SecurityGroup
                FloatingIp
                NetworkRouter
                CloudSubnet).include?(view.db)
            return url_for(:controller => controller, :action => "show") + "/"
          elsif ["Vm"].include?(view.db) && parent && request.parameters[:controller] != "vm"
            return url_for(:controller => "vm_or_template", :action => "show") + "/"
          elsif %w(ConfigurationProfile).include?(view.db) &&
                request.parameters[:controller] == "provider_foreman"
            return url_for(:action => action, :id => nil) + "/"
          elsif %w(ConfiguredSystem).include?(view.db) && request.parameters[:controller] == "provider_foreman"
            return url_for(:action => action, :id => nil) + "/"
          else
            return url_for(:action => action) + "/" 
          end
        else
          controller = "vm_cloud" if controller == "template_cloud"
          controller = "vm_infra" if controller == "template_infra"
          return url_for(:controller => controller, :action => action) + "/"
        end
      end
    else
      return url_for(:controller => parent.kind_of?(VmOrTemplate) && !@explorer ? parent.class.base_model.to_s.underscore : request.parameters["controller"],
                     :action     => association,
                     :id         => parent.id) + "?#{@explorer ? "x_show" : "show"}="
    end
  end
def view_to_url ( view , parent = nil ) association = view_to_association ( view , parent ) if association . nil? controller , action = db_to_controller ( view . db ) if controller == "ems_cloud" && action == "show" return ems_clouds_path end if parent && parent . class . base_model . to_s == "MiqCimInstance" && [ "CimBaseStorageExtent" , "SniaLocalFileSystem" ] . include? ( view . db ) return url_for ( :controller => controller , :action => action , :id => parent . id ) + "?show=" else if @explorer if %w( OntapStorageSystem OntapLogicalDisk OntapStorageVolume OntapFileShare SecurityGroup FloatingIp NetworkRouter CloudSubnet ) . include? ( view . db ) return url_for ( :controller => controller , :action => "show" ) + "/" elsif [ "Vm" ] . include? ( view . db ) && parent && request . parameters [ :controller ] != "vm" return url_for ( :controller => "vm_or_template" , :action => "show" ) + "/" elsif %w( ConfigurationProfile ) . include? ( view . db ) && request . parameters [ :controller ] == "provider_foreman" return url_for ( :action => action , :id => nil ) + "/" elsif %w( ConfiguredSystem ) . include? ( view . db ) && request . parameters [ :controller ] == "provider_foreman" return url_for ( :action => action , :id => nil ) + "/" else return url_for ( :action => action ) + "/" end else controller = "vm_cloud" if controller == "template_cloud" controller = "vm_infra" if controller == "template_infra" return url_for ( :controller => controller , :action => action ) + "/" end end else return url_for ( :controller => parent . kind_of? ( VmOrTemplate ) && ! @explorer ? parent . class . base_model . to_s . underscore : request . parameters [ "controller" ] , :action => association , :id => parent . id ) + "?#{@explorer ? "x_show" : "show"}=" end end
Create a url to show a record from the passed in view
Create a url to show a record from the passed in view
# showing a list view of another CI inside vmx # this is to handle link to a vm in vm explorer from service explorer # In explorer, don't jump to other controllers # need to add a check for @explorer while setting controller incase building a link for details screen to show items # i.e users list view screen inside explorer needs to point to vm_or_template controller
view
<not_specific>
parent
<not_specific>