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

Former-commit-id: 18d39f1b4ffbd3e56a3b1a879abf8bdf4ec6dead
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-16 12:24:56 +02:00
commit a44d67a733
4 changed files with 9 additions and 23 deletions

View File

@ -379,7 +379,7 @@ final class Container extends Model
$class = static::getItemClass($itemType);
try {
\array_push($items, $class::fromDBWithId($itemId));
\array_push($items, $class::fromDB(['id' => $itemId]));
} catch (\Throwable $e) {
// TODO: Log this?
}

View File

@ -1073,18 +1073,4 @@ class Item extends Model
}
/**
* Obtain a vc item instance from the database using an identifier.
*
* @param integer $id Identifier of the Visual Console Item.
*
* @return mixed The Visual Console Item data structure stored into the DB.
* @throws \Exception When the data cannot be retrieved from the DB.
*/
public static function fromDBWithId(int $id)
{
return static::fromDB(['id' => $id]);
}
}

View File

@ -191,7 +191,7 @@ final class StaticGraph extends Item
// Get last value.
if (isset($data['show_last_value']) && $data['show_last_value'] !== 2) {
$img_style_title = '';
$imgTitle = '';
$unit_text = \trim(\io_safe_output(\modules_get_unit($moduleId)));
@ -201,17 +201,17 @@ final class StaticGraph extends Item
|| (\modules_is_boolean($moduleId) && $data['show_last_value'] != 0)
) {
if (\is_numeric($value)) {
$img_style_title .= __('Last value: ').remove_right_zeros($value);
$imgTitle .= __('Last value: ').remove_right_zeros($value);
} else {
$img_style_title .= __('Last value: ').$value;
$imgTitle .= __('Last value: ').$value;
}
}
if (empty($unit_text) === false && empty($img_style_title) === false) {
$img_style_title .= ' '.$unit_text;
if (empty($unit_text) === false && empty($imgTitle) === false) {
$imgTitle .= ' '.$unit_text;
}
$data['lastValue'] = $img_style_title;
$data['lastValue'] = $imgTitle;
}
// Restore connection.

View File

@ -29,7 +29,7 @@ export function linePropsDecoder(data: UnknownObject): LineProps | never {
const lineWidth = parseIntOr(data.lineWidth, 0);
return {
...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
...itemBasePropsDecoder({ ...data, width: 1, height: 1 }), // Object spread. It will merge the properties of the two objects.
type: ItemType.LINE_ITEM,
label: null,
isLinkEnabled: false,
@ -50,7 +50,7 @@ export function linePropsDecoder(data: UnknownObject): LineProps | never {
y: parseIntOr(data.endY, 0)
},
lineWidth: lineWidth > 0 ? lineWidth : 1,
color: notEmptyStringOr(data.color, null)
color: notEmptyStringOr(data.borderColor || data.color, null)
};
}