Skip to content

Commit 7fa6886

Browse files
committed
Showing the correct UI based on category from json files when there is only one zcl and template package and user does not have any packages to select from.
JIRA: ZAPP-1346
1 parent a4b36ad commit 7fa6886

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/util/ui-options.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export default {
3535
}
3636
},
3737
mounted() {
38-
const zclProperties = this.$store.state.zap.selectedZapConfig?.zclProperties
38+
const zapState = this.$store.state.zap
39+
const zclProperties = zapState.selectedZapConfig?.zclProperties
3940
let multiDeviceCategories = []
4041
let enableMatterFeatures = false
4142
let enableZigbeeFeatures = false
@@ -44,8 +45,20 @@ export default {
4445
enableMatterFeatures = multiDeviceCategories.includes('matter')
4546
enableZigbeeFeatures = multiDeviceCategories.includes('zigbee')
4647
} else {
47-
multiDeviceCategories =
48-
this.$store.state.zap.selectedZapConfig?.zclProperties?.category
48+
let selectedZapConfig = zapState.selectedZapConfig
49+
multiDeviceCategories = selectedZapConfig?.zclProperties?.category
50+
// the use case when there is only one zcl and template package and user
51+
// does not have any packages to select from.
52+
if (
53+
!multiDeviceCategories &&
54+
selectedZapConfig &&
55+
selectedZapConfig.zclProperties &&
56+
selectedZapConfig.zclProperties.length == 0 &&
57+
zapState.packages &&
58+
zapState.packages.length > 0
59+
) {
60+
multiDeviceCategories = zapState.packages[0]?.sessionPackage?.category
61+
}
4962
enableMatterFeatures = multiDeviceCategories == 'matter'
5063
// Showing zigbee UI by default when category is not defined
5164
enableZigbeeFeatures =

0 commit comments

Comments
 (0)