app/controllers/ops_controller/db.rb
def db_list(exp = nil)
    @lastaction = "db_list"
    @force_no_grid_xml = true
    model = case @sb[:active_tab] # Build view based on tab selected
            when "db_connections"
              VmdbDatabaseConnection
            when "db_details"
              VmdbTableEvm
            when "db_indexes"
              VmdbIndex
            when "db_settings"
              VmdbDatabaseSetting
            end
    # @explorer = true if model == VmdbIndex

    if model == VmdbIndex
      # building a filter with expression to show VmdbTableEvm tables only
      exp = MiqExpression.new(
        "and" => [
          {
            "=" => {
              "value" => "VmdbTableEvm",
              "field" => "VmdbIndex.vmdb_table-type"
            }
          }
        ]
      )
    elsif model == VmdbDatabaseConnection
      @zones = Zone.all.sort_by(&:name).collect { |z| [z.name, z.name] }
      # for now we dont need this pulldown, need to get a method that gives us a list of workers for filter pulldown
      # @workers = MiqWorker.all.sort_by(&:type).collect { |w| [w.friendly_name, w.id] }
    end

    @view, @pages = get_view(model, :filter => exp ? exp : nil) # Get the records (into a view) and the paginator

    @ajax_paging_buttons = true
    @no_checkboxes = true
    @showlinks = true # Need to set @showlinks if @no_checkboxes is set to true
    @current_page = @pages[:current] unless @pages.nil? # save the current page number

    # Came in from outside show_list partial
    if params[:action] == "list_view_filter" || params[:ppsetting] || params[:searchtag] || params[:entry] || params[:sort_choice] || params[:page]
      render :update do |page|                    # Use RJS to update the display
        page.replace_html("gtl_div", :partial => 'layouts/x_gtl', :locals => {:action_url => "db_list"})
        page.replace_html("paging_div", :partial => "layouts/x_pagingcontrols")
        page << "miqSparkle(false);"  # Need to turn off sparkle in case original ajax element gets replaced
      end
    end
  end
# Show list of VMDB tables or settings
Show list of VMDB tables or settings
Show list of VMDB tables or settings
def db_list(exp = nil)
    @lastaction = "db_list"
    @force_no_grid_xml = true
    model = case @sb[:active_tab] 
            when "db_connections"
              VmdbDatabaseConnection
            when "db_details"
              VmdbTableEvm
            when "db_indexes"
              VmdbIndex
            when "db_settings"
              VmdbDatabaseSetting
            end
    if model == VmdbIndex
      exp = MiqExpression.new(
        "and" => [
          {
            "=" => {
              "value" => "VmdbTableEvm",
              "field" => "VmdbIndex.vmdb_table-type"
            }
          }
        ]
      )
    elsif model == VmdbDatabaseConnection
      @zones = Zone.all.sort_by(&:name).collect { |z| [z.name, z.name] }
    end
    @view, @pages = get_view(model, :filter => exp ? exp : nil) 
    @ajax_paging_buttons = true
    @no_checkboxes = true
    @showlinks = true 
    @current_page = @pages[:current] unless @pages.nil? 
    if params[:action] == "list_view_filter" || params[:ppsetting] || params[:searchtag] || params[:entry] || params[:sort_choice] || params[:page]
      render :update do |page|                    
        page.replace_html("gtl_div", :partial => 'layouts/x_gtl', :locals => {:action_url => "db_list"})
        page.replace_html("paging_div", :partial => "layouts/x_pagingcontrols")
        page << "miqSparkle(false);"  
      end
    end
  end
def db_list ( exp = nil ) @lastaction = "db_list" @force_no_grid_xml = true model = case @sb [ :active_tab ] when "db_connections" VmdbDatabaseConnection when "db_details" VmdbTableEvm when "db_indexes" VmdbIndex when "db_settings" VmdbDatabaseSetting end if model == VmdbIndex exp = MiqExpression . new ( "and" => [ { "=" => { "value" => "VmdbTableEvm" , "field" => "VmdbIndex.vmdb_table-type" } } ] ) elsif model == VmdbDatabaseConnection @zones = Zone . all . sort_by ( & :name ) . collect { | z | [ z . name , z . name ] } end @view , @pages = get_view ( model , :filter => exp ? exp : nil ) @ajax_paging_buttons = true @no_checkboxes = true @showlinks = true @current_page = @pages [ :current ] unless @pages . nil? if params [ :action ] == "list_view_filter" || params [ :ppsetting ] || params [ :searchtag ] || params [ :entry ] || params [ :sort_choice ] || params [ :page ] render :update do | page | page . replace_html ( "gtl_div" , :partial => 'layouts/x_gtl' , :locals => { :action_url => "db_list" } ) page . replace_html ( "paging_div" , :partial => "layouts/x_pagingcontrols" ) page << "miqSparkle(false);" end end end
Show list of VMDB tables or settings
Show list of VMDB tables or settings
# Build view based on tab selected # @explorer = true if model == VmdbIndex # building a filter with expression to show VmdbTableEvm tables only # for now we dont need this pulldown, need to get a method that gives us a list of workers for filter pulldown # @workers = MiqWorker.all.sort_by(&:type).collect { |w| [w.friendly_name, w.id] } # Get the records (into a view) and the paginator # Need to set @showlinks if @no_checkboxes is set to true # save the current page number # Came in from outside show_list partial # Use RJS to update the display # Need to turn off sparkle in case original ajax element gets replaced
exp