From: Marcin Haba Date: Mon, 17 Apr 2023 07:51:03 +0000 (+0200) Subject: Enable using show command output also for internal purposes X-Git-Tag: Release-13.0.3~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7bf6f67bfcebb85848831b74db8b5dd470bb59d;p=thirdparty%2Fbacula.git Enable using show command output also for internal purposes --- diff --git a/gui/baculum/protected/API/Pages/API/JobsShow.php b/gui/baculum/protected/API/Pages/API/JobsShow.php index 6da275563..e30096efe 100644 --- a/gui/baculum/protected/API/Pages/API/JobsShow.php +++ b/gui/baculum/protected/API/Pages/API/JobsShow.php @@ -20,6 +20,8 @@ * Bacula(R) is a registered trademark of Kern Sibbald. */ +namespace Baculum\API\Pages\API; + use Baculum\API\Modules\ConsoleOutputPage; use Baculum\API\Modules\ConsoleOutputShowPage; use Baculum\Common\Modules\Errors\JobError; @@ -35,6 +37,12 @@ class JobsShow extends ConsoleOutputShowPage { public function get() { $out_format = $this->Request->contains('output') && $this->isOutputFormatValid($this->Request['output']) ? $this->Request['output'] : ConsoleOutputPage::OUTPUT_FORMAT_RAW; + $out = $this->show($out_format); + $this->output = $out->output; + $this->error = $out->exitcode; + } + + public function show($out_format) { $result = $this->getModule('bconsole')->bconsoleCommand( $this->director, ['.jobs'], @@ -71,8 +79,7 @@ class JobsShow extends ConsoleOutputShowPage { } elseif($out_format === ConsoleOutputPage::OUTPUT_FORMAT_JSON) { $out = $this->getJSONOutput($params); } - $this->output = $out->output; - $this->error = $out->exitcode; + return $out; } /**