Merge branch 'ent-12509-cuadro-grupos-vista-tactica-y-vista-tactica-de-grupos-muestra-deshabilitados' into 'develop'

Ent 12509 Cuadro grupos vista táctica y vista táctica de grupos muestra deshabilitados

See merge request artica/pandorafms!6764
This commit is contained in:
Matias Didier 2024-01-22 11:04:20 +00:00
commit 1276b1a972
4 changed files with 115 additions and 107 deletions

View File

@ -5261,7 +5261,8 @@ function graph_so_by_group($id_group, $width=300, $height=200, $recursive=true,
FROM tagente a FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
LEFT JOIN tconfig_os os ON a.id_os = os.id_os LEFT JOIN tconfig_os os ON a.id_os = os.id_os
WHERE a.id_grupo IN (%s) OR g.id_group IN (%s) WHERE (a.id_grupo IN (%s) OR g.id_group IN (%s))
AND a.disabled = 0
GROUP BY os.id_os', GROUP BY os.id_os',
implode(',', $id_groups), implode(',', $id_groups),
implode(',', $id_groups) implode(',', $id_groups)
@ -5351,13 +5352,14 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
// with it and then the number of times it occured. GROUP BY statement // with it and then the number of times it occured. GROUP BY statement
// is required if both DISTINCT() and COUNT() are in the statement. // is required if both DISTINCT() and COUNT() are in the statement.
$sql = sprintf( $sql = sprintf(
'SELECT DISTINCT(id_agente) AS id_agente, 'SELECT DISTINCT(te.id_agente) AS id_agente,
COUNT(id_agente) AS count COUNT(te.id_agente) AS count
FROM tevento te FROM tevento te
LEFT JOIN tagente a ON a.id_agente = te.id_agente
LEFT JOIN tagent_secondary_group g ON g.id_agent = te.id_agente LEFT JOIN tagent_secondary_group g ON g.id_agent = te.id_agente
WHERE 1=1 AND estado = 0 WHERE 1=1 AND estado = 0
%s %s %s %s AND a.disabled = 0
GROUP BY id_agente GROUP BY te.id_agente
ORDER BY count DESC LIMIT 8', ORDER BY count DESC LIMIT 8',
$tags_condition, $tags_condition,
$filter_groups $filter_groups

View File

@ -2503,7 +2503,8 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
$sql = 'SELECT * FROM tagente a $sql = 'SELECT * FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
WHERE a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).')'; WHERE (a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).'))
AND a.disabled = 0';
$all_agents = db_get_all_rows_sql($sql); $all_agents = db_get_all_rows_sql($sql);
if (empty($all_agents)) { if (empty($all_agents)) {

View File

@ -352,6 +352,7 @@ class Agents extends Element
*/ */
public function getStatusGraph():string public function getStatusGraph():string
{ {
$data = [];
$agents = agents_get_agents( $agents = agents_get_agents(
false, false,
[ [

View File

@ -45,6 +45,7 @@ class Groups extends Element
parent::__construct(); parent::__construct();
include_once $config['homedir'].'/include/functions_users.php'; include_once $config['homedir'].'/include/functions_users.php';
include_once $config['homedir'].'/include/functions_groupview.php'; include_once $config['homedir'].'/include/functions_groupview.php';
include_once $config['homedir'].'/include/functions_graph.php';
$this->ajaxMethods = ['getStatusHeatMap']; $this->ajaxMethods = ['getStatusHeatMap'];
ui_require_css_file('heatmap'); ui_require_css_file('heatmap');
$this->title = __('Groups'); $this->title = __('Groups');
@ -113,9 +114,10 @@ class Groups extends Element
$id_groups = implode(',', $id_groups); $id_groups = implode(',', $id_groups);
$modules = modules_get_modules_in_group($id_groups); $modules = modules_get_modules_in_group($id_groups);
$total_groups = ($modules !== false) ? count($modules) : 0; $heatmap = '';
if (is_array($modules) === true) {
$total_groups = count($modules);
if ($total_groups === 0) { if ($total_groups === 0) {
include_once $config['homedir'].'/include/functions_graph.php';
return graph_nodata_image(['width' => '400']); return graph_nodata_image(['width' => '400']);
} }
@ -135,7 +137,7 @@ class Groups extends Element
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low))); $square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
// Print starmap. // Print starmap.
$heatmap = sprintf( $heatmap .= sprintf(
'<svg id="svg" style="width: %spx; height: %spx;">', '<svg id="svg" style="width: %spx; height: %spx;">',
$width, $width,
$height $height
@ -225,6 +227,7 @@ class Groups extends Element
$cont++; $cont++;
} }
}
$heatmap .= '<script type="text/javascript"> $heatmap .= '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
@ -290,7 +293,8 @@ class Groups extends Element
$sql = 'SELECT * FROM tagente a $sql = 'SELECT * FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
WHERE g.id_group IN ('.$id_groups.') OR a.id_grupo IN ('.$id_groups.')'; WHERE (g.id_group IN ('.$id_groups.') OR a.id_grupo IN ('.$id_groups.'))
AND a.disabled = 0';
$all_agents = db_get_all_rows_sql($sql); $all_agents = db_get_all_rows_sql($sql);
if (empty($all_agents)) { if (empty($all_agents)) {
return null; return null;