mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Fixed status of staticgraph in metaconsole
Former-commit-id: cf0b32c2c7cafaca8f4463d46d67c25c7a81fdc2
This commit is contained in:
parent
d6bd44d1c0
commit
404fb19e35
@ -163,21 +163,6 @@ final class StaticGraph extends Item
|
|||||||
throw new \InvalidArgumentException('missing module Id');
|
throw new \InvalidArgumentException('missing module Id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe connect to node.
|
|
||||||
$nodeConnected = false;
|
|
||||||
if (\is_metaconsole() === true && $metaconsoleId !== null) {
|
|
||||||
$nodeConnected = \metaconsole_connect(
|
|
||||||
null,
|
|
||||||
$metaconsoleId
|
|
||||||
) === NOERR;
|
|
||||||
|
|
||||||
if ($nodeConnected === false) {
|
|
||||||
throw new \InvalidArgumentException(
|
|
||||||
'error connecting to the node'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the img src.
|
// Get the img src.
|
||||||
$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(
|
||||||
@ -198,6 +183,21 @@ final class StaticGraph extends Item
|
|||||||
// Get last value.
|
// Get last value.
|
||||||
$showLastValueTooltip = static::extractShowLastValueTooltip($data);
|
$showLastValueTooltip = static::extractShowLastValueTooltip($data);
|
||||||
if ($showLastValueTooltip !== 'disabled' && $moduleId > 0) {
|
if ($showLastValueTooltip !== 'disabled' && $moduleId > 0) {
|
||||||
|
// Maybe connect to node.
|
||||||
|
$nodeConnected = false;
|
||||||
|
if (\is_metaconsole() === true && $metaconsoleId !== null) {
|
||||||
|
$nodeConnected = \metaconsole_connect(
|
||||||
|
null,
|
||||||
|
$metaconsoleId
|
||||||
|
) === NOERR;
|
||||||
|
|
||||||
|
if ($nodeConnected === false) {
|
||||||
|
throw new \InvalidArgumentException(
|
||||||
|
'error connecting to the node'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$imgTitle = '';
|
$imgTitle = '';
|
||||||
|
|
||||||
$unit = \trim(\io_safe_output(\modules_get_unit($moduleId)));
|
$unit = \trim(\io_safe_output(\modules_get_unit($moduleId)));
|
||||||
@ -219,11 +219,11 @@ final class StaticGraph extends Item
|
|||||||
|
|
||||||
$data['lastValue'] = $imgTitle;
|
$data['lastValue'] = $imgTitle;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Restore connection.
|
// Restore connection.
|
||||||
if ($nodeConnected === true) {
|
if ($nodeConnected === true) {
|
||||||
\metaconsole_restore_db();
|
\metaconsole_restore_db();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user