Fixed StaticGraph

Former-commit-id: 512635353ed672969ca4d13859ce073370115a7b
This commit is contained in:
Daniel Maya 2019-04-17 15:39:55 +02:00
parent 161bf4c079
commit 806310d8d1
2 changed files with 11 additions and 1 deletions
pandora_console/include/rest-api/models/VisualConsole

@ -720,6 +720,11 @@ class Item extends Model
throw new \InvalidArgumentException('invalid agent Id');
}
// Staticgraph don't need to have an agent.
if ($agentId === 0) {
return $agentData;
}
if (\is_metaconsole() && $metaconsoleId === null) {
throw new \InvalidArgumentException('missing metaconsole node Id');
}
@ -776,6 +781,11 @@ class Item extends Model
throw new \InvalidArgumentException('invalid module Id');
}
// Staticgraph don't need to have a module.
if ($moduleId === 0) {
return $moduleData;
}
// We should add the metaconsole Id if we can.
$metaconsoleId = static::extractMetaconsoleId($itemData);

@ -190,7 +190,7 @@ final class StaticGraph extends Item
}
// Get last value.
if (isset($data['show_last_value']) && $data['show_last_value'] !== 2) {
if (isset($data['show_last_value']) && $data['show_last_value'] !== 2 && $moduleId !== 0) {
$imgTitle = '';
$unit_text = \trim(\io_safe_output(\modules_get_unit($moduleId)));