From: Marcin Haba Date: Sun, 11 Aug 2019 05:22:52 +0000 (+0200) Subject: baculum: Fix running job twice when job is running by run job window X-Git-Tag: Release-9.6.0~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63da60f91416bea2057d362f32aae114ca5b3f3d;p=thirdparty%2Fbacula.git baculum: Fix running job twice when job is running by run job window --- diff --git a/gui/baculum/protected/Web/Portlets/RunJob.php b/gui/baculum/protected/Web/Portlets/RunJob.php index 94ef64c76..6a2740b87 100644 --- a/gui/baculum/protected/Web/Portlets/RunJob.php +++ b/gui/baculum/protected/Web/Portlets/RunJob.php @@ -315,9 +315,9 @@ class RunJob extends Portlets { if ($result->error === 0) { $this->getPage()->getCallbackClient()->callClientFunction('set_loading_status', array('loading')); - $this->EstimationLog->Text = implode($result->output); + $this->RunJobLog->Text = implode('', $result->output); } else { - $this->EstimationLog->Text = $result->output; + $this->RunJobLog->Text = $result->output; } } @@ -334,7 +334,7 @@ class RunJob extends Portlets { if ($result->error === 0) { if (count($result->output) > 0) { - $this->EstimationLog->Text = implode($result->output); + $this->RunJobLog->Text = implode('', $result->output); $this->getPage()->getCallbackClient()->callClientFunction( 'estimate_output_refresh', array($out_id) @@ -346,7 +346,7 @@ class RunJob extends Portlets { ); } } else { - $this->EstimationLog->Text = $result->output; + $this->RunJobLog->Text = $result->output; } } public function runJobAgain($sender, $param) { @@ -367,7 +367,7 @@ class RunJob extends Portlets { $params['priority'] = $this->Priority->Text; $params['accurate'] = (integer)$this->Accurate->Checked; - if (in_array($this->Level->SelectedItem->Value, $this->job_to_verify)) { + if (!empty($this->Level->SelectedItem) && in_array($this->Level->SelectedItem->Value, $this->job_to_verify)) { $verifyVals = $this->getVerifyVals(); if ($this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobname']) { $params['verifyjob'] = $this->JobToVerifyJobName->SelectedValue; @@ -375,10 +375,18 @@ class RunJob extends Portlets { $params['jobid'] = $this->JobToVerifyJobId->Text; } } - $result = $this->getModule('api')->create(array('jobs', 'run'), $params)->output; - $started_jobid = $this->getModule('misc')->findJobIdStartedJob($result); - if (is_numeric($started_jobid)) { - $this->getPage()->goToPage('JobHistoryView', array('jobid' => $started_jobid)); + $result = $this->getModule('api')->create(array('jobs', 'run'), $params); + if ($result->error === 0) { + $started_jobid = $this->getModule('misc')->findJobIdStartedJob($result->output); + if (is_numeric($started_jobid)) { + $this->getPage()->getCallbackClient()->callClientFunction('run_job_go_to_running_job', $started_jobid); + } else { + $this->RunJobLog->Text = implode('', $result->output); + $this->getPage()->getCallbackClient()->callClientFunction('show_job_log', true); + } + } else { + $this->RunJobLog->Text = $result->output; + $this->getPage()->getCallbackClient()->callClientFunction('show_job_log', true); } } } diff --git a/gui/baculum/protected/Web/Portlets/RunJob.tpl b/gui/baculum/protected/Web/Portlets/RunJob.tpl index 0f8ac62a4..0a2ea966e 100644 --- a/gui/baculum/protected/Web/Portlets/RunJob.tpl +++ b/gui/baculum/protected/Web/Portlets/RunJob.tpl @@ -131,7 +131,7 @@ @@ -178,30 +182,43 @@ > $('#status_command_loading').css('visibility', 'visible'); - var logbox = document.getElementById('run_job_log'); - if ((logbox.offsetHeight + logbox.scrollTop) === logbox.scrollHeight) { - command_logbox_scroll = true; + var joblog = document.getElementById('run_job_log'); + if ((joblog.offsetHeight + joblog.scrollTop) === joblog.scrollHeight) { + command_joblog_scroll = true; } else { - command_logbox_scroll = false; + command_joblog_scroll = false; } $('#status_command_loading').css('visibility', 'hidden'); - if (command_logbox_scroll) { - var logbox = document.getElementById('run_job_log'); - logbox.scrollTo(0, logbox.scrollHeight); + if (command_joblog_scroll) { + scroll_down_job_log(); }