mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed last value
This commit is contained in:
parent
46fdfc4445
commit
f3fe8099bb
@ -1586,12 +1586,35 @@ class Item extends CachedModel
|
|||||||
$result['timezone'] = $timezone;
|
$result['timezone'] = $timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
$show_last_value = static::parseIntOr(
|
$show_last_value = static::notEmptyStringOr(
|
||||||
static::issetInArray($data, ['show_last_value', 'showLastValue']),
|
static::issetInArray($data, ['showLastValueTooltip']),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
if ($show_last_value === null) {
|
||||||
|
$show_last_value = static::parseIntOr(
|
||||||
|
static::issetInArray($data, ['show_last_value', 'showLastValue']),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($show_last_value !== null) {
|
if ($show_last_value !== null) {
|
||||||
$result['show_last_value'] = $show_last_value;
|
if (\is_numeric($show_last_value) === true) {
|
||||||
|
$result['show_last_value'] = $show_last_value;
|
||||||
|
} else {
|
||||||
|
switch ($show_last_value) {
|
||||||
|
case 'enabled':
|
||||||
|
$result['show_last_value'] = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'disabled':
|
||||||
|
$result['show_last_value'] = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$result['show_last_value'] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheExpiration = static::extractCacheExpiration($data);
|
$cacheExpiration = static::extractCacheExpiration($data);
|
||||||
|
@ -94,7 +94,8 @@ class ShowLastValueInputGroup extends InputGroup<Partial<StaticGraphProps>> {
|
|||||||
|
|
||||||
const showLastValueSelect = document.createElement("select");
|
const showLastValueSelect = document.createElement("select");
|
||||||
showLastValueSelect.required = true;
|
showLastValueSelect.required = true;
|
||||||
showLastValueSelect.value =
|
|
||||||
|
const currentValue =
|
||||||
this.currentData.showLastValueTooltip ||
|
this.currentData.showLastValueTooltip ||
|
||||||
this.initialData.showLastValueTooltip ||
|
this.initialData.showLastValueTooltip ||
|
||||||
"default";
|
"default";
|
||||||
@ -103,6 +104,9 @@ class ShowLastValueInputGroup extends InputGroup<Partial<StaticGraphProps>> {
|
|||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value = option.value;
|
optionElement.value = option.value;
|
||||||
optionElement.textContent = option.text;
|
optionElement.textContent = option.text;
|
||||||
|
if (currentValue == optionElement.value) {
|
||||||
|
optionElement.selected = true;
|
||||||
|
}
|
||||||
showLastValueSelect.appendChild(optionElement);
|
showLastValueSelect.appendChild(optionElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user