Merge branch 'visual-console-refactor' of https://brutus.artica.lan:8081/artica/pandorafms into visual-console-refactor

Former-commit-id: 358c210cdc36b162f7337258d87f9609be39ef5a
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-17 15:58:19 +02:00
commit 30f5c97610
2 changed files with 11 additions and 1 deletions

View File

@ -719,6 +719,11 @@ class Item extends Model
throw new \InvalidArgumentException('invalid agent Id'); throw new \InvalidArgumentException('invalid agent Id');
} }
// Staticgraph don't need to have an agent.
if ($agentId === 0) {
return $agentData;
}
if (\is_metaconsole() && $metaconsoleId === null) { if (\is_metaconsole() && $metaconsoleId === null) {
throw new \InvalidArgumentException('missing metaconsole node Id'); throw new \InvalidArgumentException('missing metaconsole node Id');
} }
@ -775,6 +780,11 @@ class Item extends Model
throw new \InvalidArgumentException('invalid module Id'); 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. // We should add the metaconsole Id if we can.
$metaconsoleId = static::extractMetaconsoleId($itemData); $metaconsoleId = static::extractMetaconsoleId($itemData);

View File

@ -190,7 +190,7 @@ final class StaticGraph extends Item
} }
// Get last value. // 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 = ''; $imgTitle = '';
$unit_text = \trim(\io_safe_output(\modules_get_unit($moduleId))); $unit_text = \trim(\io_safe_output(\modules_get_unit($moduleId)));