1
+ < script type ="text/x-red " data-template-name ="ldap-update in ">
2
+ < div class = "form-row" >
3
+ < label for = "node-input-name" > < i class = "icon-tag" > </ i > Name</ label >
4
+ < input type = "text" id = "node-input-name" placeholder = "Name" >
5
+ </ div >
6
+ < div class = "form-row" >
7
+ < label for = "node-input-ldap" > < i class = "fa fa-user" > </ i > Add new LDAP Server</ label >
8
+ < input type = "text" id = "node-input-ldap" >
9
+ </ div >
10
+ < div class = "form-row" >
11
+ < label for = "node-input-operation" > < i class = "fa fa-wrench" > </ i > Operation</ label >
12
+ < select type = "text" id = "node-input-operation" >
13
+ < option value = "replace" > Replace</ option >
14
+ < option value = "add" > Add</ option >
15
+ < option value = "delete" > Delete</ option >
16
+ </ select >
17
+ </ div >
18
+ < div class = "form-row" >
19
+ < label for = "node-input-dn" > DN</ label >
20
+ < input type = "text" id = "node-input-dn" placeholder = "CN=jim bob,OU=users,DC=corp,DC=com" >
21
+ </ div >
22
+ < div class = "form-row" >
23
+ < label for = "node-input-attribute" > Attribute</ label >
24
+ < input type = "text" id = "node-input-attribute" placeholder = "givenName" >
25
+ </ div >
26
+ < div class = "form-row" >
27
+ < label for = "node-input-value" > Value</ label >
28
+ < input type = "text" id = "node-input-value" placeholder = "tom" >
29
+ </ div >
30
+ </ script >
31
+
32
+ < script type ="text/javascript ">
33
+ RED . nodes . registerType ( 'ldap-update in' , {
34
+ category : 'storage-input' ,
35
+ color :"#AAAA66" ,
36
+ defaults : {
37
+ name : { value : '' } ,
38
+ ldap : { type : 'ldap' , required : true } ,
39
+ operation : { value : 'list' , required : true } ,
40
+ dn : { value : '' } ,
41
+ attribute : { value : '' } ,
42
+ value : { value : '' }
43
+ } ,
44
+ inputs : 1 ,
45
+ outputs : 1 ,
46
+ icon : "db.png" ,
47
+ label : function ( ) {
48
+ return this . name || 'ldap-update' ;
49
+ } ,
50
+ labelStyle : function ( ) {
51
+ return this . name ? 'node_label_italic' : '' ;
52
+ } ,
53
+ } ) ;
54
+ </ script >
55
+
56
+
57
+ < script type ="text/x-red " data-template-name ="ldap ">
58
+ < div class = "form-row" >
59
+ < label for = "node-config-input-host" > < i class = "fa fa-bookmark" > </ i > Host</ label >
60
+ < input type = "text" id = "node-config-input-host" placeholder = "localhost" style = "width: 40%;" />
61
+ < label for = "node-config-input-port" style = "margin-left: 10px; width: 35px; " > Port</ label >
62
+ < input type = "text" id = "node-config-input-port" placeholder = "22" style = "width:45px" >
63
+ </ div >
64
+ < div class = "form-row" >
65
+ < label for = "node-config-input-username" > < i class = "fa fa-user" > </ i > Username</ label >
66
+ < input type = "text" id = "node-config-input-username" >
67
+ </ div >
68
+ < div class = "form-row" >
69
+ < label for = "node-config-input-password" > < i class = "fa fa-key" > </ i > Password</ label >
70
+ < input type = "password" id = "node-config-input-password" >
71
+ </ div >
72
+ </ script >
73
+
74
+ < script type ="text/javascript ">
75
+ ( function ( ) {
76
+ RED . nodes . registerType ( 'ldap' , {
77
+ category : 'config' ,
78
+ defaults : {
79
+ host : { value : 'ldap://localhost' , required : true } ,
80
+ port : { value : '389' , required : true , validate : RED . validators . number ( ) } ,
81
+ } ,
82
+ credentials : {
83
+ username : { type : "text" } ,
84
+ password : { type : "password" }
85
+ } ,
86
+ exportable : false ,
87
+ label : function ( ) {
88
+ return this . host || ''
89
+ } ,
90
+ oneditsave : function ( ) {
91
+ let trimFields = [
92
+ "username" ,
93
+ "password"
94
+ ] ;
95
+ // Just in case any whitespace has crept in with the copy-paste of the fields
96
+ trimFields . forEach ( function ( field ) {
97
+ let v = $ ( "#node-config-input-" + field ) . val ( ) ;
98
+ v = v . trim ( ) ;
99
+ $ ( "#node-config-input-" + field ) . val ( v ) ;
100
+ } ) ;
101
+ }
102
+ } ) ;
103
+ } ) ( ) ;
104
+ </ script >
0 commit comments