From 2b717478b4ef1fdbd73d1339077013f92d06fc58 Mon Sep 17 00:00:00 2001 From: Paul Regan <64710345+paulr34@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:31:21 -0400 Subject: [PATCH] dynamically enabling Matter/Zigbee only components for CMP (#1427) * fixing so there are dynamic categories based on the device type when in cmp mode --- src/components/ZclAttributeManager.vue | 4 +--- src/components/ZclCreateModifyEndpoint.vue | 12 ++++-------- src/store/zap/state.js | 2 ++ src/util/ui-options.js | 18 +++++++++++++++++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/components/ZclAttributeManager.vue b/src/components/ZclAttributeManager.vue index 7241bb4c54..d1eb518389 100644 --- a/src/components/ZclAttributeManager.vue +++ b/src/components/ZclAttributeManager.vue @@ -415,9 +415,7 @@ export default { sortBy: 'clientServer' }, columns: [], - forcedExternal: [], - enableSingleton: false, - enableBounded: false + forcedExternal: [] } }, mounted() { diff --git a/src/components/ZclCreateModifyEndpoint.vue b/src/components/ZclCreateModifyEndpoint.vue index 163b3f773f..5923d66c14 100644 --- a/src/components/ZclCreateModifyEndpoint.vue +++ b/src/components/ZclCreateModifyEndpoint.vue @@ -459,15 +459,11 @@ export default { // Set / unset multiple device option in mcp if (this.$store.state.zap.isMultiConfig) { if (categoryTmp === 'zigbee') { - this.enableMultipleDevice = false - this.enableParentEndpoint = false - this.enablePrimaryDevice = false - this.enableProfileId = true + this.$store.state.zap.cmpEnableZigbeeFeatures = true + this.$store.state.zap.cmpEnableMatterFeatures = false } else { - this.enableMultipleDevice = true - this.enableParentEndpoint = true - this.enablePrimaryDevice = true - this.enableProfileId = false + this.$store.state.zap.cmpEnableZigbeeFeatures = false + this.$store.state.zap.cmpEnableMatterFeatures = true } } // Create default device version if not exists diff --git a/src/store/zap/state.js b/src/store/zap/state.js index 7357c86027..b66b9a4ba5 100644 --- a/src/store/zap/state.js +++ b/src/store/zap/state.js @@ -23,6 +23,8 @@ const restApi = require('../../../src-shared/rest-api.js') export default function () { return { selectedZapConfig: null, + cmpEnableZigbeeFeatures: false, + cmpEnableMatterFeatures: false, isMultiConfig: false, isProfileIdShown: null, clusterDataForTutorial: [], diff --git a/src/util/ui-options.js b/src/util/ui-options.js index cb7836f812..9ba94e89f1 100644 --- a/src/util/ui-options.js +++ b/src/util/ui-options.js @@ -56,11 +56,27 @@ export default { } }, enableMatterFeatures() { + // Check if cmpEnableMatterFeatures is true + if (this.$store.state.zap.cmpEnableMatterFeatures) { + return true + } else if (this.$store.state.zap.cmpEnableZigbeeFeatures) { + return false + } + + // Proceed with the next set of conditions return this.zclPropertiesNonEmpty ? this.multiDeviceCategories.includes('matter') : this.multiDeviceCategories == 'matter' }, enableZigbeeFeatures() { + // Check if cmpEnableZigbeeFeatures is true + if (this.$store.state.zap.cmpEnableZigbeeFeatures) { + return true + } else if (this.$store.state.zap.cmpEnableMatterFeatures) { + return false + } + + // Proceed with the next set of conditions return this.zclPropertiesNonEmpty ? this.multiDeviceCategories.includes('zigbee') : this.multiDeviceCategories === 'zigbee' || !this.multiDeviceCategories @@ -90,7 +106,7 @@ export default { return this.enableMatterFeatures }, enableServerOnly() { - return this.enableMatterFeatures && !this.enableZigbeeFeatures + return this.enableMatterFeatures } } }