100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Bugfix/629 asset card thingasset (#647)
vlichtenberg65d1da2c8592
diff --git a/ui/app/manager/src/pages/page-map.ts b/ui/app/manager/src/pages/page-map.tsindex cef34d0ce..bc7384ad5 100644--- a/ui/app/manager/src/pages/page-map.ts+++ b/ui/app/manager/src/pages/page-map.ts@@ -150,7 +150,7 @@ export class PageMap extends Page<MapStateKeyed> {@media only screen and (min-width: 415px){or-map-asset-card {position: absolute;- top: 20px;+ top: 10px;right: 50px;width: 320px;margin: 0;diff --git a/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts b/ui/component/or-asset-viewer/src/or-edit-asset-panel.tsindex 993868c19..e39989f94 100644--- a/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts+++ b/ui/component/or-asset-viewer/src/or-edit-asset-panel.ts@@ -409,8 +409,12 @@ export class OrEditAssetPanel extends LitElement {const asset = this.asset!;let attr: Attribute<any>;+ const isDisabled = (attribute: Attribute<any>) => {+ return !(attribute && attribute.name && !asset.attributes![attribute.name] && AssetNameRegex.test(attribute.name) && attribute.type);+ }+const onAttributeChanged = (attribute: Attribute<any>) => {- const addDisabled = !(attribute.name && !asset.attributes![attribute.name] && AssetNameRegex.test(attribute.name) && attribute.type);+ const addDisabled = isDisabled(attribute);const addBtn = dialog!.shadowRoot!.getElementById("add-btn") as OrMwcInput;addBtn!.disabled = addDisabled;attr = attribute;@@ -442,10 +446,13 @@ export class OrEditAssetPanel extends LitElement {default: true,actionName: "add",action: () => {- this.asset.attributes![attr.name!] = attr;- this._onModified();+ if (attr) {+ this.asset.attributes![attr.name!] = attr;+ this._onModified();+ }},- content: html`<or-mwc-input id="add-btn" .type="${InputType.BUTTON}" disabled .label="${i18next.t("add")}"></or-mwc-input>`+ content: html`<or-mwc-input id="add-btn" .type="${InputType.BUTTON}" disabled .label="${i18next.t("add")}"+ @click="${(ev: Event) => { if (isDisabled(attr)) { ev.stopPropagation(); return false; } } }"></or-mwc-input>`}]).setDismissAction(null));diff --git a/ui/component/or-map/src/or-map-asset-card.ts b/ui/component/or-map/src/or-map-asset-card.tsindex fb6b88773..f5362d34e 100644--- a/ui/component/or-map/src/or-map-asset-card.ts+++ b/ui/component/or-map/src/or-map-asset-card.ts@@ -201,8 +201,10 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {if (this.asset) {const descriptor = AssetModelUtil.getAssetDescriptor(this.asset.type);const color = getMarkerIconAndColorFromAssetType(descriptor)?.color;- // check if range- return (typeof color === 'string') ? color : color![0].colour;+ if (color) {+ // check if range+ return (typeof color === 'string') ? color : color![0].colour;+ }}}}