Skip to content

Commit 119c784

Browse files
author
Jing T
authored
fix Studio integration issue with SDK extension affilited components (#848)
* fix Notify message when SDK/UC component are updated * fix UC component status display in Cluster view BUG: ZAPP-1040
1 parent a69d58e commit 119c784

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

apack.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Graphical configuration tool for application and libraries based on Zigbee Cluster Library.",
55
"path": [".", "node_modules/.bin/", "ZAP.app/Contents/MacOS"],
66
"requiredFeatureLevel": "apack.core:9",
7-
"featureLevel": 88,
7+
"featureLevel": 89,
88
"uc.triggerExtension": "zap",
99
"executable": {
1010
"zap:win32.x86_64": {

src/util/util.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ export function notifyComponentUpdateStatus(componentIdStates, added) {
7272
let msg = `<div><strong>The following components ${verb} ${action}.</strong></div>`
7373
msg += `<div><span style="text-transform: capitalize"><ul>`
7474
msg += components
75-
.map((id) => `<li>${id.replace(/_/g, ' ')}</li>`)
75+
.map((id) => {
76+
if (id.lastIndexOf('%') != -1) {
77+
id = id.substring(id.lastIndexOf('%') + 1)
78+
}
79+
80+
return `<li>${id.replace(/_/g, ' ')}</li>`
81+
})
7682
.join(' ')
7783
msg += `</ul></span></div>`
7884

@@ -93,31 +99,40 @@ export function getSelectedUcComponents(ucComponentList) {
9399

94100
export function getUcComponents(ucComponentTreeResponse) {
95101
// computed selected Nodes
96-
let selected = []
102+
let selectedComponents = []
97103
if (ucComponentTreeResponse) {
98104
ucComponentTreeResponse.filter(function f(e) {
99105
if (e.children) {
100106
e.children.filter(f, this)
101107
}
102108

103-
if (e.id && e.id.includes('zigbee_')) {
109+
if (e.id && (e.id.includes('zigbee_') || e.id.includes('extension-'))) {
104110
this.push(e)
105111
}
106-
}, selected)
112+
}, selectedComponents)
107113
}
108-
return selected
114+
return selectedComponents
109115
}
110116

111117
/**
112-
* Extract cluster id string "$cluster" from the internal Uc Component Id
118+
* Extract a list of cluster id from a list of Uc component id
113119
*
114-
* e.g. "zigbee_basic" from "studiocomproot-Zigbee-Cluster_Library-Common-zigbee_basic"
120+
* return: a list of ids
121+
* id value example:
122+
* "zigbee_basic" from "studiocomproot-Zigbee-Cluster_Library-Common-zigbee_basic"
123+
"%extension-matter%matter_level_control" from "matter:1.0.0-Matter-Clusters-%extension-matter%matter_level_control"
115124
* @param {*} ucComponentIds - an array of ids
116125
*/
117126
export function getClusterIdsByUcComponents(ucComponents) {
118127
return ucComponents
119-
.map((x) => x.id)
120-
.map((x) => x.substr(x.lastIndexOf('-') + 1))
128+
.map((component) => component.id)
129+
.map((id) => {
130+
if (id.includes('zigbee')) {
131+
return id.substr(id.lastIndexOf('-') + 1)
132+
} else if (id.includes('%extension-')) {
133+
return id.substr(id.lastIndexOf('%extension-'))
134+
}
135+
})
121136
}
122137

123138
/**

0 commit comments

Comments
 (0)