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
UI updates: Bug fix for asset editor when an error occurs during saving (Fixes #310)
Rich Turner9c6708c78655
diff --git a/ui/app/or-app/src/pages/page-assets.ts b/ui/app/or-app/src/pages/page-assets.tsindex 7d6659a8c..0b43a6c29 100644--- a/ui/app/or-app/src/pages/page-assets.ts+++ b/ui/app/or-app/src/pages/page-assets.ts@@ -253,10 +253,13 @@ class PageAssets<S extends AppStateKeyed> extends Page<S> {}protected _onAssetSave(result: SaveResult) {- if (result.success && result.isNew) {++ if (!result.success) {+ return;+ }++ if (result.isNew) {this._addedAssetId = result.assetId!;- } else {- this._viewer.assetId = result.assetId;}}diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex ef0115e9b..a69c631c0 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -1079,9 +1079,7 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElemthis.wrapperElem.classList.remove("saving");this.saveBtnElem.disabled = false;- if (!result.success) {- showErrorDialog(i18next.t("saveAssetFailed"));- } else {+ if (result.success) {this._assetModified = false;this.assetId = result.assetId;this.reloadAsset();diff --git a/ui/component/or-asset-viewer/src/or-add-attribute-panel.ts b/ui/component/or-asset-viewer/src/or-add-attribute-panel.tsindex 732a8e0ab..92679a6b2 100644--- a/ui/component/or-asset-viewer/src/or-add-attribute-panel.ts+++ b/ui/component/or-asset-viewer/src/or-add-attribute-panel.ts@@ -75,7 +75,7 @@ export class OrAddAttributePanel extends LitElement {<or-input .type="${InputType.SELECT}" .options="${attributeTypes}" .label="${i18next.t("type")}" @or-input-changed="${(ev: OrInputChangedEvent) => this.onTypeChanged(ev.detail.value)}"></or-input></div><div id="name-input" class="hidden">- <or-input .type="${InputType.TEXT}" .label="${i18next.t("name")}" pattern="\\w+" required @keyup="${(ev: KeyboardEvent) => this.onNameChanged((ev.target as OrInput).currentValue)}" @or-input-changed="${(ev: OrInputChangedEvent) => this.onNameChanged(ev.detail.value)}"></or-input>+ <or-input .type="${InputType.TEXT}" .label="${i18next.t("name")}" pattern="\\w+" required @keyup="${(ev: KeyboardEvent) => this.onNameChanged((ev.target as OrInput).currentValue)}" @or-input-changed="${(ev: OrInputChangedEvent) => this.onNameChanged(ev.detail.value)}"></or-input></div><div id="type-input" class="hidden"><or-input .type="${InputType.SELECT}" .options="${attributeValueTypes}" .label="${i18next.t("valueType")}" @or-input-changed="${(ev: OrInputChangedEvent) => this.onValueTypeChanged(ev.detail.value)}"></or-input>