1
1
define ( function ( ) {
2
2
3
+ var sysNetFileSysDetUrl ;
4
+ var sysNetfileSysDetAuthPasswd ;
5
+
3
6
var fileSystemsArray ;
4
7
5
8
function loadNetFileSystemsList ( ) {
@@ -33,6 +36,7 @@ define(function() {
33
36
}
34
37
35
38
function setFileSystemClientTypeLabels ( ) {
39
+
36
40
$ . each ( fileSystemsArray , function ( i , fs ) {
37
41
if ( fs . clientType === 'SAMBA' ) {
38
42
fs . clientTypeLabel = 'SMBv1' ;
@@ -137,7 +141,7 @@ define(function() {
137
141
$ ( '#fileSystemDetailsSftpDirChoiceNo' ) . prop ( 'checked' , isSftpClient && ! fileSystemRequiresUserDirs ( fileSystem ) ) ;
138
142
139
143
refreshClientTypeRows ( ) ;
140
-
144
+
141
145
$ ( '#fileSystemName' ) . val ( fileSystem . name || "" ) ;
142
146
$ ( '#fileSystemUrl' ) . val ( fileSystem . url || "" ) ;
143
147
@@ -268,6 +272,15 @@ define(function() {
268
272
//therefore we hide the choice from non SFTP clients but we also
269
273
//have to give it a value in the UI else the UI framework throws an error on save
270
274
function refreshClientTypeRows ( ) {
275
+
276
+ // retrieve default label values from system.properties
277
+ if ( sysNetFileSysDetUrl === undefined ) {
278
+ sysNetFileSysDetUrl = $ ( "label[for='fileSystemUrl']" ) . text ( ) ;
279
+ }
280
+ if ( sysNetfileSysDetAuthPasswd === undefined ) {
281
+ sysNetfileSysDetAuthPasswd = $ ( '#fileSystemAuthTypePasswordSpan' ) . text ( ) ;
282
+ }
283
+
271
284
const isSambaClient = $ ( '#fileSystemClientTypeSamba' ) . prop ( 'checked' ) ;
272
285
const isSambaSmbjClient = isSambaClient && $ ( '#fileSystemClientTypeSambaSmbj' ) . prop ( 'checked' ) ;
273
286
const isSftpClient = $ ( '#fileSystemClientTypeSftp' ) . prop ( 'checked' ) ;
@@ -296,12 +309,14 @@ define(function() {
296
309
if ( isSambaClient ) {
297
310
$ ( '#fileSystemAuthTypePassword' ) . click ( ) ;
298
311
}
299
-
312
+
300
313
if ( isSambaClient || isSambaSmbjClient ) {
301
314
$ ( '#fileSystemUrl' )
302
315
. attr ( 'title' , 'Samba server URL should start with smb://' )
303
316
. attr ( 'pattern' , '^smb://.*' ) ;
304
317
$ ( "label[for='fileSystemAuthTypePubKey']" ) . show ( ) ;
318
+ $ ( '#fileSystemAuthTypePasswordSpan' ) . text ( sysNetfileSysDetAuthPasswd ) ;
319
+ $ ( "label[for='fileSystemUrl']" ) . text ( sysNetFileSysDetUrl ) ;
305
320
} else if ( isIrodsClient ) {
306
321
$ ( '#fileSystemAuthTypePassword' ) . click ( ) ;
307
322
$ ( '#fileSystemUrl' )
@@ -313,6 +328,8 @@ define(function() {
313
328
} else {
314
329
$ ( '#fileSystemUrl' ) . removeAttr ( 'title' ) . removeAttr ( 'pattern' ) ;
315
330
$ ( "label[for='fileSystemAuthTypePubKey']" ) . show ( ) ;
331
+ $ ( '#fileSystemAuthTypePasswordSpan' ) . text ( sysNetfileSysDetAuthPasswd ) ;
332
+ $ ( "label[for='fileSystemUrl']" ) . text ( sysNetFileSysDetUrl ) ;
316
333
}
317
334
}
318
335
@@ -323,7 +340,8 @@ define(function() {
323
340
$ ( '#fileSystemPubKeyRegistrationUrl' ) . prop ( 'required' , isPubKeyAuth ) ;
324
341
}
325
342
326
- $ ( document ) . ready ( function ( ) {
343
+ $ ( document ) . ready ( function ( ) {
344
+
327
345
$ ( document ) . on ( 'click' , '#netFileSystemLink' , loadNetFileSystemsList ) ;
328
346
$ ( document ) . on ( 'click' , '.fileSystemDetailsButton' , showFileSystemDetails ) ;
329
347
$ ( document ) . on ( 'click' , '.fileSystemDeleteButton' , deleteFileSystem ) ;
0 commit comments