mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
Fixed Line class
Former-commit-id: 639649f4d65340ff25ecc1e956298705f5d13a05
This commit is contained in:
parent
fa1bf821e2
commit
9be6029e1a
@ -376,7 +376,7 @@ final class Container extends Model
|
|||||||
$class = static::getItemClass($itemType);
|
$class = static::getItemClass($itemType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
\array_push($items, $class::fromDBWithId($itemId));
|
\array_push($items, $class::fromDB(['id' => $itemId]));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// TODO: Log this?
|
// TODO: Log this?
|
||||||
}
|
}
|
||||||
|
@ -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]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,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) {
|
||||||
$img_style_title = '';
|
$imgTitle = '';
|
||||||
|
|
||||||
$unit_text = \trim(\io_safe_output(\modules_get_unit($moduleId)));
|
$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)
|
|| (\modules_is_boolean($moduleId) && $data['show_last_value'] != 0)
|
||||||
) {
|
) {
|
||||||
if (\is_numeric($value)) {
|
if (\is_numeric($value)) {
|
||||||
$img_style_title .= __('Last value: ').remove_right_zeros($value);
|
$imgTitle .= __('Last value: ').remove_right_zeros($value);
|
||||||
} else {
|
} else {
|
||||||
$img_style_title .= __('Last value: ').$value;
|
$imgTitle .= __('Last value: ').$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($unit_text) === false && empty($img_style_title) === false) {
|
if (empty($unit_text) === false && empty($imgTitle) === false) {
|
||||||
$img_style_title .= ' '.$unit_text;
|
$imgTitle .= ' '.$unit_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['lastValue'] = $img_style_title;
|
$data['lastValue'] = $imgTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore connection.
|
// Restore connection.
|
||||||
|
@ -27,7 +27,7 @@ interface LineProps extends ItemProps {
|
|||||||
*/
|
*/
|
||||||
export function linePropsDecoder(data: UnknownObject): LineProps | never {
|
export function linePropsDecoder(data: UnknownObject): LineProps | never {
|
||||||
return {
|
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,
|
type: ItemType.LINE_ITEM,
|
||||||
label: null,
|
label: null,
|
||||||
isLinkEnabled: false,
|
isLinkEnabled: false,
|
||||||
@ -47,8 +47,8 @@ export function linePropsDecoder(data: UnknownObject): LineProps | never {
|
|||||||
x: parseIntOr(data.endX, 0),
|
x: parseIntOr(data.endX, 0),
|
||||||
y: parseIntOr(data.endY, 0)
|
y: parseIntOr(data.endY, 0)
|
||||||
},
|
},
|
||||||
lineWidth: parseIntOr(data.lineWidth, 1),
|
lineWidth: parseIntOr(data.borderWidth, 1),
|
||||||
color: notEmptyStringOr(data.color, null)
|
color: notEmptyStringOr(data.borderColor, null)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user