1 package SL::Controller::TaskServer;
5 use parent qw(SL::Controller::Base);
8 use SL::System::TaskServer;
10 use Rose::Object::MakeMethods::Generic
12 'scalar --get_set_init' => [ qw(task_server) ],
15 __PACKAGE__->run_before('check_auth');
24 $::request->{layout}->use_stylesheet('background_jobs.css');
26 flash('warning', $::locale->text('The task server does not appear to be running.')) if !$self->task_server->is_running;
28 $self->render('task_server/show',
29 title => $::locale->text('Task server status'),
30 last_command_output => $::auth->get_session_value('TaskServer::last_command_output'));
36 if ($self->task_server->is_running) {
37 flash_later('error', $::locale->text('The task server is already running.'));
40 if ($self->task_server->start) {
41 flash_later('info', $::locale->text('The task server was started successfully.'));
43 flash_later('error', $::locale->text('Starting the task server failed.'));
46 $::auth->set_session_value('TaskServer::last_command_output' => $self->task_server->last_command_output);
49 $self->redirect_to(action => 'show');
55 if (!$self->task_server->is_running) {
56 flash_later('error', $::locale->text('The task server is not running.'));
59 if ($self->task_server->stop) {
60 flash_later('info', $::locale->text('The task server was stopped successfully.'));
62 flash_later('error', $::locale->text('Stopping the task server failed. Output:'));
65 $::auth->set_session_value('TaskServer::last_command_output' => $self->task_server->last_command_output);
68 $self->redirect_to(action => 'show');
76 $::auth->assert('admin');
83 sub init_task_server {
84 return SL::System::TaskServer->new;