Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
feat(agent,fleet): agents and fleets are searchable by a applied poli…
Browse files Browse the repository at this point in the history
…cy criteria

Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry authored and DIOHz0r committed May 18, 2018
1 parent 30e1916 commit 0ebb39a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
22 changes: 22 additions & 0 deletions inc/agent.class.php
Expand Up @@ -877,6 +877,28 @@ public function getSearchOptionsNew() {
'datatype' => 'dropdown'
];

$tab[] = [
'id' => '18',
'table' => 'glpi_plugin_flyvemdm_policies',
'field' => 'name',
'name' => __('Applied policy', 'flyvemdm'),
'datatype' => 'dropdown',
'comments' => '1',
'nosort' => true,
'joinparams' => [
'beforejoin' => [
'table' => 'glpi_plugin_flyvemdm_tasks',
'joinparams' => [
'jointype' => 'child',
'linkfield' => 'items_id_applied',
'condition' => "AND NEWTABLE.`itemtype_applied`='" . PluginFlyvemdmAgent::class . "'",
],
],
'jointype' => 'empty',
],
'massiveaction' => false
];

return $tab;
}

Expand Down
41 changes: 13 additions & 28 deletions inc/fleet.class.php
Expand Up @@ -246,38 +246,23 @@ public function getSearchOptionsNew() {

$tab[] = [
'id' => '3',
'table' => 'glpi_plugin_flyvemdm_tasks',
'field' => 'items_id',
'name' => __('Associated elements'),
'datatype' => 'specific',
'table' => 'glpi_plugin_flyvemdm_policies',
'field' => 'name',
'name' => __('Applied policy', 'flyvemdm'),
'datatype' => 'dropdown',
'comments' => '1',
'nosort' => true,
'nosearch' => true,
'additionalfields' => [
'0' => 'itemtype'
],
'joinparams' => [
'jointype' => 'child'
],
'forcegroupby' => true,
'massiveaction' => false
];

$tab[] = [
'id' => '4',
'table' => 'glpi_plugin_flyvemdm_tasks',
'field' => 'itemtype',
'name' => __('Associated item types'),
'datatype' => 'itemtypename',
'itemtype_list' => 'notifiable_types',
'nosort' => true,
'additionalfields' => [
'0' => 'itemtype'
],
'joinparams' => [
'jointype' => 'child'
'beforejoin' => [
'table' => 'glpi_plugin_flyvemdm_tasks',
'joinparams' => [
'jointype' => 'child',
'linkfield' => 'items_id_applied',
'condition' => "AND NEWTABLE.`itemtype_applied`='" . PluginFlyvemdmFleet::class . "'",
],
],
'jointype' => 'empty',
],
'forcegroupby' => true,
'massiveaction' => false
];

Expand Down
2 changes: 0 additions & 2 deletions setup.php
Expand Up @@ -99,8 +99,6 @@ function plugin_init_flyvemdm() {
plugin_flyvemdm_registerClasses();
plugin_flyvemdm_addHooks();

$CFG_GLPI['notifiable_types'] = [PluginFlyvemdmFleet::class, PluginFlyvemdmAgent::class];

Html::requireJs('charts');
$PLUGIN_HOOKS['add_css']['flyvemdm'][] = "css/style.css";
// Warning 'pluginflyvemdmmenu' MUST be lower case
Expand Down

0 comments on commit 0ebb39a

Please sign in to comment.