Visual Console Refactor: bugfixes
Former-commit-id: d5f194be2d9e201cdcc3c7cafbd64b6a1149ae7d
This commit is contained in:
parent
161bf4c079
commit
c9076aa85e
|
@ -446,11 +446,10 @@ class Item extends Model
|
|||
{
|
||||
$agentData = [];
|
||||
|
||||
// We should add the metaconsole Id if we can. If not,
|
||||
// it doesn't have to be into the structure.
|
||||
// We should add the metaconsole Id if we can.
|
||||
$metaconsoleId = static::extractMetaconsoleId($data);
|
||||
if ($metaconsoleId !== null) {
|
||||
$agentData['metaconsoleId'] = $metaconsoleId;
|
||||
if ($metaconsoleId !== null && $metaconsoleId <= 0) {
|
||||
$agentData['metaconsoleId'] = null;
|
||||
}
|
||||
|
||||
// The agent Id should be a valid int or a null value.
|
||||
|
|
|
@ -44,7 +44,10 @@ final class ColorCloud extends Item
|
|||
$decodedData['label'] = null;
|
||||
$decodedData['defaultColor'] = static::extractDefaultColor($data);
|
||||
$decodedData['colorRanges'] = static::extractColorRanges($data);
|
||||
$decodedData['color'] = static::notEmptyStringOr(static::issetInArray($data, ['color']), null);
|
||||
$decodedData['color'] = static::notEmptyStringOr(
|
||||
static::issetInArray($data, ['color']),
|
||||
null
|
||||
);
|
||||
|
||||
return $decodedData;
|
||||
}
|
||||
|
@ -204,11 +207,8 @@ final class ColorCloud extends Item
|
|||
|
||||
// Get the linked module Id.
|
||||
$linkedModule = static::extractLinkedModule($data);
|
||||
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
||||
$metaconsoleId = static::parseIntOr(
|
||||
$linkedModule['metaconsoleId'],
|
||||
null
|
||||
);
|
||||
$moduleId = $linkedModule['moduleId'];
|
||||
$metaconsoleId = $linkedModule['metaconsoleId'];
|
||||
|
||||
if ($moduleId === null) {
|
||||
throw new \InvalidArgumentException('missing module Id');
|
||||
|
|
Loading…
Reference in New Issue