@@ -5,7 +5,7 @@ import "@material/web/divider/divider";
5
5
import "@material/web/iconbutton/icon-button" ;
6
6
import "@material/web/list/list" ;
7
7
import "@material/web/list/list-item" ;
8
- import { mdiChatProcessing , mdiTrashCan , mdiUpdate } from "@mdi/js" ;
8
+ import { mdiChatProcessing , mdiShareVariant , mdiTrashCan , mdiUpdate } from "@mdi/js" ;
9
9
import { LitElement , css , html , nothing } from "lit" ;
10
10
import { customElement , property , state } from "lit/decorators.js" ;
11
11
import { MatterClient } from "../../client/client" ;
@@ -85,11 +85,12 @@ export class NodeDetails extends LitElement {
85
85
}
86
86
</ md- lis t- item>
87
87
<md- lis t- item class= "btn" >
88
- <span>
89
88
<md- outlined- butto n @click = ${ this . _reinterview } > Interview <ha- svg- icon slot= "icon" .path = ${ mdiChatProcessing } > </ ha- svg- icon> </ md- outlined- butto n>
90
- ${ this . node . updateStateProgress != null || this . _updateInitiated ? html `
91
- <md- outlined- butto n dis abled> Update (${ this . node . updateStateProgress || 0 } %)<ha- svg- icon slot= "icon" .path = ${ mdiUpdate } > </ ha- svg- icon> </ md- outlined- butto n> `
89
+ ${ this . _updateInitiated || ( this . node . updateState || 0 ) > 1 ? html `
90
+ <md- outlined- butto n dis abled> Update in progress (${ this . node . updateStateProgress || 0 } %)<ha- svg- icon slot= "icon" .path = ${ mdiUpdate } > </ ha- svg- icon> </ md- outlined- butto n> `
92
91
: html `<md- outlined- butto n @click = ${ this . _searchUpdate } > Update <ha- svg- icon slot= "icon" .path = ${ mdiUpdate } > </ ha- svg- icon> </ md- outlined- butto n> ` }
92
+
93
+ <md- outlined- butto n @click = ${ this . _openCommissioningWindow } > Share <ha- svg- icon slot= "icon" .path = ${ mdiShareVariant } > </ ha- svg- icon> </ md- outlined- butto n>
93
94
<md- outlined- butto n @click = ${ this . _remove } > Remove <ha- svg- icon slot= "icon" .path = ${ mdiTrashCan } > </ ha- svg- icon> </ md- outlined- butto n>
94
95
</ md- lis t- item>
95
96
</ md- lis t>
@@ -178,6 +179,30 @@ export class NodeDetails extends LitElement {
178
179
}
179
180
}
180
181
182
+ private async _openCommissioningWindow ( ) {
183
+ if (
184
+ ! ( await showPromptDialog ( {
185
+ title : "Share device" ,
186
+ text : "Do you want to share this device with another Matter controller (open commissioning window)?" ,
187
+ confirmText : "Share" ,
188
+ } ) )
189
+ ) {
190
+ return ;
191
+ }
192
+ try {
193
+ const shareCode = await this . client . openCommissioningWindow ( this . node ! . node_id ) ;
194
+ showAlertDialog ( {
195
+ title : "Share device" ,
196
+ text : `Setup code: ${ shareCode . setup_manual_code } ` ,
197
+ } ) ;
198
+ } catch ( err : any ) {
199
+ showAlertDialog ( {
200
+ title : "Failed to open commissioning window on node" ,
201
+ text : err . message ,
202
+ } ) ;
203
+ }
204
+ }
205
+
181
206
static styles = css `
182
207
.btn {
183
208
--md-outlined-button-container-shape : 0px ;
0 commit comments