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
display error panel when inputs are invalid
Vincent8d958ee6e8e9
diff --git a/deployment/manager/shared/locales/en/or.json b/deployment/manager/shared/locales/en/or.jsonindex b3291a1d8..c97c399d9 100644--- a/deployment/manager/shared/locales/en/or.json+++ b/deployment/manager/shared/locales/en/or.json@@ -177,5 +177,6 @@"PERCENTAGE": "%.2f","NUMBER": "%.0f","TEMPERATURE": "%.1f"- }+ },+ "attributeNotFound": "Attribute not found in asset"}diff --git a/deployment/manager/shared/locales/nl/or.json b/deployment/manager/shared/locales/nl/or.jsonindex b36249d65..7e465a3b8 100644--- a/deployment/manager/shared/locales/nl/or.json+++ b/deployment/manager/shared/locales/nl/or.json@@ -176,5 +176,6 @@"PERCENTAGE": "%.2f","NUMBER": "%.0f","TEMPERATURE": "%.1f"- }+ },+ "attributeNotFound": "Attribuut niet gevonden in asset"}diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.tsindex 91cd1a8cb..b7d658c41 100644--- a/ui/component/or-attribute-card/src/index.ts+++ b/ui/component/or-attribute-card/src/index.ts@@ -48,10 +48,10 @@ const style = css`export class OrAttributeCard extends LitElement {@property()- public assetId?: string;+ public assetId: string = "";@property()- public attributeName?: string;+ public attributeName: string = "";@property()private cardTitle: string = "";@@ -63,14 +63,11 @@ export class OrAttributeCard extends LitElement {}private getData = () => {- if (this.assetId) {- this.getAssetById(this.assetId)- .then((data) => {- this.cardTitle = data.name || "";- console.log("set", this.cardTitle);- }- );- }+ this.getAssetById(this.assetId)+ .then((data) => {+ this.cardTitle = [data.name, i18next.t(this.attributeName)].join(" - ") || "";+ }+ );};protected render() {@@ -78,19 +75,19 @@ export class OrAttributeCard extends LitElement {this.getData();- if (!this.assetId || !this.attributeName) {- // return html`- // <div class="panel">- // <div class="panel-content-wrapper">- // <div class="panel-title">- // ${this.asdf}- // </div>- // <div class="panel-content">- // <p>no attribute found</p>- // </div>- // </div>- // </div>- // `;+ if (this.assetId === "" || this.attributeName === "") {+ return html`+ <div class="panel">+ <div class="panel-content-wrapper">+ <div class="panel-title">+ <or-translate value="error"></or-translate>+ </div>+ <div class="panel-content">+ <or-translate value="attributeNotFound"></or-translate>+ </div>+ </div>+ </div>+ `;}return html`