]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Remove overview, order_by, order_direction and object_limit parameters from...
authorMarcin Haba <marcin.haba@bacula.pl>
Wed, 22 Mar 2023 15:08:24 +0000 (16:08 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Thu, 20 Apr 2023 10:00:26 +0000 (12:00 +0200)
gui/baculum/protected/API/Modules/JobManager.php
gui/baculum/protected/API/Pages/API/JobsObjects.php
gui/baculum/protected/API/openapi_baculum.json

index 74185905a20fee4a206a69973a9e0c87a119dace..a8c4be49e28a9786ea3ff8b45ee7a4554bf866ae 100644 (file)
@@ -183,19 +183,15 @@ JOIN FileSet USING (FilesetId)'
        }
 
        /**
-        * Get job records with objects in one of the two flavours: normal or overview.
+        * Get job records with objects.
         *
         * @param array $criteria SQL criteria to get job list
         * @param mixed $limit_val result limit value
         * @param int $offset_val result offset value
-        * @param string $sort_col sort by selected SQL column (default: JobId)
-        * @param string $sort_order sort order:'ASC' or 'DESC' (default: ASC, ascending)
-        * @param mixed $object_limit limit for object results
-        * @param bool $overview if true, results are displayed in overview mode, otherwise normal mode
         * @param string $view job records view (basic, full)
         * @return array job record list with objects or empty list if no job found
         */
