Merge branch 'ent-11256-metaconsola-widget-icon-and-module-value-muestra-icono-critico-en-modulo-normal' into 'develop'

Ent 11256 metaconsola widget icon and module value muestra icono critico en modulo normal

See merge request artica/pandorafms!6019
This commit is contained in:
Rafael Ameijeiras 2023-07-17 07:52:05 +00:00
commit 58a1f8ecff
2 changed files with 32 additions and 35 deletions

View File

@ -132,12 +132,11 @@ if (empty($apiPassword) === true
// Bypass credentials if server-auth and api-pass are correct. // Bypass credentials if server-auth and api-pass are correct.
} else if (($config['server_unique_identifier'] === get_parameter('server_auth')) } else if (($config['server_unique_identifier'] === get_parameter('server_auth'))
&& ($api_password === $apiPassword) && ($api_password === $apiPassword)
&& ((bool) isInACL($ipOrigin) === true)) { && ((bool) isInACL($ipOrigin) === true)
) {
$config['id_usuario'] = 'admin'; $config['id_usuario'] = 'admin';
$config['id_user'] = 'admin'; $config['id_user'] = 'admin';
$correctLogin = true; $correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) { } else if ((bool) isInACL($ipOrigin) === true) {
// External access. // External access.
// Token is valid. Bypass the credentials. // Token is valid. Bypass the credentials.

View File

@ -540,12 +540,6 @@ class ModuleIconWidget extends Widget
$output = ''; $output = '';
$id_group = \agents_get_agent_group($this->values['agentId']);
$modulesAgent = \modules_get_agentmodule_agent(
$this->values['moduleId']
);
$data_module = \modules_get_last_value( $data_module = \modules_get_last_value(
$this->values['moduleId'] $this->values['moduleId']
); );
@ -574,33 +568,37 @@ class ModuleIconWidget extends Widget
// General div. // General div.
$output .= '<div class="'.$orientation.'" id="general-'.$uuid.'">'; $output .= '<div class="'.$orientation.'" id="general-'.$uuid.'">';
$sql = 'SELECT min_warning, $status = \modules_get_agentmodule_status($this->values['moduleId']);
max_warning,
min_critical,
max_critical,
str_warning,
str_critical
FROM tagente_modulo
WHERE id_agente_modulo = '.(int) $this->values['moduleId'];
$sql_data = db_get_row_sql($sql);
$last = modules_get_last_value($this->values['moduleId']); switch ($status) {
case 1:
case 4:
// Critical or critical alert (BAD).
$color_icon .= '_bad.png';
break;
$color_icon = '_ok'; case 0:
if (($last >= $sql_data['min_warning']) && ($last < $sql_data['max_warning'])) { // Normal (OK).
$color_icon = '_warning'; $color_icon .= '_ok.png';
break;
case 2:
case 10:
// Warning or warning alert.
$color_icon .= '_warning.png';
break;
case 3:
// Unknown.
default:
$color_icon .= '.png';
// Default is Grey (Other).
break;
} }
if ($last >= $sql_data['max_warning']) { $output .= '<div class="pdd_l_15px pdd_r_15px mrgn_btn_25px" style="flex: 0 1 '.$sizeIcon.'px; height: '.$sizeIcon.'px;">';
$color_icon = '_bad';
}
// Div image.
$style_icon = 'flex: 0 1 '.$sizeIcon.'px;';
$output .= '<div class="pdd_l_15px pdd_r_15px '.$margin_bottom.'" style="flex: 0 1 '.$sizeIcon.'px; height: '.$sizeIcon.'px;">';
$output .= html_print_image( $output .= html_print_image(
'images/console/icons/'.$icon.$color_icon.'.png', 'images/console/icons/'.$icon.$color_icon,
true, true,
['width' => $sizeIcon] ['width' => $sizeIcon]
); );