From: Marcin Haba Date: Wed, 22 Mar 2023 15:08:24 +0000 (+0100) Subject: baculum: Remove overview, order_by, order_direction and object_limit parameters from... X-Git-Tag: Release-13.0.3~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf13e432f5cfa7aa784a595c67f59cc3b8a8ead7;p=thirdparty%2Fbacula.git baculum: Remove overview, order_by, order_direction and object_limit parameters from jobs objects endpoint --- diff --git a/gui/baculum/protected/API/Modules/JobManager.php b/gui/baculum/protected/API/Modules/JobManager.php index 74185905a..a8c4be49e 100644 --- a/gui/baculum/protected/API/Modules/JobManager.php +++ b/gui/baculum/protected/API/Modules/JobManager.php @@ -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.*'; diff --git a/gui/baculum/protected/API/Pages/API/JobsObjects.php b/gui/baculum/protected/API/Pages/API/JobsObjects.php index 8f3b7c58a..ac9af22b3 100644 --- a/gui/baculum/protected/API/Pages/API/JobsObjects.php +++ b/gui/baculum/protected/API/Pages/API/JobsObjects.php @@ -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 +} diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index fed4c45db..3c9b863cf 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -1921,15 +1921,6 @@ { "$ref": "#/components/parameters/Offset" }, - { - "name": "object_limit", - "in": "query", - "description": "Object item limit", - "required": false, - "schema": { - "type": "integer" - } - }, { "name": "name", "in": "query", @@ -2103,34 +2094,6 @@ "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",