Visual Console Refactor: minor fix

Former-commit-id: cf4201fd61ffb61957b54277d9195bae5935aa3b
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-23 13:00:52 +02:00
parent f124612ba1
commit f4ff73bee1
2 changed files with 7 additions and 10 deletions

View File

@ -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.
*
* @return integer Valid identifier of a group.
*
* @throws \InvalidArgumentException When a valid group Id can't be found.
* @return boolean If the statistics should be shown or not.
*/
private static function extractShowStatistics(array $data): int
private static function extractShowStatistics(array $data): boolean
{
return static::parseIntOr(
static::issetInArray($data, ['showStatistics', 'show_statistics']),
0
return static::parseBool(
static::issetInArray($data, ['showStatistics', 'show_statistics'])
);
}
@ -156,7 +153,7 @@ final class Group extends Item
$groupId = static::extractGroupId($data);
$showStatistics = static::extractShowStatistics($data);
if ($showStatistics) {
if ($showStatistics === true) {
$isMetaconsole = \is_metaconsole();
// Retrieve the agent stats.
$agentsCritical = \agents_get_agents(

View File

@ -164,7 +164,7 @@ final class StaticGraph extends Item
}
// 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.
$imagePath = \visual_map_get_image_status_element($data);
$data['statusImageSrc'] = \ui_get_full_url(