Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: minor

Rich Turnerca8b6e371ddb
diff --git a/ui/component/core/src/console.ts b/ui/component/core/src/console.ts
index b57b35396..c9846e863 100644
--- a/ui/component/core/src/console.ts
+++ b/ui/component/core/src/console.ts
@@ -338,7 +338,7 @@ export class Console {
key: key
}, true);
- if (response && response.hasOwnProperty("value")) {
+ if (response && response.value) {
return JSON.parse(response.value);
}
@@ -428,7 +428,7 @@ export class Console {
throw new Error("Storage provider 'store' action requires a `key`");
}
- if (msg.hasOwnProperty("value")) {
+ if (msg.value) {
if (msg.value === null) {
window.localStorage.removeItem(keyValue);
} else {
diff --git a/ui/component/or-map/src/util.ts b/ui/component/or-map/src/util.ts
index 96ef6b68b..55e309e36 100644
--- a/ui/component/or-map/src/util.ts
+++ b/ui/component/or-map/src/util.ts
@@ -3,7 +3,7 @@ import L, {LatLng, LatLngBounds} from "mapbox.js";
import {Asset, AttributeType, AssetAttribute, GeoJSONPoint, AttributeValueType} from "@openremote/model";
import {Util} from "@openremote/core";
-export function getLngLat(lngLatLike?: LngLatLike | Asset | AssetAttribute | GeoJSONPoint | object): LngLat | undefined {
+export function getLngLat(lngLatLike?: LngLatLike | Asset | AssetAttribute | GeoJSONPoint): LngLat | undefined {
if (lngLatLike) {
if (lngLatLike instanceof LngLat) {
@@ -12,7 +12,7 @@ export function getLngLat(lngLatLike?: LngLatLike | Asset | AssetAttribute | Geo
let obj = lngLatLike as any;
- if (obj.hasOwnProperty("attributes")) {
+ if ((obj as Asset).attributes) {
// This is an asset
const locationAttribute = Util.getAssetAttribute(obj as Asset, AttributeType.LOCATION.attributeName!);
if (!locationAttribute) {
@@ -21,7 +21,7 @@ export function getLngLat(lngLatLike?: LngLatLike | Asset | AssetAttribute | Geo
obj = locationAttribute;
}
- if (obj.hasOwnProperty("name") && obj.hasOwnProperty("type")) {
+ if ((obj as AssetAttribute).name && (obj as AssetAttribute).type) {
const attr = obj as AssetAttribute;
if (attr.type !== AttributeValueType.GEO_JSON_POINT.name || !attr.value) {
return;
@@ -29,7 +29,7 @@ export function getLngLat(lngLatLike?: LngLatLike | Asset | AssetAttribute | Geo
obj = attr.value;
}
- if (obj.type === "Point" && Array.isArray(obj.coordinates)) {
+ if ((obj as GeoJSONPoint).coordinates && Array.isArray(obj.coordinates)) {
return new LngLat(obj.coordinates[0], obj.coordinates[1]);
}