mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Changed default images status set for css - #4195
This commit is contained in:
parent
ce1231eae6
commit
43b83af2c6
Binary file not shown.
Before Width: | Height: | Size: 251 B |
Binary file not shown.
Before Width: | Height: | Size: 250 B |
Binary file not shown.
Before Width: | Height: | Size: 251 B |
Binary file not shown.
Before Width: | Height: | Size: 251 B |
Binary file not shown.
Before Width: | Height: | Size: 246 B |
Binary file not shown.
Before Width: | Height: | Size: 249 B |
@ -1011,7 +1011,7 @@ if (check_login()) {
|
|||||||
$title
|
$title
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[5] = ui_print_module_status($module['estado'], $title, true, false, true);
|
$data[5] = ui_print_status_image($status, $title, true);
|
||||||
if (!$show_context_help_first_time) {
|
if (!$show_context_help_first_time) {
|
||||||
$show_context_help_first_time = true;
|
$show_context_help_first_time = true;
|
||||||
|
|
||||||
|
@ -2308,32 +2308,67 @@ function modules_get_color_status($status)
|
|||||||
return COL_UNKNOWN;
|
return COL_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($status) {
|
switch ((string) $status) {
|
||||||
case AGENT_MODULE_STATUS_NORMAL:
|
case (string) AGENT_MODULE_STATUS_NORMAL:
|
||||||
case AGENT_STATUS_NORMAL:
|
case (string) AGENT_STATUS_NORMAL:
|
||||||
|
case STATUS_MODULE_OK:
|
||||||
|
case STATUS_AGENT_OK:
|
||||||
|
case STATUS_ALERT_NOT_FIRED:
|
||||||
|
case STATUS_SERVER_OK:
|
||||||
|
case STATUS_MODULE_OK_BALL:
|
||||||
|
case STATUS_AGENT_OK_BALL:
|
||||||
|
case STATUS_ALERT_NOT_FIRED_BALL:
|
||||||
return COL_NORMAL;
|
return COL_NORMAL;
|
||||||
|
|
||||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||||
case AGENT_STATUS_NOT_INIT:
|
case AGENT_STATUS_NOT_INIT:
|
||||||
|
case STATUS_MODULE_NO_DATA:
|
||||||
|
case STATUS_AGENT_NOT_INIT:
|
||||||
|
case STATUS_AGENT_NO_DATA:
|
||||||
|
case STATUS_MODULE_NO_DATA_BALL:
|
||||||
|
case STATUS_AGENT_NO_DATA_BALL:
|
||||||
|
case STATUS_AGENT_NO_MONITORS_BALL:
|
||||||
return COL_NOTINIT;
|
return COL_NOTINIT;
|
||||||
|
|
||||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||||
case AGENT_STATUS_CRITICAL:
|
case AGENT_STATUS_CRITICAL:
|
||||||
|
case STATUS_MODULE_CRITICAL:
|
||||||
|
case STATUS_AGENT_CRITICAL:
|
||||||
|
case STATUS_MODULE_CRITICAL_BALL:
|
||||||
|
case STATUS_AGENT_CRITICAL_BALL:
|
||||||
return COL_CRITICAL;
|
return COL_CRITICAL;
|
||||||
|
|
||||||
case AGENT_MODULE_STATUS_WARNING:
|
case AGENT_MODULE_STATUS_WARNING:
|
||||||
case AGENT_STATUS_WARNING:
|
case AGENT_STATUS_WARNING:
|
||||||
|
case STATUS_MODULE_WARNING:
|
||||||
|
case STATUS_AGENT_WARNING:
|
||||||
|
case STATUS_MODULE_WARNING_BALL:
|
||||||
|
case STATUS_AGENT_WARNING_BALL:
|
||||||
return COL_WARNING;
|
return COL_WARNING;
|
||||||
|
|
||||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||||
case AGENT_STATUS_ALERT_FIRED:
|
case AGENT_STATUS_ALERT_FIRED:
|
||||||
|
case STATUS_ALERT_FIRED:
|
||||||
|
case STATUS_ALERT_FIRED_BALL:
|
||||||
return COL_ALERTFIRED;
|
return COL_ALERTFIRED;
|
||||||
|
|
||||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||||
case AGENT_STATUS_UNKNOWN:
|
case AGENT_STATUS_UNKNOWN:
|
||||||
|
case STATUS_MODULE_UNKNOWN:
|
||||||
|
case STATUS_AGENT_UNKNOWN:
|
||||||
|
case STATUS_AGENT_DOWN:
|
||||||
|
case STATUS_ALERT_DISABLED:
|
||||||
|
case STATUS_MODULE_UNKNOWN_BALL:
|
||||||
|
case STATUS_AGENT_UNKNOWN_BALL:
|
||||||
|
case STATUS_AGENT_DOWN_BALL:
|
||||||
|
case STATUS_ALERT_DISABLED_BALL:
|
||||||
return COL_UNKNOWN;
|
return COL_UNKNOWN;
|
||||||
|
|
||||||
|
case STATUS_SERVER_DOWN:
|
||||||
|
case STATUS_SERVER_DOWN_BALL:
|
||||||
|
return '#444';
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Ignored.
|
// Ignored.
|
||||||
break;
|
break;
|
||||||
|
@ -2592,12 +2592,12 @@ function ui_get_status_images_path()
|
|||||||
/**
|
/**
|
||||||
* Prints an image representing a status.
|
* Prints an image representing a status.
|
||||||
*
|
*
|
||||||
* @param string $type Type.
|
* @param string $type Type.
|
||||||
* @param string $title Title.
|
* @param string $title Title.
|
||||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||||
* @param array $options Options to set image attributes: I.E.: style.
|
* @param array $options Options to set image attributes: I.E.: style.
|
||||||
* @param string $path Path of the image, if not provided use the status path.
|
* @param string $path Path of the image, if not provided use the status path.
|
||||||
* @param boolean $rounded_image Round.
|
* @param boolean $image_with_css Don't use an image. Draw an image with css styles.
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
@ -2607,37 +2607,8 @@ function ui_print_status_image(
|
|||||||
$return=false,
|
$return=false,
|
||||||
$options=false,
|
$options=false,
|
||||||
$path=false,
|
$path=false,
|
||||||
$rounded_image=false
|
$image_with_css=false
|
||||||
) {
|
) {
|
||||||
// This is for the List of Modules in Agent View.
|
|
||||||
if ($rounded_image === true) {
|
|
||||||
switch ($type) {
|
|
||||||
case 'module_ok.png':
|
|
||||||
$type = 'module_ok_rounded.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'module_critical.png':
|
|
||||||
$type = 'module_critical_rounded.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'module_warning.png':
|
|
||||||
$type = 'module_warning_rounded.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'module_no_data.png':
|
|
||||||
$type = 'module_no_data_rounded.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'module_unknown.png':
|
|
||||||
$type = 'module_unknown_rounded.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$type = $type;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($path === false) {
|
if ($path === false) {
|
||||||
$imagepath_array = ui_get_status_images_path();
|
$imagepath_array = ui_get_status_images_path();
|
||||||
$imagepath = $imagepath_array[0];
|
$imagepath = $imagepath_array[0];
|
||||||
@ -2645,35 +2616,112 @@ function ui_print_status_image(
|
|||||||
$imagepath = $path;
|
$imagepath = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$imagepath .= '/'.$type;
|
if ($imagepath == 'images/status_sets/default') {
|
||||||
|
$image_with_css = true;
|
||||||
if ($options === false) {
|
|
||||||
$options = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['title'] = $title;
|
$imagepath .= '/'.$type;
|
||||||
|
|
||||||
return html_print_image($imagepath, $return, $options, false, false, false, true);
|
if ($image_with_css === true) {
|
||||||
|
$shape_status = get_shape_status_set($type);
|
||||||
|
return ui_print_status_sets($type, $title, $return, $shape_status);
|
||||||
|
} else {
|
||||||
|
if ($options === false) {
|
||||||
|
$options = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$options['title'] = $title;
|
||||||
|
|
||||||
|
return html_print_image($imagepath, $return, $options, false, false, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
|
||||||
|
*
|
||||||
|
* @param string $type Module/Agent/Alert status.
|
||||||
|
*
|
||||||
|
* @return array With CSS class.
|
||||||
|
*/
|
||||||
|
function get_shape_status_set($type)
|
||||||
|
{
|
||||||
|
switch ($type) {
|
||||||
|
// Small rectangles.
|
||||||
|
case STATUS_ALERT_NOT_FIRED:
|
||||||
|
case STATUS_ALERT_FIRED:
|
||||||
|
case STATUS_ALERT_DISABLED:
|
||||||
|
$return = ['class' => 'status_small_rectangles'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Rounded rectangles.
|
||||||
|
case STATUS_MODULE_OK:
|
||||||
|
case STATUS_AGENT_OK:
|
||||||
|
case STATUS_MODULE_NO_DATA:
|
||||||
|
case STATUS_AGENT_NO_DATA:
|
||||||
|
case STATUS_MODULE_CRITICAL:
|
||||||
|
case STATUS_AGENT_CRITICAL:
|
||||||
|
case STATUS_MODULE_WARNING:
|
||||||
|
case STATUS_AGENT_WARNING:
|
||||||
|
case STATUS_MODULE_UNKNOWN:
|
||||||
|
case STATUS_AGENT_UNKNOWN:
|
||||||
|
case STATUS_AGENT_DOWN:
|
||||||
|
$return = ['class' => 'status_rounded_rectangles'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Small squares.
|
||||||
|
case STATUS_SERVER_OK:
|
||||||
|
case STATUS_SERVER_DOWN:
|
||||||
|
$return = ['class' => 'status_small_squares'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Balls.
|
||||||
|
case STATUS_AGENT_CRITICAL_BALL:
|
||||||
|
case STATUS_AGENT_WARNING_BALL:
|
||||||
|
case STATUS_AGENT_DOWN_BALL:
|
||||||
|
case STATUS_AGENT_UNKNOWN_BALL:
|
||||||
|
case STATUS_AGENT_OK_BALL:
|
||||||
|
case STATUS_AGENT_NO_DATA_BALL:
|
||||||
|
case STATUS_AGENT_NO_MONITORS_BALL:
|
||||||
|
$return = ['class' => 'status_balls'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Small Balls.
|
||||||
|
case STATUS_MODULE_OK_BALL:
|
||||||
|
case STATUS_MODULE_CRITICAL_BALL:
|
||||||
|
case STATUS_MODULE_WARNING_BALL:
|
||||||
|
case STATUS_MODULE_NO_DATA_BALL:
|
||||||
|
case STATUS_MODULE_UNKNOWN_BALL:
|
||||||
|
case STATUS_ALERT_FIRED_BALL:
|
||||||
|
case STATUS_ALERT_NOT_FIRED_BALL:
|
||||||
|
case STATUS_ALERT_DISABLED_BALL:
|
||||||
|
$return = ['class' => 'status_small_balls'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Ignored.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints an image representing a status.
|
* Prints an image representing a status.
|
||||||
*
|
*
|
||||||
* @param string $status Module status.
|
* @param string $status Module status.
|
||||||
* @param string $title Title.
|
* @param string $title Title.
|
||||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||||
* @param array $options Options to set image attributes: I.E.: style.
|
* @param array $options Options to set image attributes: I.E.: style.
|
||||||
* @param boolean $rounded_image Round.
|
|
||||||
*
|
*
|
||||||
* @return string HTML.
|
* @return string HTML.
|
||||||
*/
|
*/
|
||||||
function ui_print_module_status(
|
function ui_print_status_sets(
|
||||||
$status,
|
$status,
|
||||||
$title='',
|
$title='',
|
||||||
$return=false,
|
$return=false,
|
||||||
$options=false,
|
$options=false
|
||||||
$rounded_image=false
|
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -2681,21 +2729,26 @@ function ui_print_module_status(
|
|||||||
$options = [];
|
$options = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['style'] .= 'width: 50px;';
|
if (isset($options['style'])) {
|
||||||
$options['style'] .= 'height: 2em;';
|
$options['style'] .= ' background: '.modules_get_color_status($status).'; display: inline-block;';
|
||||||
$options['style'] .= 'display: inline-block;';
|
} else {
|
||||||
|
$options['style'] = 'background: '.modules_get_color_status($status).'; display: inline-block;';
|
||||||
include_once __DIR__.'/functions_modules.php';
|
|
||||||
$options['style'] .= 'background: '.modules_get_color_status($status).';';
|
|
||||||
|
|
||||||
if ($rounded_image === true) {
|
|
||||||
$options['style'] .= 'border-radius: 5px;';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['title'] = $title;
|
if (isset($options['class'])) {
|
||||||
$options['data-title'] = $title;
|
$options['class'] = $options['class'];
|
||||||
$options['data-use_title_for_force_title'] = 1;
|
}
|
||||||
$options['class'] = 'forced_title';
|
|
||||||
|
if ($title != '') {
|
||||||
|
$options['title'] = $title;
|
||||||
|
$options['data-title'] = $title;
|
||||||
|
$options['data-use_title_for_force_title'] = 1;
|
||||||
|
if (isset($options['class'])) {
|
||||||
|
$options['class'] .= ' forced_title';
|
||||||
|
} else {
|
||||||
|
$options['class'] = 'forced_title';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$output = '<div ';
|
$output = '<div ';
|
||||||
foreach ($options as $k => $v) {
|
foreach ($options as $k => $v) {
|
||||||
|
@ -5803,3 +5803,45 @@ div#status_pie {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
grid-template-columns: 50px auto;
|
grid-template-columns: 50px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* - IMAGES FOR STATUS. This replaces the images of /images/status_sets/default/
|
||||||
|
* - Don't delete this
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
.status_small_rectangles {
|
||||||
|
width: 20px;
|
||||||
|
height: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status_rounded_rectangles {
|
||||||
|
width: 50px;
|
||||||
|
height: 2em;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status_small_squares,
|
||||||
|
.status_balls {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status_balls {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status_small_balls {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* - END - IMAGES FOR STATUS. Don't delete this
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
@ -138,3 +138,7 @@ div#tree-controller-recipient {
|
|||||||
width: 98%;
|
width: 98%;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tree-node > .node-content > div + div:not(.tree-node-counters) {
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user