mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Added modules in the treeview
This commit is contained in:
parent
42e56f51e4
commit
45a4880ec6
@ -53,8 +53,8 @@ class Tree {
|
|||||||
case 'module_group':
|
case 'module_group':
|
||||||
$this->getDataModuleGroup();
|
$this->getDataModuleGroup();
|
||||||
break;
|
break;
|
||||||
case 'module':
|
case 'agent':
|
||||||
$this->getDataModule();
|
$this->getDataModules();
|
||||||
break;
|
break;
|
||||||
case 'tag':
|
case 'tag':
|
||||||
$this->getDataTag();
|
$this->getDataTag();
|
||||||
@ -220,6 +220,51 @@ class Tree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDataModules() {
|
||||||
|
$modules =
|
||||||
|
agents_get_modules($this->root, array('nombre', 'id_tipo_modulo'));
|
||||||
|
|
||||||
|
if (empty($modules))
|
||||||
|
$modules = array();
|
||||||
|
|
||||||
|
$this->tree = array();
|
||||||
|
foreach ($modules as $id => $module) {
|
||||||
|
$temp = array();
|
||||||
|
|
||||||
|
$temp['type'] = 'module';
|
||||||
|
$temp['id'] = $id;
|
||||||
|
$temp['name'] = $module['nombre'];
|
||||||
|
$temp['icon'] = modules_get_type_icon(
|
||||||
|
$module['id_tipo_modulo']);
|
||||||
|
$temp['value'] = modules_get_last_value($id);
|
||||||
|
switch (modules_get_status($id)) {
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||||
|
$temp['status'] = "critical";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case AGENT_MODULE_STATUS_NORMAL:
|
||||||
|
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||||
|
$temp['status'] = "ok";
|
||||||
|
break;
|
||||||
|
case AGENT_MODULE_STATUS_WARNING:
|
||||||
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||||
|
$temp['status'] = "warning";
|
||||||
|
break;
|
||||||
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||||
|
$temp['status'] = "unknown";
|
||||||
|
break;
|
||||||
|
case AGENT_MODULE_STATUS_NO_DATA:
|
||||||
|
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||||
|
$temp['status'] = "not_init";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$temp['children'] = array();
|
||||||
|
|
||||||
|
$this->tree[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getDataAgents($type, $id) {
|
public function getDataAgents($type, $id) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'group':
|
case 'group':
|
||||||
@ -279,6 +324,22 @@ class Tree {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$agents[$iterator]['children'] = array();
|
||||||
|
if ($agents[$iterator]['counters']['total'] > 0) {
|
||||||
|
|
||||||
|
|
||||||
|
switch ($this->childrenMethod) {
|
||||||
|
case 'on_demand':
|
||||||
|
$agents[$iterator]['children'] = 1;
|
||||||
|
break;
|
||||||
|
case 'live':
|
||||||
|
$modules =
|
||||||
|
agents_get_modules($agents[$iterator]['id_agente']);
|
||||||
|
// TO DO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $agents;
|
return $agents;
|
||||||
@ -287,9 +348,6 @@ class Tree {
|
|||||||
public function getDataModuleGroup() {
|
public function getDataModuleGroup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDataModule() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDataTag() {
|
public function getDataTag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
pandora_console/include/functions_modules.php
Normal file → Executable file
3
pandora_console/include/functions_modules.php
Normal file → Executable file
@ -875,7 +875,8 @@ function modules_is_string_type ($id_type) {
|
|||||||
* @return string The name of the icon.
|
* @return string The name of the icon.
|
||||||
*/
|
*/
|
||||||
function modules_get_type_icon ($id_type) {
|
function modules_get_type_icon ($id_type) {
|
||||||
return (string) db_get_value ('icon', 'ttipo_modulo', 'id_tipo', (int) $id_type);
|
return (string) db_get_value ('icon', 'ttipo_modulo', 'id_tipo',
|
||||||
|
(int) $id_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user