From f4ff73bee152de1b92219284d863b1247293fbd4 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 23 Apr 2019 13:00:52 +0200 Subject: [PATCH] Visual Console Refactor: minor fix Former-commit-id: cf4201fd61ffb61957b54277d9195bae5935aa3b --- .../rest-api/models/VisualConsole/Items/Group.php | 15 ++++++--------- .../models/VisualConsole/Items/StaticGraph.php | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php index 90564d8aaa..c2841f36fd 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php @@ -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( diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php index 169afe81c8..7167ba8c1c 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php @@ -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(