BackgroundJobHistory getmodels
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 18 Sep 2013 14:59:25 +0000 (16:59 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 14 Oct 2013 09:56:12 +0000 (11:56 +0200)
SL/Controller/BackgroundJobHistory.pm
SL/Controller/Part.pm
SL/Template/Plugin/L.pm

index 5b0cd8f..850d464 100644 (file)
@@ -4,10 +4,7 @@ use strict;
 
 use parent qw(SL::Controller::Base);
 
-use SL::Controller::Helper::Filtered;
 use SL::Controller::Helper::GetModels;
-use SL::Controller::Helper::Paginated;
-use SL::Controller::Helper::Sorted;
 use SL::DB::BackgroundJobHistory;
 use SL::Helper::Flash;
 use SL::Locale::String;
@@ -15,30 +12,14 @@ use SL::System::TaskServer;
 
 use Rose::Object::MakeMethods::Generic
 (
-  scalar                  => [ qw(history db_args flat_filter filter_summary) ],
-  'scalar --get_set_init' => [ qw(task_server) ],
+  scalar                  => [ qw(history filter_summary) ],
+  'scalar --get_set_init' => [ qw(task_server models) ],
 );
 
 __PACKAGE__->run_before('check_auth');
 __PACKAGE__->run_before('add_stylesheet');
 __PACKAGE__->run_before('check_task_server');
 
-__PACKAGE__->make_filtered(
-  MODEL             => 'BackgroundJobHistory',
-  LAUNDER_TO        => 'filter'
-);
-__PACKAGE__->make_paginated(ONLY => [ qw(list) ]);
-
-__PACKAGE__->make_sorted(
-  ONLY         => [ qw(list) ],
-
-  package_name => t8('Package name'),
-  run_at       => t8('Run at'),
-  status       => t8('Execution status'),
-  result       => t8('Result'),
-  error        => t8('Error'),
-);
-
 #
 # actions
 #
@@ -50,7 +31,8 @@ sub action_list {
 
   $self->render('background_job_history/list',
                 title   => $::locale->text('Background job history'),
-                ENTRIES => $self->get_models);
+                ENTRIES => $self->models->get,
+                MODELS  => $self->models);
 }
 
 sub action_show {
@@ -114,4 +96,20 @@ sub make_filter_summary {
   $self->filter_summary(join(', ', @filter_strings));
 }
 
+sub init_models {
+  my ($self) = @_;
+
+  SL::Controller::Helper::GetModels->new(
+    controller => $self,
+    model  => 'BackgroundJobHistory',
+    sorted => {
+      package_name => t8('Package name'),
+      run_at       => t8('Run at'),
+      status       => t8('Execution status'),
+      result       => t8('Result'),
+      error        => t8('Error'),
+    },
+  );
+}
+
 1;
index 97c0159..c8b0c31 100644 (file)
@@ -71,7 +71,7 @@ sub action_part_picker_result {
 }
 
 sub init_parts {
-  $_[0]->models->get (with_objects => [ qw(unit_obj) ]);
+  $_[0]->models->get;
 }
 
 sub init_models {
@@ -86,7 +86,8 @@ sub init_models {
         dir  => 1,
       },
       partnumber  => t8('Partnumber'),
-    }
+    },
+    with_objects => [ qw(unit_obj) ],
   );
 }
 
index 31d9a8f..3cde384 100644 (file)
@@ -479,7 +479,7 @@ sub paginate_controls {
       $url_params{ $pager->form_params->[0] } = delete $url_params{page};
       $url_params{ $pager->form_params->[1] } = delete $url_params{per_page} if exists $url_params{per_page};
 
-      return $params{models}->get_callback(%url_params);
+      return $models->get_callback(%url_params);
     },
     %params,
   );