Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2c597c2d

Von Sven Schöling vor etwa 9 Jahren hinzugefügt

  • ID 2c597c2df21ae8025159665f39845ccfe9b7dabd
  • Vorgänger 496f55c6
  • Nachfolger 1b158070

BackgroundJobs optional als json ausliefern

Unterschiede anzeigen:

SL/Controller/BackgroundJob.pm
19 19

  
20 20
__PACKAGE__->run_before('check_auth');
21 21
__PACKAGE__->run_before('check_task_server');
22
__PACKAGE__->run_before('load_background_job', only => [ qw(edit update destroy execute) ]);
22
__PACKAGE__->run_before('load_background_job', only => [ qw(edit update destroy execute show) ]);
23 23

  
24 24
#
25 25
# actions
......
51 51
                JOB_CLASSES => [ SL::BackgroundJob::Base->get_known_job_classes ]);
52 52
}
53 53

  
54
sub action_show {
55
  my ($self) = @_;
56

  
57
  if ($::request->type eq 'json') {
58
    $self->render(\ SL::JSON::to_json($self->background_job->as_tree), { type => 'json' });
59
  } else {
60
    $self->action_edit;
61
  }
62
}
63

  
54 64
sub action_create {
55 65
  my ($self) = @_;
56 66

  
SL/Controller/CsvImport.pm
17 17
use SL::Controller::CsvImport::Shipto;
18 18
use SL::Controller::CsvImport::Project;
19 19
use SL::Controller::CsvImport::Order;
20
use SL::JSON;
20 21
use SL::BackgroundJob::CsvImport;
21 22
use SL::System::TaskServer;
22 23

  
......
318 319

  
319 320
  $self->{deferred} = 1;
320 321

  
321
  $self->render_inputs;
322
  if ($::request->type eq 'json') {
323
    $self->render(\ SL::JSON::to_json($self->{background_job}->as_tree), { type => 'json' })
324
  } else {
325
    $self->render_inputs;
326
  }
322 327
}
323 328

  
324 329
sub test_and_import {
SL/DB/BackgroundJob.pm
5 5
use DateTime::Event::Cron;
6 6
use English qw(-no_match_vars);
7 7

  
8
use Rose::DB::Object::Helpers qw(as_tree);
9

  
8 10
use SL::DB::MetaSetup::BackgroundJob;
9 11
use SL::DB::Manager::BackgroundJob;
10 12

  

Auch abrufbar als: Unified diff