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
Fix attribute selection dialog for only rule state and store data points
Don92276bd5124d
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.jsonindex 874e7d8e8..cc7b4a734 100644--- a/manager/src/web/shared/locales/en/or.json+++ b/manager/src/web/shared/locales/en/or.json@@ -134,7 +134,10 @@"output": "Output","selectAsset": "Select asset","selectAssetOnTheLeft": "Select an asset on the left",- "noRuleStateAttributes": "No rule state attributes",+ "noRuleStateAttributes": "No attributes with 'rule state' or 'agent link' configuration item found",+ "noDatapointsAttributes": "No attributes with 'store data points' or 'agent link' configuration item found",+ "noAttributesToShow": "No attributes found",+ "noDatapointsOrRuleStateAttributes": "No attributes with 'rule state', 'store data points', or 'agent link' configuration item found","copy": "Copy","paste": "Paste","delete": "Delete",diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.jsonindex 22319f1be..a1bc18c21 100644--- a/manager/src/web/shared/locales/nl/or.json+++ b/manager/src/web/shared/locales/nl/or.json@@ -134,7 +134,10 @@"output": "Output","selectAsset": "Selecteer asset","selectAssetOnTheLeft": "Selecteer een asset aan de linkerkant",- "noRuleStateAttributes": "Geen rule state attributes",+ "noRuleStateAttributes": "Geen attributen met 'rule state' of 'agent link' configuratie item gevonden",+ "noDatapointsAttributes": "Geen attributen met 'store data points' of 'agent link' configuratie item gevonden",+ "noAttributesToShow": "Geen attributen gevonden",+ "noDatapointsOrRuleStateAttributes": "Geen attributen met 'rule state', 'store data points', of 'agent link' configuratie item gevonden","copy": "Kopiëren","paste": "Plakken","delete": "Verwijderen",diff --git a/ui/component/or-mwc-components/src/or-mwc-dialog.ts b/ui/component/or-mwc-components/src/or-mwc-dialog.tsindex 968198e03..dcc410ee0 100644--- a/ui/component/or-mwc-components/src/or-mwc-dialog.ts+++ b/ui/component/or-mwc-components/src/or-mwc-dialog.ts@@ -442,8 +442,8 @@ export class OrMwcAttributeSelector extends OrMwcDialog {});this.dialogContent = html`- <div class="row" style="display: flex;height: 600px;width: 800px;">- <div class="col" style="width: 260px;overflow: auto;">+ <div class="row" style="display: flex;height: 600px;width: 800px;border-top: 1px solid ${unsafeCSS(DefaultColor5)};">+ <div class="col" style="width: 260px;overflow: auto;border-right: 1px solid ${unsafeCSS(DefaultColor5)};"><or-asset-tree id="chart-asset-tree" readonly@or-asset-tree-request-selection="${(event: CustomEvent) => this._onAssetSelectionChanged(event)}"@or-asset-tree-request-delete="${() => this._onAssetSelectionDeleted()}"></or-asset-tree>@@ -472,7 +472,14 @@ export class OrMwcAttributeSelector extends OrMwcDialog {this.reRenderDialog()}}"></or-mwc-input>`}- ` : html`<div style="display: flex;align-items: center;text-align: center;height: 100%;"><span style="width:100%"><or-translate value="selectAssetOnTheLeft"></or-translate></span></div>`}+ ` : html`<div style="display: flex;align-items: center;text-align: center;height: 100%;padding: 0 20px;"><span style="width:100%">+ <or-translate value="${+ (this.selectedAsset && listItems.length == 0) ?+ ((this.showOnlyDatapointAttrs && this.showOnlyRuleStateAttrs) ? "noDatapointsOrRuleStateAttributes" :+ this.showOnlyDatapointAttrs ? "noDatapointsAttributes" :+ this.showOnlyRuleStateAttrs ? "noRuleStateAttributes" : "noAttributesToShow"+ ) : "selectAssetOnTheLeft"}">+ </or-translate></span></div>`}</div>`;}@@ -499,12 +506,15 @@ export class OrMwcAttributeSelector extends OrMwcDialog {manager.rest.api.AssetResource.get(this.selectedAsset.id!).then(result => {this.assetAttributes = Object.values(result.data.attributes!) as Attribute<any>[];- if (this.showOnlyDatapointAttrs) {+ if (this.showOnlyDatapointAttrs && this.showOnlyRuleStateAttrs) {+ this.assetAttributes = this.assetAttributes+ .filter(e => e.meta && (e.meta[WellknownMetaItems.STOREDATAPOINTS] || e.meta[WellknownMetaItems.RULESTATE] || e.meta[WellknownMetaItems.AGENTLINK]));+ } else if (this.showOnlyDatapointAttrs) {this.assetAttributes = this.assetAttributes.filter(e => e.meta && (e.meta[WellknownMetaItems.STOREDATAPOINTS] || e.meta[WellknownMetaItems.AGENTLINK]));- }else if (this.showOnlyRuleStateAttrs) {+ } else if (this.showOnlyRuleStateAttrs) {this.assetAttributes = this.assetAttributes- .filter(e => e.meta && (e.meta[WellknownMetaItems.RULESTATE]));+ .filter(e => e.meta && (e.meta[WellknownMetaItems.RULESTATE] || e.meta[WellknownMetaItems.AGENTLINK]));}this.reRenderDialog();});diff --git a/ui/component/or-rules/src/flow-viewer/components/internal-picker.ts b/ui/component/or-rules/src/flow-viewer/components/internal-picker.tsindex c0ca6c58d..66f6c6100 100644--- a/ui/component/or-rules/src/flow-viewer/components/internal-picker.ts+++ b/ui/component/or-rules/src/flow-viewer/components/internal-picker.ts@@ -139,7 +139,7 @@ export class InternalPicker extends translate(i18next)(LitElement) {const hostElement = document.body;const dialog = new OrMwcAttributeSelector();- dialog.showOnlyRuleStateAttrs = false;+ dialog.showOnlyRuleStateAttrs = true;dialog.showOnlyDatapointAttrs = false;dialog.multiSelect = false;dialog.selectedAttributes = _selectedAttributes;