mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
The filter group is added in the Service View Widget settings.
This commit is contained in:
parent
a46a43fd89
commit
35b5de57f1
@ -187,7 +187,8 @@ if (is_ajax() === true) {
|
|||||||
$serverID,
|
$serverID,
|
||||||
$childrenMethod,
|
$childrenMethod,
|
||||||
$access,
|
$access,
|
||||||
$metaID
|
$metaID,
|
||||||
|
$filter['groupID']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ class Tree
|
|||||||
|
|
||||||
protected $rootType = null;
|
protected $rootType = null;
|
||||||
|
|
||||||
|
protected $idGroup = null;
|
||||||
|
|
||||||
protected $id = -1;
|
protected $id = -1;
|
||||||
|
|
||||||
protected $rootID = -1;
|
protected $rootID = -1;
|
||||||
@ -87,13 +89,15 @@ class Tree
|
|||||||
$serverID=false,
|
$serverID=false,
|
||||||
$childrenMethod='on_demand',
|
$childrenMethod='on_demand',
|
||||||
$access='AR',
|
$access='AR',
|
||||||
$id_meta_server=0
|
$id_meta_server=0,
|
||||||
|
$id_group=0
|
||||||
) {
|
) {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->rootType = !empty($rootType) ? $rootType : $type;
|
$this->rootType = !empty($rootType) ? $rootType : $type;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->rootID = !empty($rootID) ? $rootID : $id;
|
$this->rootID = !empty($rootID) ? $rootID : $id;
|
||||||
$this->serverID = $serverID;
|
$this->serverID = $serverID;
|
||||||
|
$this->idGroup = $id_group;
|
||||||
if (is_metaconsole() && $id_meta_server == 0) {
|
if (is_metaconsole() && $id_meta_server == 0) {
|
||||||
$this->serverName = metaconsole_get_server_by_id($serverID);
|
$this->serverName = metaconsole_get_server_by_id($serverID);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,8 @@ class TreeService extends Tree
|
|||||||
$serverID=false,
|
$serverID=false,
|
||||||
$childrenMethod='on_demand',
|
$childrenMethod='on_demand',
|
||||||
$access='AR',
|
$access='AR',
|
||||||
$id_server_meta=0
|
$id_server_meta=0,
|
||||||
|
$id_group=0
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -105,7 +106,8 @@ class TreeService extends Tree
|
|||||||
$serverID,
|
$serverID,
|
||||||
$childrenMethod,
|
$childrenMethod,
|
||||||
$access,
|
$access,
|
||||||
$id_server_meta
|
$id_server_meta,
|
||||||
|
$id_group
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->L1fieldName = 'id_group';
|
$this->L1fieldName = 'id_group';
|
||||||
@ -268,6 +270,13 @@ class TreeService extends Tree
|
|||||||
$groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')';
|
$groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter group.
|
||||||
|
if ((int) $this->idGroup !== 0) {
|
||||||
|
$filter_group = 'AND ts.id_group = '.$this->idGroup;
|
||||||
|
} else {
|
||||||
|
$filter_group = '';
|
||||||
|
}
|
||||||
|
|
||||||
$exclude_children = 'ts.id NOT IN (
|
$exclude_children = 'ts.id NOT IN (
|
||||||
SELECT DISTINCT id_service_child
|
SELECT DISTINCT id_service_child
|
||||||
FROM tservice_element
|
FROM tservice_element
|
||||||
@ -300,11 +309,13 @@ class TreeService extends Tree
|
|||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
|
%s
|
||||||
GROUP BY ts.id',
|
GROUP BY ts.id',
|
||||||
$exclude_children,
|
$exclude_children,
|
||||||
$is_favourite,
|
$is_favourite,
|
||||||
$service_search,
|
$service_search,
|
||||||
$groups_acl
|
$groups_acl,
|
||||||
|
$filter_group
|
||||||
);
|
);
|
||||||
|
|
||||||
$stats = db_get_all_rows_sql($sql);
|
$stats = db_get_all_rows_sql($sql);
|
||||||
|
@ -1058,7 +1058,7 @@ function processServiceTree(settings) {
|
|||||||
parameters["filter"]["statusAgent"] = "";
|
parameters["filter"]["statusAgent"] = "";
|
||||||
parameters["filter"]["searchModule"] = "";
|
parameters["filter"]["searchModule"] = "";
|
||||||
parameters["filter"]["statusModule"] = "";
|
parameters["filter"]["statusModule"] = "";
|
||||||
parameters["filter"]["groupID"] = "";
|
parameters["filter"]["groupID"] = settings.id_group;
|
||||||
parameters["filter"]["tagID"] = "";
|
parameters["filter"]["tagID"] = "";
|
||||||
parameters["filter"]["searchHirearchy"] = 1;
|
parameters["filter"]["searchHirearchy"] = 1;
|
||||||
parameters["filter"]["show_not_init_agents"] = 1;
|
parameters["filter"]["show_not_init_agents"] = 1;
|
||||||
|
@ -642,6 +642,7 @@ class Widget
|
|||||||
$values = [];
|
$values = [];
|
||||||
$values['title'] = \get_parameter('title', '');
|
$values['title'] = \get_parameter('title', '');
|
||||||
$values['background'] = \get_parameter('background', '#ffffff');
|
$values['background'] = \get_parameter('background', '#ffffff');
|
||||||
|
$values['id_group'] = \get_parameter('id_group', '');
|
||||||
if ((bool) \is_metaconsole() === true) {
|
if ((bool) \is_metaconsole() === true) {
|
||||||
if ($this->shouldSelectNode() === true) {
|
if ($this->shouldSelectNode() === true) {
|
||||||
$values['node'] = \get_parameter('node', null);
|
$values['node'] = \get_parameter('node', null);
|
||||||
|
@ -218,6 +218,10 @@ class ServiceViewWidget extends Widget
|
|||||||
$values['type'] = $decoder['type'];
|
$values['type'] = $decoder['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['id_group']) === true) {
|
||||||
|
$values['id_group'] = $decoder['id_group'];
|
||||||
|
}
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,6 +243,13 @@ class ServiceViewWidget extends Widget
|
|||||||
$values['type'] = 'tree';
|
$values['type'] = 'tree';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Groups.
|
||||||
|
$return_all_group = false;
|
||||||
|
|
||||||
|
if (users_can_manage_group_all('AR') === true) {
|
||||||
|
$return_all_group = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Type services view.
|
// Type services view.
|
||||||
$fields = [
|
$fields = [
|
||||||
'tree' => __('Tree'),
|
'tree' => __('Tree'),
|
||||||
@ -256,6 +267,20 @@ class ServiceViewWidget extends Widget
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Group'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'id_group',
|
||||||
|
'id' => 'id_group',
|
||||||
|
'input_class' => 'flex-row',
|
||||||
|
'type' => 'select_groups',
|
||||||
|
'returnAllGroup' => $return_all_group,
|
||||||
|
'selected' => $values['id_group'],
|
||||||
|
'return' => true,
|
||||||
|
'class' => 'w50p',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
return $inputs;
|
return $inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,6 +360,7 @@ class ServiceViewWidget extends Widget
|
|||||||
$settings['cellId'] = $this->cellId;
|
$settings['cellId'] = $this->cellId;
|
||||||
$settings['baseURL'] = \ui_get_full_url('/', false, false, false);
|
$settings['baseURL'] = \ui_get_full_url('/', false, false, false);
|
||||||
$settings['ajaxURL'] = \ui_get_full_url('ajax.php', false, false, false);
|
$settings['ajaxURL'] = \ui_get_full_url('ajax.php', false, false, false);
|
||||||
|
$settings['id_group'] = (empty($values['type']) === false) ? $values['id_group'] : 0;
|
||||||
|
|
||||||
// Show the modal window of an module.
|
// Show the modal window of an module.
|
||||||
$output .= '<div id="module_details_window" class="">';
|
$output .= '<div id="module_details_window" class="">';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user