]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add objecttype parameter to jobs objects endpoint
authorMarcin Haba <marcin.haba@bacula.pl>
Wed, 26 Apr 2023 09:13:12 +0000 (11:13 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Mon, 1 May 2023 11:18:25 +0000 (13:18 +0200)
gui/baculum/protected/API/Modules/JobManager.php
gui/baculum/protected/API/Pages/API/JobsObjects.php
gui/baculum/protected/API/openapi_baculum.json

index c07f72d72ee37340af6dd78ae80689762bff1b3f..f9d0cd959b7e5e9d30bbe254081962334a220d0e 100644 (file)
@@ -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']);
index df737618ed96dbce4bea9bbad3d8f6da6e31334b..3a7a48d6ffd0c6cbe9a8ce8b3557dcf79b10f00f 100644 (file)
@@ -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'][] = [
index ebd35c8d33550473fb2aef0eb18fde26994c1bfc..7f41fbe7b5b95dd4f453a52aaad402ef361943d6 100644 (file)
                                                        "type": "string"
                                                }
                                        },
+                                       {
+                                               "name": "objecttype",
+                                               "in": "query",
+                                               "required": false,
+                                               "description": "Job object type (ex. PostgreSQL, m365...etc.)",
+                                               "schema": {
+                                                       "type": "string"
+                                               }
+                                       },
                                        {
                                                "name": "schedtime_from",
                                                "in": "query",