ActiveAdmin.register JamRuby::LatencyTester, :as => 'LatencyTester' do

  config.filters = true
  config.per_page = 50
  config.clear_action_items!
  config.sort_order = "client_id"
  menu :parent => 'Operations'

  controller do
    def scoped_collection
      @latency_testers ||= end_of_association_chain
      .order('client_id')
    end
  end


  index :as => :block do |latency_tester|
    div :for => latency_tester do
      h3 "#{latency_tester.client_id}"
      columns do
        column do
          panel 'Details' do
            attributes_table_for(latency_tester) do
              row :connection do |latency_tester| latency_tester.connection ? "last updated at: #{latency_tester.connection.updated_at}" : "no connection" end
            end
          end
        end
      end
    end
  end
end

