Visual Console Refactor: minor fix
Former-commit-id: cf4201fd61ffb61957b54277d9195bae5935aa3b
This commit is contained in:
parent
f124612ba1
commit
f4ff73bee1
|
@ -109,19 +109,16 @@ final class Group extends Item
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a show Statistics value.
|
* Extract the "show statistics" switch value.
|
||||||
*
|
*
|
||||||
* @param array $data Unknown input data structure.
|
* @param array $data Unknown input data structure.
|
||||||
*
|
*
|
||||||
* @return integer Valid identifier of a group.
|
* @return boolean If the statistics should be shown or not.
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException When a valid group Id can't be found.
|
|
||||||
*/
|
*/
|
||||||
private static function extractShowStatistics(array $data): int
|
private static function extractShowStatistics(array $data): boolean
|
||||||
{
|
{
|
||||||
return static::parseIntOr(
|
return static::parseBool(
|
||||||
static::issetInArray($data, ['showStatistics', 'show_statistics']),
|
static::issetInArray($data, ['showStatistics', 'show_statistics'])
|
||||||
0
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +153,7 @@ final class Group extends Item
|
||||||
$groupId = static::extractGroupId($data);
|
$groupId = static::extractGroupId($data);
|
||||||
$showStatistics = static::extractShowStatistics($data);
|
$showStatistics = static::extractShowStatistics($data);
|
||||||
|
|
||||||
if ($showStatistics) {
|
if ($showStatistics === true) {
|
||||||
$isMetaconsole = \is_metaconsole();
|
$isMetaconsole = \is_metaconsole();
|
||||||
// Retrieve the agent stats.
|
// Retrieve the agent stats.
|
||||||
$agentsCritical = \agents_get_agents(
|
$agentsCritical = \agents_get_agents(
|
||||||
|
|
|
@ -164,7 +164,7 @@ final class StaticGraph extends Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the img src.
|
// Get the img src.
|
||||||
// There's no need to connect to the metaconsole after searching for
|
// There's no need to connect to the metaconsole before searching for
|
||||||
// the image status cause the function itself does that for us.
|
// the image status cause the function itself does that for us.
|
||||||
$imagePath = \visual_map_get_image_status_element($data);
|
$imagePath = \visual_map_get_image_status_element($data);
|
||||||
$data['statusImageSrc'] = \ui_get_full_url(
|
$data['statusImageSrc'] = \ui_get_full_url(
|
||||||
|
|
Loading…
Reference in New Issue