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: updated to match RULE_STATE and STORE_DATA_POINTS meta behaviour
Rich Turner3777dd07f313
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex 077890e25..63e69b9a9 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -369,7 +369,7 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [const historyAttrs = Object.values(attributes).filter((attr) =>(!includedAttributes || includedAttributes.indexOf(attr.name!) >= 0)&& (!excludedAttributes || excludedAttributes.indexOf(attr.name!) < 0)- && (!attr.meta || !attr.hasOwnProperty(WellknownMetaItems.STOREDATAPOINTS) || !!Util.getMetaValue(WellknownMetaItems.STOREDATAPOINTS, attr)));+ && (attr.meta && (attr.meta.hasOwnProperty(WellknownMetaItems.STOREDATAPOINTS) ? attr.meta[WellknownMetaItems.STOREDATAPOINTS] : attr.meta.hasOwnProperty(WellknownMetaItems.AGENTLINK))));if (historyAttrs.length === 0) {return undefined;diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.tsindex d896e9135..3da7a30f4 100644--- a/ui/component/or-attribute-card/src/index.ts+++ b/ui/component/or-attribute-card/src/index.ts@@ -486,7 +486,7 @@ export class OrAttributeCard extends LitElement {if (attributes && attributes.length > 0) {return attributes- .filter((attr) => !attr.meta || !attr.meta.hasOwnProperty(WellknownMetaItems.STOREDATAPOINTS) || !!Util.getMetaValue(attr, undefined, WellknownMetaItems.STOREDATAPOINTS))+ .filter((attribute) => attribute.meta && (attribute.meta.hasOwnProperty(WellknownMetaItems.STOREDATAPOINTS) ? attribute.meta[WellknownMetaItems.STOREDATAPOINTS] : attribute.meta.hasOwnProperty(WellknownMetaItems.AGENTLINK))).map((attr: Attribute<any>) => {const descriptors = AssetModelUtil.getAttributeAndValueDescriptors(this.asset!.type, attr.name, attr);return [attr.name!, Util.getAttributeLabel(attr, descriptors[0], this.asset!.type, false)];diff --git a/ui/component/or-chart/src/index.ts b/ui/component/or-chart/src/index.tsindex d276ee394..cdb63e191 100644--- a/ui/component/or-chart/src/index.ts+++ b/ui/component/or-chart/src/index.ts@@ -832,7 +832,7 @@ export class OrChart extends translate(i18next)(LitElement) {let attributes = Object.values(this.activeAsset.attributes);if (attributes && attributes.length > 0) {return attributes- .filter((attr) => !attr.meta || !attr.meta.hasOwnProperty(WellknownMetaItems.STOREDATAPOINTS) || !!Util.getMetaValue(attr, undefined, WellknownMetaItems.STOREDATAPOINTS))+ .filter((attribute) => attribute.meta && (attribute.meta.hasOwnProperty(WellknownMetaItems.STOREDATAPOINTS) ? attribute.meta[WellknownMetaItems.STOREDATAPOINTS] : attribute.meta.hasOwnProperty(WellknownMetaItems.AGENTLINK))).filter((attr) => (this.assetAttributes && !this.assetAttributes.some((assetAttr, index) => (assetAttr.name === attr.name) && this.assets[index].id === this.activeAsset!.id))).map((attr) => {const descriptors = AssetModelUtil.getAttributeAndValueDescriptors(this.activeAsset!.type, attr.name, attr);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 9188d1246..dff4d4d25 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@@ -116,17 +116,17 @@ export class InternalPicker extends translate(i18next)(LitElement) {return;}this.selectedAsset = response.data[0];- if (this.selectedAsset.attributes != null) {+ if (this.selectedAsset.attributes) {this.attributeNames = [];- for (const att of Object.keys(this.selectedAsset.attributes)) {- if (!!Util.getMetaValue(WellknownMetaItems.RULESTATE, this.selectedAsset.attributes[att])) {- const label = Util.getAttributeLabel(this.selectedAsset.attributes[att], undefined, this.selectedAsset.type!, true)+ Object.values(this.selectedAsset.attributes).forEach((attribute) => {+ if (attribute.meta && (attribute.meta.hasOwnProperty(WellknownMetaItems.RULESTATE) ? attribute.meta[WellknownMetaItems.RULESTATE] : attribute.meta.hasOwnProperty(WellknownMetaItems.AGENTLINK))) {+ const label = Util.getAttributeLabel(attribute, undefined, this.selectedAsset.type!, true);this.attributeNames.push({- name: att,+ name: attribute.name!,label});}- }+ });if (this.attributeNames.length !== 0) {if (this.internal.value && this.internal.value.attributeName) {this.assetIntialised = true;diff --git a/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts b/ui/component/or-rules/src/json-viewer/or-rule-asset-query.tsindex 0db815d1d..8d82079b2 100644--- a/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts+++ b/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts@@ -149,7 +149,7 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {if (asset && asset.attributes) {attributes = Object.values(asset.attributes)- .filter((attr) => Util.hasMetaItem(WellknownMetaItems.RULESTATE, attr))+ .filter((attribute) => attribute.meta && (attribute.meta.hasOwnProperty(WellknownMetaItems.RULESTATE) ? attribute.meta[WellknownMetaItems.RULESTATE] : attribute.meta.hasOwnProperty(WellknownMetaItems.AGENTLINK))).map((attr) => {const descriptors = AssetModelUtil.getAttributeAndValueDescriptors(asset.type, attr.name, attr);const label = Util.getAttributeLabel(attr, descriptors[0], asset.type, false);diff --git a/ui/component/or-rules/src/or-rule-list.ts b/ui/component/or-rules/src/or-rule-list.tsindex 8e55a6b6f..88689c682 100644--- a/ui/component/or-rules/src/or-rule-list.ts+++ b/ui/component/or-rules/src/or-rule-list.ts@@ -153,9 +153,11 @@ export class OrRuleList extends translate(i18next)(LitElement) {protected get _allowedLanguages(): RulesetLang[] | undefined {const languages = this.config && this.config.controls && this.config.controls.allowedLanguages ? [...this.config.controls.allowedLanguages] : OrRuleList.DEFAULT_ALLOWED_LANGUAGES;- if(!manager.isSuperUser() || !this._globalRulesets) {- const index = languages.indexOf(RulesetLang.GROOVY);- if(index > 0) languages.splice(index)+ const groovyIndex = languages.indexOf(RulesetLang.GROOVY);+ if(!manager.isSuperUser()) {+ if(groovyIndex > 0) languages.splice(groovyIndex);+ } else if (groovyIndex < 0) {+ languages.push(RulesetLang.GROOVY);}return languages;}