From 11804a0050acd8efb2d83ea96a74a908a518d47a Mon Sep 17 00:00:00 2001 From: MyuTsu Date: Fri, 18 Oct 2024 15:45:33 +0200 Subject: [PATCH] add SO Computer in ComputerVirtualMachine --- src/Computer.php | 30 ++++++++++++++++++++++++++++++ src/ComputerVirtualMachine.php | 2 ++ 2 files changed, 32 insertions(+) diff --git a/src/Computer.php b/src/Computer.php index 1931250c69c..77151890612 100644 --- a/src/Computer.php +++ b/src/Computer.php @@ -613,6 +613,36 @@ public function rawSearchOptions() return $tab; } + public static function rawSearchOptionsToAdd($itemtype) + { + $tab = []; + + $tab[] = [ + 'id' => 'Computer', + 'name' => __('Computers') + ]; + + $tab[] = [ + 'id' => '5', + 'table' => Computer::getTable(), + 'field' => 'uuid', + 'name' => __('Computer UUID'), + 'datatype' => 'string', + 'massiveaction' => false, + 'forcegroupby' => true, + 'joinparams' => [ + 'beforejoin' => [ + 'table' => ComputerVirtualMachine::getTable(), + 'joinparams' => [ + 'jointype' => 'child', + ] + ] + ] + ]; + + return $tab; + } + public static function getIcon() { return "ti ti-device-laptop"; diff --git a/src/ComputerVirtualMachine.php b/src/ComputerVirtualMachine.php index fb79625dc2a..bb1901b8ddd 100644 --- a/src/ComputerVirtualMachine.php +++ b/src/ComputerVirtualMachine.php @@ -493,6 +493,8 @@ public function rawSearchOptions() 'massiveaction' => false, ]; + $tab = array_merge($tab, Computer::rawSearchOptionsToAdd("ComputerVirtualMachine")); + return $tab; }