<commit_before>ActiveAdmin.register Server do
  actions :all, except: [:new]
  menu priority: 7

  permit_params :name, :hostname, :state, :built, :locked, :suspended, :root_password,
                :cpus, :memory, :disk_size, :bandwidth

  sidebar :control_panel_links do
    ul do
      li link_to('Dashboard', root_path)
      li link_to('Servers', servers_path)
      li link_to('Tickets', tickets_path)
    end
  end

  # See permitted parameters documentation:
  # https://github.com/gregbell/active_admin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
  #
  # permit_params :list, :of, :attributes, :on, :model
  #
  # or
  #
  # permit_params do
  #  permitted = [:permitted, :attributes]
  #  permitted << :other if resource.something?
  #  permitted
  # end

  index do
    column :id
    column :name
    column :hostname
    column :state
    column :built
    column :cpus
    column :memory
    column :disk_size
    column :bandwidth
    column :user
    column :location
    column :primary_ip_address

    actions
  end

  collection_action :zombies, method: :get do
    onapp_servers   = AllServers.new.process
    deleted_servers = Server.only_deleted

    @zombies = onapp_servers.select do |server|
      existing = deleted_servers.find_by_identifier(server['identifier'])

      if existing.present?
        server['self'] = existing
        true
      else
        false
      end
    end
  end

  member_action :ip_usage, method: :get do
    server = Server.find(params[:id])
    @page_title = "IP Usage: #{server.primary_ip_address}"
    @servers = Server.with_deleted.includes(:user).find_by(primary_ip_address: server.primary_ip_address)
  end

  action_item :edit, only: :show do
    link_to 'IP Usage', ip_usage_admin_server_path(server)
  end

  action_item :edit, only: :index do
    link_to 'Zombies', zombies_admin_servers_path
  end
end<commit_msg>deleted servers info<commit_after>ActiveAdmin.register Server do
  actions :all, except: [:new]
  menu priority: 7

  permit_params :name, :hostname, :state, :built, :locked, :suspended, :root_password,
                :cpus, :memory, :disk_size, :bandwidth

  scope("Existing", default: true) { |scope| scope.where(:deleted_at => nil) }
  scope :with_deleted
  scope :only_deleted
  
  sidebar :control_panel_links do
    ul do
      li link_to('Dashboard', root_path)
      li link_to('Servers', servers_path)
      li link_to('Tickets', tickets_path)
    end
  end
  
  # See permitted parameters documentation:
  # https://github.com/gregbell/active_admin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
  #
  # permit_params :list, :of, :attributes, :on, :model
  #
  # or
  #
  # permit_params do
  #  permitted = [:permitted, :attributes]
  #  permitted << :other if resource.something?
  #  permitted
  # end

  index do
    column :id
    column :name
    column :hostname
    column :state
    column :built
    column :cpus
    column :memory
    column :disk_size
    column :bandwidth
    column :user
    column :location
    column :primary_ip_address
    column :deleted_at

    actions
  end

  collection_action :zombies, method: :get do
    onapp_servers   = AllServers.new.process
    deleted_servers = Server.only_deleted

    @zombies = onapp_servers.select do |server|
      existing = deleted_servers.find_by_identifier(server['identifier'])

      if existing.present?
        server['self'] = existing
        true
      else
        false
      end
    end
  end

  member_action :ip_usage, method: :get do
    server = Server.find(params[:id])
    @page_title = "IP Usage: #{server.primary_ip_address}"
    @servers = Server.with_deleted.includes(:user).find_by(primary_ip_address: server.primary_ip_address)
  end

  action_item :edit, only: :show do
    link_to 'IP Usage', ip_usage_admin_server_path(server)
  end

  action_item :edit, only: :index do
    link_to 'Zombies', zombies_admin_servers_path
  end
  
end
{'fraction_non_alphanumeric': 0.0987189148455162, 'fraction_numerical': 0.001004772670183371, 'mean_word_length': 3.277121374865736, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1158552', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1302, 'n_words': 311}