12
12
< input type = "checkbox" id = "node-config-input-tls" style = "display:inline-block; width:auto; vertical-align:top;" >
13
13
< label for = "node-config-input-tls" style = "width:auto !important;" > Encrypt connection to database</ label >
14
14
</ div >
15
+ < div class = "form-row" >
16
+ < label for = "node-config-input-rejectUnauthorized" > </ label >
17
+ < input type = "checkbox" id = "node-config-input-rejectUnauthorized"
18
+ style = "display:inline-block; width:auto; vertical-align:top;" >
19
+ < label for = "node-config-input-rejectUnauthorized" style = "width:auto !important;" > Verify certificate
20
+ (recommended)</ label >
21
+ </ div >
22
+ < div class = "form-row" >
23
+ < label for = "node-config-input-caCertificate" > < i class = "fa fa-certificate" > </ i > CA-Cert.</ label >
24
+ < input type = "text" id = "node-config-input-caCertificate" >
25
+ </ div >
26
+ < div class = "form-row" >
27
+ < label for = "node-config-input-cert" > < i class = "fa fa-certificate" > </ i > Cert</ label >
28
+ < input type = "text" id = "node-config-input-cert" >
29
+ </ div >
30
+ < div class = "form-row" >
31
+ < label for = "node-config-input-key" > < i class = "fa fa-key" > </ i > Key</ label >
32
+ < input type = "text" id = "node-config-input-key" >
33
+ </ div >
15
34
< div class = "form-row" >
16
35
< label for = "node-config-input-user" > < i class = "fa fa-user" > </ i > User</ label >
17
36
< input type = "text" id = "node-config-input-user" >
49
68
value : true ,
50
69
required : true
51
70
} ,
71
+ rejectUnauthorized : {
72
+ value : true ,
73
+ required : true
74
+ } ,
75
+ caCertificate : {
76
+ value : "" ,
77
+ required : false
78
+ } ,
79
+ cert : {
80
+ value : "" ,
81
+ required : false
82
+ } ,
83
+ key : {
84
+ value : "" ,
85
+ required : false
86
+ } ,
52
87
database : {
53
88
value : "" ,
54
89
required : true
65
100
// Note: label (and probably labelStyle) have to be a classical function (not an arrow function)
66
101
label : function ( ) {
67
102
return this . name || this . database
103
+ } ,
104
+ oneditprepare : function ( ) {
105
+ function toggleTlsFields ( show ) {
106
+ $ ( "#node-config-input-caCertificate" ) . closest ( 'div' ) . toggle ( show ) ;
107
+ $ ( "#node-config-input-cert" ) . closest ( 'div' ) . toggle ( show ) ;
108
+ $ ( "#node-config-input-key" ) . closest ( 'div' ) . toggle ( show ) ;
109
+ $ ( "#node-config-input-rejectUnauthorized" ) . closest ( 'div' ) . toggle ( show ) ;
110
+ }
111
+
112
+ const tlsCheckbox = $ ( "#node-config-input-tls" ) ;
113
+ tlsCheckbox . on ( 'change' , function ( ) {
114
+ toggleTlsFields ( this . checked ) ;
115
+ } ) ;
116
+
117
+ toggleTlsFields ( tlsCheckbox . prop ( 'checked' ) ) ;
68
118
}
69
119
} ) ;
70
120
</ script >
@@ -162,4 +212,4 @@ <h3>References</h3>
162
212
return this . name ? 'node_label_italic' : ''
163
213
}
164
214
} ) ;
165
- </ script >
215
+ </ script >
0 commit comments