<commit_before><commit_msg>Replacement for E::W::Interface<commit_after>package EnsEMBL::Web::DbFrontend;

## NAME: EnsEMBL::Web::DbFrontend
### A class for configuring automated database frontends

### STATUS: Under development

### DESCRIPTION:
### This module, and its associated modules in E::W::Command::DbFrontend
### and E::W::Component::DbFrontend, provide a way of automating the creation
### of database frontend whilst allowing extension of the basic functionality
### through custom forms etc.

use strict;
use warnings;
no warnings 'uninitialized';

use base qw(EnsEMBL::Web::Root);

sub new {
  my ($class, $model) = @_;
  return unless ref($model->object) =~ /Data::Rose/;

  ## Set default values
  my $all_columns = [];
  foreach my $column (@{$model->object->get_all_columns}) {
    push @$all_columns, $column->name; 
  } 

  my $self = {
    'hub'              => $model->hub,
    'show_fields'      => $all_columns,
    'dropdown_query'   => {},
    'option_columns'   => [],
    'show_preview'     => 1,
    'show_primary_key' => 0,
    'show_history'     => 0,
    'delete_mode'      => 0,
  };

  bless $self, $class;

  ## Optional customisation
  $self->init;

  return $self;
}

sub init {}

##----------- ACCESSORS ----------------------------------------

sub hub { my $self = shift; return $self->{'hub'}; }

sub show_fields { my $self = shift; return @{$self->{'show_fields'}}; }

sub dropdown_query { my $self = shift; return $self->{'dropdown_query'}; }

sub option_columns { my $self = shift; return @{$self->{'option_columns'}}; }

sub show_preview { my $self = shift; return $self->{'show_preview'}; }

sub show_primary_key { my $self = shift; return $self->{'show_primary_key'}; }

sub show_history { my $self = shift; return $self->{'show_history'}; }

sub delete_mode { my $self = shift; return $self->{'delete_mode'}; }

##-------------- Stubs for optional methods -------------------

sub modify_form {}



1;
{'fraction_non_alphanumeric': 0.19948717948717948, 'fraction_numerical': 0.002564102564102564, 'mean_word_length': 3.2879120879120878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, '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': '5886757', 'n_tokens_mistral': 636, 'n_tokens_neox': 615, 'n_words': 169}