From: Marcin Haba Date: Wed, 26 Apr 2023 09:13:12 +0000 (+0200) Subject: baculum: Add objecttype parameter to jobs objects endpoint X-Git-Tag: Release-13.0.3~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4356f7cd4a3c40e121d179979ee75f9d24eb5bf5;p=thirdparty%2Fbacula.git baculum: Add objecttype parameter to jobs objects endpoint --- diff --git a/gui/baculum/protected/API/Modules/JobManager.php b/gui/baculum/protected/API/Modules/JobManager.php index c07f72d72..f9d0cd959 100644 --- a/gui/baculum/protected/API/Modules/JobManager.php +++ b/gui/baculum/protected/API/Modules/JobManager.php @@ -239,6 +239,7 @@ LEFT JOIN FileSet USING (FilesetId)' JOIN Client USING (ClientId) LEFT JOIN Pool USING (PoolId) LEFT JOIN FileSet USING (FilesetId) + LEFT JOIN Object USING (JobId) ' . $where['where']; Database::execute($sql, $where['params']); diff --git a/gui/baculum/protected/API/Pages/API/JobsObjects.php b/gui/baculum/protected/API/Pages/API/JobsObjects.php index df737618e..3a7a48d6f 100644 --- a/gui/baculum/protected/API/Pages/API/JobsObjects.php +++ b/gui/baculum/protected/API/Pages/API/JobsObjects.php @@ -50,6 +50,7 @@ class JobsObjects extends BaculumAPIServer { $fileset = $this->Request->contains('fileset') ? $this->Request['fileset'] : null; $clientid = $this->Request->contains('clientid') ? $this->Request['clientid'] : null; $client = $this->Request->contains('client') ? $this->Request['client'] : null; + $objecttype = $this->Request->contains('objecttype') && $misc->isValidName($this->Request['objecttype']) ? $this->Request['objecttype'] : null; $schedtime_from = $this->Request->contains('schedtime_from') && $misc->isValidInteger($this->Request['schedtime_from']) ? (int)$this->Request['schedtime_from'] : null; $schedtime_to = $this->Request->contains('schedtime_to') && $misc->isValidInteger($this->Request['schedtime_to']) ? (int)$this->Request['schedtime_to'] : null; $starttime_from = $this->Request->contains('starttime_from') && $misc->isValidInteger($this->Request['starttime_from']) ? (int)$this->Request['starttime_from'] : null; @@ -79,6 +80,15 @@ class JobsObjects extends BaculumAPIServer { return; } + $params = []; + + if (is_string($objecttype)) { + $params['Object.ObjectType'] = []; + $params['Object.ObjectType'][] = [ + 'vals' => $objecttype + ]; + } + if (!empty($jobids)) { /** * If jobids parameter provided, all other parameters are not used. @@ -125,8 +135,6 @@ class JobsObjects extends BaculumAPIServer { return; } - $params = []; - if ($afterjobid > 0) { $params['Job.JobId'] = []; $params['Job.JobId'][] = [ diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index ebd35c8d3..7f41fbe7b 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -2160,6 +2160,15 @@ "type": "string" } }, + { + "name": "objecttype", + "in": "query", + "required": false, + "description": "Job object type (ex. PostgreSQL, m365...etc.)", + "schema": { + "type": "string" + } + }, { "name": "schedtime_from", "in": "query",