Added code and translation for customapi format data types:

- percentBinary (1-100% of 8-bit number)
- state (boolean value as state)
This commit is contained in:
Kaya Emilia Riegler 2023-09-04 21:08:48 +02:00
parent 61b969cced
commit 9994ab4141
2 changed files with 21 additions and 13 deletions

View File

@ -306,6 +306,10 @@
"7days": "7 Days", "7days": "7 Days",
"30days": "30 Days" "30days": "30 Days"
}, },
"customapi": {
"active": "Active",
"inactive": "Inactive"
},
"gotify": { "gotify": {
"apps": "Applications", "apps": "Applications",
"clients": "Clients", "clients": "Clients",

View File

@ -35,6 +35,10 @@ function formatValue(t, mapping, value) {
return t("common.number", {value}); return t("common.number", {value});
case 'percent': case 'percent':
return t("common.percent", {value}); return t("common.percent", {value});
case 'percentBinary':
return t("common.percent", {value: (100 * value / 255).toFixed()});
case 'state':
return t(`customapi.${/true/.test(value) ? "active" : "inactive"}`);
case 'text': case 'text':
default: default:
return value; return value;