| 1 | use MooseX::Declare; | ||
| 2 | |||
| 3 | class ETLp::Audit::Browser::Controller::Job extends ETLp::Audit::Browser::Controller::Base { | ||
| 4 | |||
| 5 | method list { | ||
| 6 | my $page = $self->query->param('page') || 1; | ||
| 7 | my $config_id = $self->query->param('config_id') || undef; | ||
| 8 | my $section_name = $self->query->param('section_name') || undef; | ||
| 9 | my $minimum_date = $self->query->param('minimum_date') || undef; | ||
| 10 | my $maximum_date = $self->query->param('maximum_date') || undef; | ||
| 11 | my $status_id = $self->query->param('status_id') ||undef; | ||
| 12 | |||
| 13 | # The processes that the user is viewing | ||
| 14 | my $jobs = $self->model->get_jobs( | ||
| 15 | #{ | ||
| 16 | page => $page, | ||
| 17 | config_id => $config_id, | ||
| 18 | section_name => $section_name, | ||
| 19 | minimum_date => $minimum_date, | ||
| 20 | maximum_date => $maximum_date, | ||
| 21 | status_id => $status_id, | ||
| 22 | #} | ||
| 23 | ); | ||
| 24 | |||
| 25 | # The configuration and section drop_down lists | ||
| 26 | my $config_list = $self->model->get_config_list(); | ||
| 27 | my $section_list = $self->model->get_section_list($config_id); | ||
| 28 | my $status_list = $self->model->get_status_list; | ||
| 29 | |||
| 30 | $self->logger->debug("Config list: " . ref($config_list)); | ||
| 31 | $self->logger->debug("Section list: " . ref($section_list)); | ||
| 32 | |||
| 33 | return $self->tt_process( | ||
| 34 | { | ||
| 35 | jobs => $jobs, | ||
| 36 | minimum_date => $minimum_date, | ||
| 37 | maximum_date => $maximum_date, | ||
| 38 | config_list => $config_list, | ||
| 39 | section_list => $section_list, | ||
| 40 | status_list => $status_list, | ||
| 41 | config_id => $config_id, | ||
| 42 | status_id => $status_id, | ||
| 43 | section_name => $section_name, | ||
| 44 | header_inc => 'process_inc.tmpl', | ||
| 45 | } | ||
| 46 | ); | ||
| 47 | } | ||
| 48 | |||
| 49 | method update_sections { | ||
| 50 | my $config_id = $self->query->param('config_id') || undef; | ||
| 51 | return $self->model->get_config_section_options($config_id); | ||
| 52 | } | ||
| 53 | |||
| 54 | # Ajax call - when a user selects a section from the drop down list, | ||
| 55 | # return the configurations that it belongs to it in HTML '<option>' tags | ||
| 56 | method update_configs { | ||
| 57 | my $section_name = $self->query->param('section_name') || undef; | ||
| 58 | return $self->model->get_section_config_options($section_name); | ||
| 59 | } | ||
| 60 | |||
| 61 | method setup { | ||
| 62 | $self->start_mode('list'); | ||
| 63 | $self->run_modes([qw/list update_sections update_configs error/]); | ||
| 64 | } | ||
| 65 | |||
| 66 | method module { | ||
| 67 | return 'Processes'; | ||
| 68 | } | ||
| 69 | } |