Merge branch '2611-Cache_de_vista_de_arbol_y_vista_de_grupos' into 'develop'

2611 cache de vista de arbol y vista de grupos

See merge request artica/pandorafms!1744
This commit is contained in:
vgilc 2018-09-10 15:43:16 +02:00
commit 97dcaab99c
2 changed files with 15 additions and 7 deletions

View File

@ -19,6 +19,7 @@ class Tree {
protected $id = -1; protected $id = -1;
protected $rootID = -1; protected $rootID = -1;
protected $serverID = false; protected $serverID = false;
protected $serverName = '';
protected $tree = array(); protected $tree = array();
protected $filter = array(); protected $filter = array();
protected $childrenMethod = "on_demand"; protected $childrenMethod = "on_demand";
@ -50,6 +51,9 @@ class Tree {
$this->id = $id; $this->id = $id;
$this->rootID = !empty($rootID) ? $rootID : $id; $this->rootID = !empty($rootID) ? $rootID : $id;
$this->serverID = $serverID; $this->serverID = $serverID;
if (is_metaconsole()) {
$this->serverName = metaconsole_get_server_by_id($serverID);
}
$this->childrenMethod = $childrenMethod; $this->childrenMethod = $childrenMethod;
$this->access = $access; $this->access = $access;
@ -481,9 +485,9 @@ class Tree {
$module['status'] = $module['estado']; $module['status'] = $module['estado'];
$module['value'] = $module['datos']; $module['value'] = $module['datos'];
if (is_metaconsole() && !empty($server)) { if (is_metaconsole()) {
$module['serverID'] = $server['id']; $module['serverID'] = $this->serverID;
$module['serverName'] = $server['server_name']; $module['serverName'] = $this->serverName;
} }
else { else {
$module['serverName'] = false; $module['serverName'] = false;
@ -576,7 +580,7 @@ class Tree {
"refresh" => SECONDS_10MINUTES "refresh" => SECONDS_10MINUTES
); );
if (is_metaconsole() && !empty($server)) { if (is_metaconsole()) {
// Set the server id // Set the server id
$graph_params["server"] = $module['serverID']; $graph_params["server"] = $module['serverID'];
} }

View File

@ -110,12 +110,14 @@ function groupview_get_all_counters($tree_group) {
0 AS _id_, 0 AS _id_,
'' AS _icon_ '' AS _icon_
FROM $table ta FROM $table ta
WHERE ta.id_agente WHERE ta.disabled = 0
IN ( AND ta.id_agente IN (
SELECT ta.id_agente FROM $table ta SELECT ta.id_agente FROM $table ta
LEFT JOIN $table_sec tasg LEFT JOIN $table_sec tasg
ON ta.id_agente = tasg.id_agent ON ta.id_agente = tasg.id_agent
WHERE 1=1 $group_acl WHERE ta.disabled = 0
$group_acl
GROUP BY ta.id_agente
) )
"; ";
$data = db_get_row_sql($sql); $data = db_get_row_sql($sql);
@ -138,6 +140,8 @@ function groupview_get_groups_list($id_user = false, $access = 'AR', $is_not_pag
'statusModule' => -1, 'statusModule' => -1,
'groupID' => 0, 'groupID' => 0,
'tagID' => 0, 'tagID' => 0,
'show_not_init_agents' => 1,
'show_not_init_modules' => 1
)); ));
$info = $tree_group->getArray(); $info = $tree_group->getArray();
$info = groupview_plain_groups($info); $info = groupview_plain_groups($info);