9962-Omnishell in agent view

This commit is contained in:
Pablo Aragon 2023-02-06 16:34:40 +01:00
parent 35aa64b281
commit 6d85b912e2
4 changed files with 60 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

View File

@ -84,6 +84,27 @@ function html_debug_print($var, $file='', $oneline=false)
} }
/**
* Console log.
*/
function jslog($var)
{
$more_info = '';
if (is_string($var)) {
$more_info = 'size: '.strlen($var);
} else if (is_bool($var)) {
$more_info = 'val: '.($var ? 'true' : 'false');
} else if (is_null($var)) {
$more_info = 'is null';
} else if (is_array($var)) {
$more_info = count($var);
}
echo '<script>console.log("'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info.'");</script>'."\n";
echo '<script>console.log('.json_encode($var).');</script>';
}
// Alias for "html_debug_print" // Alias for "html_debug_print"
function html_debug($var, $file='', $oneline=false) function html_debug($var, $file='', $oneline=false)
{ {

View File

@ -7084,3 +7084,21 @@ function ui_get_inventory_module_add_form(
} }
function ui_print_status_div($status)
{
switch ((int) $status) {
case 0:
$return = '<div class="status_rounded_rectangles forced_title" style="display: inline-block; background: #82b92e;" title="OK" data-title="OK" data-use_title_for_force_title="1">&nbsp;</div>';
break;
case 1:
$return = '<div class="status_rounded_rectangles forced_title" style="display: inline-block; background: #e63c52;" title="FAILED" data-title="FAILED" data-use_title_for_force_title="1">&nbsp;</div>';
break;
default:
$return = '<div class="status_rounded_rectangles forced_title" style="display: inline-block; background: #fff;" title="UNDEFINED" data-title="UNDEFINED" data-use_title_for_force_title="1">&nbsp;</div>';
break;
}
return $return;
}

View File

@ -37,6 +37,7 @@ require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_omnishell.php');
ui_require_javascript_file('openlayers.pandora'); ui_require_javascript_file('openlayers.pandora');
ui_require_css_file('agent_view'); ui_require_css_file('agent_view');
@ -1485,6 +1486,17 @@ if ($policyTab == -1) {
$policyTab = ''; $policyTab = '';
} }
// Omnishell.
$tasks = count_tasks_agent($id_agente);
if ($tasks === true) {
$omnishellTab = enterprise_hook('omnishell_tab');
if ($omnishellTab == -1) {
$omnishellTab = '';
}
}
// WUX Console. // WUX Console.
$modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]);
if ($modules_wux) { if ($modules_wux) {
@ -1747,6 +1759,7 @@ $onheader = [
'ncm_view' => ($ncm_tab ?? null), 'ncm_view' => ($ncm_tab ?? null),
'external_tools' => ($external_tools ?? null), 'external_tools' => ($external_tools ?? null),
'incident' => ($incidenttab ?? null), 'incident' => ($incidenttab ?? null),
'omnishell' => ($omnishellTab ?? null),
]; ];
@ -1871,6 +1884,10 @@ switch ($tab) {
$tab_name = 'Policies'; $tab_name = 'Policies';
break; break;
case 'omnishell':
$tab_name = 'Omnishell';
break;
case 'ux_console_tab': case 'ux_console_tab':
$tab_name = 'UX Console'; $tab_name = 'UX Console';
break; break;
@ -2009,6 +2026,10 @@ switch ($tab) {
enterprise_include('operation/agentes/policy_view.php'); enterprise_include('operation/agentes/policy_view.php');
break; break;
case 'omnishell':
enterprise_include('operation/agentes/omnishell_view.php');
break;
case 'ux_console_tab': case 'ux_console_tab':
enterprise_include('operation/agentes/ux_console_view.php'); enterprise_include('operation/agentes/ux_console_view.php');
break; break;