changes to show last status change of modules

This commit is contained in:
alejandro-campos 2020-03-19 15:18:20 +01:00
parent 6cea6f62c2
commit 014688468c
4 changed files with 16 additions and 6 deletions

View File

@ -1284,6 +1284,7 @@ ALTER TABLE `tagente_estado` MODIFY COLUMN `datos` mediumtext NOT NULL,
MODIFY COLUMN `last_known_status` tinyint(4) NULL DEFAULT '0',
MODIFY COLUMN `last_dynamic_update` bigint(20) NOT NULL DEFAULT '0',
MODIFY COLUMN `last_unknown_update` bigint(20) NOT NULL DEFAULT '0';
ALTER TABLE `tagente_estado` ADD COLUMN `last_status_change` bigint(20) NOT NULL DEFAULT '0';
-- ---------------------------------------------------------------------
-- Table `talert_actions`

View File

@ -1028,7 +1028,7 @@ if (check_login()) {
$title
);
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true);
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true, false, false, false, $module['last_status_change']);
if (!$show_context_help_first_time) {
$show_context_help_first_time = true;

View File

@ -2663,7 +2663,8 @@ function ui_print_status_image(
$return=false,
$options=false,
$path=false,
$image_with_css=false
$image_with_css=false,
$module_last_status_change=''
) {
if ($path === false) {
$imagepath_array = ui_get_status_images_path();
@ -2678,9 +2679,15 @@ function ui_print_status_image(
$imagepath .= '/'.$type;
$title_extra_line = '';
if (!empty($module_last_status_change)) {
$title_extra_line = 'Time elapsed since last status change: '.date('h', $module_last_status_change).' '.__('hour').' '.date('i', $module_last_status_change).' '.__('min').' '.date('s', $module_last_status_change).' '.__('sec');
}
if ($image_with_css === true) {
$shape_status = get_shape_status_set($type);
return ui_print_status_sets($type, $title, $return, $shape_status);
return ui_print_status_sets($type, $title, $return, $shape_status, $title_extra_line);
} else {
if ($options === false) {
$options = [];
@ -2779,7 +2786,8 @@ function ui_print_status_sets(
$status,
$title='',
$return=false,
$options=false
$options=false,
$extra_line_title=''
) {
global $config;
@ -2798,8 +2806,8 @@ function ui_print_status_sets(
}
if ($title != '') {
$options['title'] = $title;
$options['data-title'] = $title;
$options['title'] = empty($extra_line_title) ? $title : $title.'&#10'.$extra_line_title;
$options['data-title'] = empty($extra_line_title) ? $title : $title.'<br>'.$extra_line_title;
$options['data-use_title_for_force_title'] = 1;
if (isset($options['class'])) {
$options['class'] .= ' forced_title';

View File

@ -169,6 +169,7 @@ CREATE TABLE IF NOT EXISTS `tagente_estado` (
`ff_critical` int(4) unsigned default '0',
`last_dynamic_update` bigint(20) NOT NULL default '0',
`last_unknown_update` bigint(20) NOT NULL default '0',
`last_status_change` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_agente_estado`),
KEY `status_index_1` (`id_agente_modulo`),
KEY `idx_agente` (`id_agente`),