-       public function getJobsObjectsOverview($criteria = array(), $limit_val = null, $offset_val = 0, $sort_col = 'Job.JobId', $sort_order = 'ASC', $object_limit = null, $overview = false, $view = self::JOB_RESULT_VIEW_FULL) {
+       public function getJobsObjectsOverview($criteria = array(), $limit_val = null, $offset_val = 0, $view = self::JOB_RESULT_VIEW_FULL) {
 
                $connection = JobRecord::finder()->getDbConnection();
                $connection->setActive(true);
@@ -241,7 +237,6 @@ JOIN FileSet USING (FilesetId)'
 
                        // get all objects
                        $jlimit = is_int($limit_val) && $limit_val > 0 ? ' LIMIT ' . $limit_val : '';
-                       $olimit = is_int($object_limit) && $object_limit > 0 ? ' LIMIT ' . $object_limit : '';
                        $offset = is_int($offset_val) && $offset_val > 0 ? ' OFFSET ' . $offset_val : '';
                        $job_record = 'Job.*';
                        $obj_record = 'Object.*';
index 8f3b7c58a63420dab9599e4ff3db615ecb6824c8..ac9af22b341b71945d948d90101a40292d5f0cd6 100644 (file)
@@ -40,7 +40,6 @@ class JobsObjects extends BaculumAPIServer {
                $jobids = $this->Request->contains('jobids') && $misc->isValidIdsList($this->Request['jobids']) ? $this->Request['jobids'] : '';
                $afterjobid = $this->Request->contains('afterjobid') && $misc->isValidInteger($this->Request['afterjobid']) ? $this->Request['afterjobid'] : 0;
                $limit = $this->Request->contains('limit') && $misc->isValidInteger($this->Request['limit']) ? (int)$this->Request['limit'] : 0;
-               $object_limit = $this->Request->contains('object_limit') && $misc->isValidInteger($this->Request['object_limit']) ? (int)$this->Request['object_limit'] : 0;
                $offset = $this->Request->contains('offset') && $misc->isValidInteger($this->Request['offset']) ? (int)$this->Request['offset'] : 0;
                $jobstatus = $this->Request->contains('jobstatus') ? $this->Request['jobstatus'] : '';
                $level = $this->Request->contains('level') && $misc->isValidJobLevel($this->Request['level']) ? $this->Request['level'] : '';
@@ -58,9 +57,6 @@ class JobsObjects extends BaculumAPIServer {
                $realendtime_from = $this->Request->contains('realendtime_from') && $misc->isValidInteger($this->Request['realendtime_from']) ? (int)$this->Request['realendtime_from'] : null;
                $realendtime_to = $this->Request->contains('realendtime_to') && $misc->isValidInteger($this->Request['realendtime_to']) ? (int)$this->Request['realendtime_to'] : null;
                $age = $this->Request->contains('age') && $misc->isValidInteger($this->Request['age']) ? (int)$this->Request['age'] : null;
-               $order_by = $this->Request->contains('order_by') && $misc->isValidColumn($this->Request['order_by']) ? $this->Request['order_by']: 'JobId';
-               $order_direction = $this->Request->contains('order_direction') && $misc->isValidOrderDirection($this->Request['order_direction']) ? $this->Request['order_direction']: 'DESC';
-               $overview = ($this->Request->contains('overview') && $misc->isValidBooleanTrue($this->Request['overview']));
                $view = ($this->Request->contains('view') && $misc->isValidResultView($this->Request['view'])) ? $this->Request['view'] : JobManager::JOB_RESULT_VIEW_FULL;
 
                if (!empty($jobids)) {
@@ -76,10 +72,6 @@ class JobsObjects extends BaculumAPIServer {
                                $params,
                                null,
                                0,
-                               $order_by,
-                               $order_direction,
-                               $object_limit,
-                               $overview,
                                $view
                        );
                        $this->output = $result;
@@ -99,30 +91,6 @@ class JobsObjects extends BaculumAPIServer {
                        $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
                        return;
                }
-               $jr = new \ReflectionClass('Baculum\API\Modules\JobRecord');
-               $sort_cols = $jr->getProperties();
-               if (strpos($order_by, '.') !== false) {
-                       $order_by_ex = explode('.', $order_by);
-                       $order_by =  array_shift($order_by_ex);
-
-               }
-               $order_by_lc = strtolower($order_by);
-               $cols_excl = ['client', 'fileset', 'pool'];
-               $columns = [];
-               foreach ($sort_cols as $cols) {
-                       $name = $cols->getName();
-                       // skip columns not existing in the catalog
-                       if (in_array($name, $cols_excl)) {
-                               continue;
-                       }
-                       $columns[] = $name;
-               }
-               if (!in_array($order_by_lc, $columns)) {
-                       $this->output = JobError::MSG_ERROR_INVALID_PROPERTY;
-                       $this->error = JobError::ERROR_INVALID_PROPERTY;
-                       return;
-               }
-
 
                $params = [];
 
@@ -314,10 +282,6 @@ class JobsObjects extends BaculumAPIServer {
                                        $params,
                                        $limit,
                                        $offset,
-                                       $order_by,
-                                       $order_direction,
-                                       $object_limit,
-                                       $overview,
                                        $view
                                );
                                $this->output = $result;
@@ -328,4 +292,4 @@ class JobsObjects extends BaculumAPIServer {
                        $this->error = $result->exitcode;
                }
        }
-}
\ No newline at end of file
+}
index fed4c45db8ee838ad84e4c1475e5c0aef9adfb6a..3c9b863cf85d79980ee31ebd87319c0fabaa5512 100644 (file)
                                        {
                                                "$ref": "#/components/parameters/Offset"
                                        },
-                                       {
-                                               "name": "object_limit",
-                                               "in": "query",
-                                               "description": "Object item limit",
-                                               "required": false,
-                                               "schema": {
-                                                       "type": "integer"
-                                               }
-                                       },
                                        {
                                                "name": "name",
                                                "in": "query",
                                                        "type": "integer"
                                                }
                                        },
-                                       {
-                                               "name": "order_by",
-                                               "in": "query",
-                                               "required": false,
-                                               "description": "Sort by selected job property (default jobid). There can be any job property (jobid, job, clientid ...etc.) except client, fileset and pool.",
-                                               "schema": {
-                                                       "type": "string"
-                                               }
-                                       },
-                                       {
-                                               "name": "order_direction",
-                                               "in": "query",
-                                               "required": false,
-                                               "description": "Order direction. It can be 'asc' (ascending order) or 'desc' (descending order - default)",
-                                               "schema": {
-                                                       "type": "string",
-                                                       "enum": ["asc", "desc"]
-                                               }
-                                       },
-                                       {
-                                               "name": "overview",
-                                               "in": "query",
-                                               "required": false,
-                                               "description": "If set, it puts jobs (and objects) in job status groups (successful, unsuccessful, running, all). NOTE: Offset and limit parameters do not apply to overview counts.",
-                                               "schema": {
-                                                       "type": "boolean"
-                                               }
-                                       },
                                        {
                                                "name": "view",
                                                "in": "query",