__PACKAGE__->run_before('check_auth');
__PACKAGE__->run_before('check_task_server');
-__PACKAGE__->run_before('load_background_job', only => [ qw(edit update destroy execute) ]);
+__PACKAGE__->run_before('load_background_job', only => [ qw(edit update destroy execute show) ]);
#
# actions
JOB_CLASSES => [ SL::BackgroundJob::Base->get_known_job_classes ]);
}
+sub action_show {
+ my ($self) = @_;
+
+ if ($::request->type eq 'json') {
+ $self->render(\ SL::JSON::to_json($self->background_job->as_tree), { type => 'json' });
+ } else {
+ $self->action_edit;
+ }
+}
+
sub action_create {
my ($self) = @_;
use SL::Controller::CsvImport::Shipto;
use SL::Controller::CsvImport::Project;
use SL::Controller::CsvImport::Order;
+use SL::JSON;
use SL::BackgroundJob::CsvImport;
use SL::System::TaskServer;
$self->{deferred} = 1;
- $self->render_inputs;
+ if ($::request->type eq 'json') {
+ $self->render(\ SL::JSON::to_json($self->{background_job}->as_tree), { type => 'json' })
+ } else {
+ $self->render_inputs;
+ }
}
sub test_and_import {
use DateTime::Event::Cron;
use English qw(-no_match_vars);
+use Rose::DB::Object::Helpers qw(as_tree);
+
use SL::DB::MetaSetup::BackgroundJob;
use SL::DB::Manager::BackgroundJob;