Merge branch 'ent-10864-conflicto-mergeo-fichero-ver_agentes-php' into 'develop'

Ent 10864 conflicto mergeo fichero ver agentes php

See merge request artica/pandorafms!5663
This commit is contained in:
Rafael Ameijeiras 2023-04-10 09:36:44 +00:00
commit f68cd81d35
4 changed files with 43 additions and 32 deletions

View File

@ -237,8 +237,9 @@ if (db_get_num_rows($sql) == 0) {
$table->head[5] = __('Actions'); $table->head[5] = __('Actions');
$table->align = []; $table->align = [];
$table->align[5] = 'left'; $table->align[5] = 'left';
$i = 0;
foreach ($result as $row) { foreach ($result as $row) {
$table->cellclass[$i++][5] = 'table_action_buttons';
$data = []; $data = [];
$sql = sprintf('SELECT id_policy FROM tpolicy_modules_inventory WHERE id = %d', $row['id_policy_module_inventory']); $sql = sprintf('SELECT id_policy FROM tpolicy_modules_inventory WHERE id = %d', $row['id_policy_module_inventory']);

View File

@ -756,10 +756,12 @@ function inventory_get_datatable(
foreach ($rows as $row) { foreach ($rows as $row) {
$data_rows = explode(PHP_EOL, $row['data']); $data_rows = explode(PHP_EOL, $row['data']);
foreach ($data_rows as $data_key => $data_value) { foreach ($data_rows as $data_key => $data_value) {
if (empty($data_value) === false) {
$row['data'] = $data_value; $row['data'] = $data_value;
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row; $modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
} }
} }
}
return $modules; return $modules;
} else { } else {

View File

@ -218,7 +218,7 @@ foreach ($rows as $row) {
} }
if ($idModuleInventory != $row['id_module_inventory']) { if ($idModuleInventory != $row['id_module_inventory']) {
if (isset($table) === true && $rowTable >= 1) { if (isset($table) === true && $rowTable > 1) {
html_print_table($table); html_print_table($table);
unset($table); unset($table);
$rowTable = 1; $rowTable = 1;
@ -310,17 +310,16 @@ foreach ($rows as $row) {
$rowTable++; $rowTable++;
} }
if ($iterator1 > 5) {
// PRINT COUNT TOTAL. // PRINT COUNT TOTAL.
$table->colspan[$rowTable][0] = 10;
$table->data[$rowTable][0] = '<b>'.__('Total').': </b>'.$iterator1; $table->data[$rowTable][0] = '<b>'.__('Total').': </b>'.$iterator1;
$rowTable++; $rowTable++;
} }
}
$idModuleInventory = $row['id_module_inventory']; $idModuleInventory = $row['id_module_inventory'];
} }
if (isset($table) === true && $rowTable >= 1) { if (isset($table) === true && $rowTable > 1) {
html_print_table($table); html_print_table($table);
$printedTables++; $printedTables++;
} }

View File

@ -30,7 +30,7 @@ use PandoraFMS\Enterprise\Metaconsole\Node;
global $config; global $config;
require_once 'include/functions_gis.php'; require_once $config['homedir'].'/include/functions_gis.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
@ -1442,21 +1442,23 @@ $alerttab['active'] = ($tab === 'alert');
// Inventory. // Inventory.
$inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']); $inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']);
$inventorytab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/hardware-software-component@svg.svg',
true,
[
'class' => 'main_menu_icon invert_filter',
'title' => __('Inventory'),
]
).'</a>';
if ($tab == 'inventory') { if ($inventoryCount > 0) {
$inventorytab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente='.$id_agente,
'image' => 'images/hardware-software-component@svg.svg',
'title' => __('Inventory'),
],
true
);
if ($tab === 'inventory') {
$inventorytab['active'] = true; $inventorytab['active'] = true;
} else { } else {
$inventorytab['active'] = false; $inventorytab['active'] = false;
} }
}
// Collection. // Collection.
if ((int) $config['license_nms'] !== 1) { if ((int) $config['license_nms'] !== 1) {
@ -1477,14 +1479,15 @@ if ($policyTab === ENTERPRISE_NOT_HOOK) {
// Omnishell. // Omnishell.
if (function_exists('count_tasks_agent')) {
$tasks = count_tasks_agent($id_agente); $tasks = count_tasks_agent($id_agente);
if ($tasks === true) { if ($tasks === true) {
$omnishellTab = enterprise_hook('omnishell_tab'); $omnishellTab = enterprise_hook('omnishell_tab');
if ($omnishellTab == -1) { if ($omnishellTab == -1) {
$omnishellTab = ''; $omnishellTab = '';
} }
} }
}
// WUX Console. // WUX Console.
$modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]);
@ -1587,7 +1590,7 @@ if (enterprise_installed() === true && (bool) $config['log_collector'] === true)
$log_viewer_tab['text'] = html_print_menu_button( $log_viewer_tab['text'] = html_print_menu_button(
[ [
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente='.$id_agente, 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente='.$id_agente,
'image' => 'images/gm_log.png', 'image' => 'images/gm_log@svg.svg',
'title' => __('Log Viewer'), 'title' => __('Log Viewer'),
], ],
true true
@ -1917,7 +1920,7 @@ switch ($tab) {
if ((bool) $config['pure'] === false) { if ((bool) $config['pure'] === false) {
ui_print_standard_header( ui_print_standard_header(
__('Agent main view'), __('Agent main view').' ( '.strtolower(agents_get_alias($id_agente)).' )',
$icon, $icon,
false, false,
($help_header ?? ''), ($help_header ?? ''),
@ -1936,6 +1939,12 @@ if ((bool) $config['pure'] === false) {
'link' => '', 'link' => '',
'label' => $tab_name, 'label' => $tab_name,
], ],
],
[
'id_element' => $id_agente,
'url' => 'operation/agentes/ver_agente&id_agente='.$id_agente,
'label' => agents_get_alias($id_agente),
'section' => 'Agents',
] ]
); );
} }