mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
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:
commit
a44d67a733
@ -379,7 +379,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.
|
||||||
|
@ -29,7 +29,7 @@ export function linePropsDecoder(data: UnknownObject): LineProps | never {
|
|||||||
const lineWidth = parseIntOr(data.lineWidth, 0);
|
const lineWidth = parseIntOr(data.lineWidth, 0);
|
||||||
|
|
||||||
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,
|
||||||
@ -50,7 +50,7 @@ export function linePropsDecoder(data: UnknownObject): LineProps | never {
|
|||||||
y: parseIntOr(data.endY, 0)
|
y: parseIntOr(data.endY, 0)
|
||||||
},
|
},
|
||||||
lineWidth: lineWidth > 0 ? lineWidth : 1,
|
lineWidth: lineWidth > 0 ? lineWidth : 1,
|
||||||
color: notEmptyStringOr(data.color, null)
|
color: notEmptyStringOr(data.borderColor || data.color, null)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user