From afdb733d7d3f3e18750132641b4d3d10b669026d Mon Sep 17 00:00:00 2001 From: Mehrad Malayeri Date: Wed, 24 Nov 2021 18:05:03 +0330 Subject: [PATCH] https://github.com/project-chip/zap/issues/318 --- src/components/ZclAttributeReportingManager.vue | 16 ++++++++++------ src/util/editable-attributes-mixin.js | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/ZclAttributeReportingManager.vue b/src/components/ZclAttributeReportingManager.vue index 490df04f72..84a8c59550 100644 --- a/src/components/ZclAttributeReportingManager.vue +++ b/src/components/ZclAttributeReportingManager.vue @@ -333,12 +333,16 @@ export default { return !this.editableAttributesReporting[attributeId] }, displayAttrWarning(row) { - // TODO display proper warnings - let reporableValue = this.selectionReportableChange[ - this.hashAttributeIdClusterId(row.id, this.selectedCluster.id) - ]; - let typeMaxLimit = Number(row.type.match(/int(\d+)/i)?.[1]); - return typeMaxLimit && reporableValue && reporableValue>Math.pow(2,typeMaxLimit) ; + let indexOfValue = this.selectedReporting.indexOf( + this.hashAttributeIdClusterId(row.id, this.selectedCluster.id) + ) + let isDisabled + if (indexOfValue === -1) { + isDisabled = true + } else { + isDisabled = false + } + return isDisabled && row.isReportable ; }, isAttributeRequired(attribute) { // TODO set by reporting required diff --git a/src/util/editable-attributes-mixin.js b/src/util/editable-attributes-mixin.js index fd42404c24..e8ee259448 100644 --- a/src/util/editable-attributes-mixin.js +++ b/src/util/editable-attributes-mixin.js @@ -233,6 +233,10 @@ export default { reportMaxInterval: attributeData.reportMaxInterval, } this.$store.dispatch('zap/updateSelectedAttribute', editContext) + if(addedValue && listType === "selectedAttributes" && attributeData.isReportable){ + editContext.listType = 'selectedReporting'; + this.$store.dispatch('zap/updateSelectedAttribute', editContext) + } }, initializeTextEditableList(originatingList, editableList, attrClusterHash) {