<commit_before>ActiveAdmin.register Endpoint do

# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/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

  permit_params do
    permitted = [:name, :url]
  end

  member_action :prefixes, method: [:get, :post] do
    if request.post?
      Prefix::import_csv(params)
      redirect_to "/admin/endpoints/#{params[:id]}/prefixes"
    else
      @endpoint_id = params[:id]
      render :prefixes<commit_msg>add notice when saving prefixes is successed<commit_after>ActiveAdmin.register Endpoint do

# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/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

  permit_params do
    permitted = [:name, :url]
  end

  member_action :prefixes, method: [:get, :post] do
    if request.post?
      Prefix::import_csv(params)
      redirect_to "/admin/endpoints/#{params[:id]}/prefixes", notice: "CSV imported successfully!"
    else
      @endpoint_id = params[:id]
      render :prefixes
{'fraction_non_alphanumeric': 0.12830957230142567, 'fraction_numerical': 0.0013577732518669382, 'mean_word_length': 4.208480565371024, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '6057701', 'n_tokens_mistral': 465, 'n_tokens_neox': 468, 'n_words': 105}