]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add filename and path properties to fileevent endpoints
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 3 Oct 2023 06:36:31 +0000 (08:36 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 31 Oct 2023 15:00:30 +0000 (16:00 +0100)
gui/baculum/protected/API/Modules/FileEventManager.php
gui/baculum/protected/API/Modules/FileEventRecord.php
gui/baculum/protected/API/openapi_baculum.json

index be9652bb3a3f30ad37dc4750fa6baac46f22a987..c1dc8294095be4f719d633941797b64cac4fed36 100644 (file)
@@ -56,7 +56,14 @@ class FileEventManager extends APIModule {
 
                $where = Database::getWhere($criteria);
 
-               $sql = 'SELECT FileEvents.* FROM FileEvents ' . $where['where'] . $order . $limit . $offset;
+               $sql = 'SELECT
+                               FileEvents.*,
+                               Path.Path,
+                               File.Filename
+                       FROM FileEvents
+                       LEFT JOIN File ON (FileEvents.JobId = File.JobId AND FileEvents.FileIndex = File.FileIndex)
+                       LEFT JOIN Path USING (PathId)
+                       ' . $where['where'] . $order . $limit . $offset;
 
                return FileEventRecord::finder()->findAllBySql($sql, $where['params']);
        }
index 9b85c92ce3d5e4c999d8462f9281063c35f8cd58..c4f19620def4b3dce2c95f7fccaa2b4380413a40 100644 (file)
@@ -43,6 +43,10 @@ class FileEventRecord extends APIDbModule {
        public $severity;
        public $source;
 
+       // Extra properties
+       public $filename;
+       public $path;
+
        public static function finder($className = __CLASS__) {
                return parent::finder($className);
        }
index 1843948e232cda0dc1ba2ac1060623f78fa5b15e..65de4994d36196a4d0ecad8f2c740b9ec9e33c5b 100644 (file)
                                "source": {
                                        "description": "From where file event comes",
                                        "type": "string"
+                               },
+                               "filename": {
+                                       "description": "File name",
+                                       "type": "string"
+                               },
+                               "path": {
+                                       "description": "File directory path",
+                                       "type": "string"
                                }
                        }
                },