mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-22 06:23:01 +00:00
[client/popup] Bugfix: Handle unspecified values
This commit is contained in:
parent
5934f96aaa
commit
50c500c1ec
1 changed files with 10 additions and 1 deletions
|
@ -94,9 +94,18 @@ class LayerDeviceMarkers {
|
||||||
// Filter out properties we're handling specially
|
// Filter out properties we're handling specially
|
||||||
if(["id", "name", "other"].includes(property)) continue;
|
if(["id", "name", "other"].includes(property)) continue;
|
||||||
|
|
||||||
|
|
||||||
// Ensure the property is a string - giving special handling to
|
// Ensure the property is a string - giving special handling to
|
||||||
// some property values
|
// some property values
|
||||||
let value = device_info[property];
|
let value = device_info[property];
|
||||||
|
|
||||||
|
// Filter out undefined properties
|
||||||
|
if(typeof value == "undefined" || value === null) {
|
||||||
|
value = "(not specified)";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If the value isn't a string, but is still 'truthy'
|
||||||
if(typeof value != "string") {
|
if(typeof value != "string") {
|
||||||
switch(property) {
|
switch(property) {
|
||||||
case "location":
|
case "location":
|
||||||
|
@ -117,7 +126,7 @@ class LayerDeviceMarkers {
|
||||||
params_container.appendChild(CreateElement("table.device-property-table", ...info_list));
|
params_container.appendChild(CreateElement("table.device-property-table", ...info_list));
|
||||||
|
|
||||||
params_container.appendChild(CreateElement("p.device-notes",
|
params_container.appendChild(CreateElement("p.device-notes",
|
||||||
CreateElement("em", device_info.other)
|
CreateElement("em", device_info.other || "")
|
||||||
));
|
));
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
Loading…
Reference in a new issue