@@ -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
94100export 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 */
117126export 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