@@ -57,7 +57,6 @@ export class NodeBindingDialog extends LitElement {
57
57
private fetchACLEntry ( targetNodeId : number ) : AccessControlEntryStruct [ ] {
58
58
const acl_cluster_raw : [ InputType ] =
59
59
this . client . nodes [ targetNodeId ] . attributes [ "0/31/0" ] ;
60
-
61
60
return Object . values ( acl_cluster_raw ) . map ( ( value : InputType ) =>
62
61
AccessControlEntryDataTransformer . transform ( value ) ,
63
62
) ;
@@ -67,9 +66,10 @@ export class NodeBindingDialog extends LitElement {
67
66
const rawBindings = this . fetchBindingEntry ( ) ;
68
67
try {
69
68
const targetNodeId = rawBindings [ index ] . node ;
69
+ const endpoint = rawBindings [ index ] . endpoint ;
70
70
await this . removeNodeAtACLEntry (
71
71
this . node ! . node_id ,
72
- this . endpoint ,
72
+ endpoint ,
73
73
targetNodeId ,
74
74
) ;
75
75
const updatedBindings = this . removeBindingAtIndex ( rawBindings , index ) ;
@@ -92,23 +92,21 @@ export class NodeBindingDialog extends LitElement {
92
92
)
93
93
. filter ( ( entry ) : entry is Exclude < typeof entry , null > => entry !== null ) ;
94
94
95
- console . log ( updatedACLEntries ) ;
96
95
await this . client . setACLEntry ( targetNodeId , updatedACLEntries ) ;
97
96
}
98
97
99
98
private removeEntryAtACL (
100
99
nodeId : number ,
101
100
sourceEndpoint : number ,
102
101
entry : AccessControlEntryStruct ,
103
- ) : AccessControlEntryStruct | null {
102
+ ) : AccessControlEntryStruct | undefined {
104
103
const hasSubject = entry . subjects ! . includes ( nodeId ) ;
105
-
106
104
if ( ! hasSubject ) return entry ;
107
105
108
106
const hasTarget = entry . targets ! . filter (
109
107
( item ) => item . endpoint === sourceEndpoint ,
110
108
) ;
111
- return hasTarget . length > 0 ? null : entry ;
109
+ return hasTarget . length > 0 ? undefined : entry ;
112
110
}
113
111
114
112
private removeBindingAtIndex (
@@ -216,7 +214,7 @@ export class NodeBindingDialog extends LitElement {
216
214
return ;
217
215
}
218
216
if ( isNaN ( targetCluster ) || targetCluster < 0 ) {
219
- alert ( "Please enter a valid target endpoint " ) ;
217
+ alert ( "Please enter a valid target cluster " ) ;
220
218
return ;
221
219
}
222
220
@@ -234,7 +232,10 @@ export class NodeBindingDialog extends LitElement {
234
232
fabricIndex : this . client . connection . serverInfo ! . fabric_id ,
235
233
} ;
236
234
const result_acl = await this . add_target_acl ( targetNodeId , acl_entry ) ;
237
- if ( ! result_acl ) return ;
235
+ if ( ! result_acl ) {
236
+ alert ( "add target acl error!" ) ;
237
+ return ;
238
+ }
238
239
239
240
const endpoint = this . endpoint ;
240
241
const bindingEntry : BindingEntryStruct = {
0 commit comments