Skip to content

Commit 59fb3fb

Browse files
committed
[rspace-os#39] Addresses suggestions re iRODS file system setup UX.
Retrieve and use default labels from system.properties.
1 parent 42827a1 commit 59fb3fb

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/main/webapp/scripts/pages/system/netfilesystem_mod.js

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
define(function() {
22

3+
var sysNetFileSysDetUrl;
4+
var sysNetfileSysDetAuthPasswd;
5+
36
var fileSystemsArray;
47

58
function loadNetFileSystemsList() {
@@ -33,6 +36,7 @@ define(function() {
3336
}
3437

3538
function setFileSystemClientTypeLabels() {
39+
3640
$.each(fileSystemsArray, function(i, fs) {
3741
if (fs.clientType === 'SAMBA') {
3842
fs.clientTypeLabel = 'SMBv1';
@@ -137,7 +141,7 @@ define(function() {
137141
$('#fileSystemDetailsSftpDirChoiceNo').prop('checked', isSftpClient && !fileSystemRequiresUserDirs(fileSystem));
138142

139143
refreshClientTypeRows();
140-
144+
141145
$('#fileSystemName').val(fileSystem.name || "");
142146
$('#fileSystemUrl').val(fileSystem.url || "");
143147

@@ -268,6 +272,15 @@ define(function() {
268272
//therefore we hide the choice from non SFTP clients but we also
269273
//have to give it a value in the UI else the UI framework throws an error on save
270274
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+
271284
const isSambaClient = $('#fileSystemClientTypeSamba').prop('checked');
272285
const isSambaSmbjClient = isSambaClient && $('#fileSystemClientTypeSambaSmbj').prop('checked');
273286
const isSftpClient = $('#fileSystemClientTypeSftp').prop('checked');
@@ -296,12 +309,14 @@ define(function() {
296309
if (isSambaClient) {
297310
$('#fileSystemAuthTypePassword').click();
298311
}
299-
312+
300313
if (isSambaClient || isSambaSmbjClient) {
301314
$('#fileSystemUrl')
302315
.attr('title', 'Samba server URL should start with smb://')
303316
.attr('pattern', '^smb://.*');
304317
$("label[for='fileSystemAuthTypePubKey']").show();
318+
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
319+
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
305320
} else if (isIrodsClient) {
306321
$('#fileSystemAuthTypePassword').click();
307322
$('#fileSystemUrl')
@@ -313,6 +328,8 @@ define(function() {
313328
} else {
314329
$('#fileSystemUrl').removeAttr('title').removeAttr('pattern');
315330
$("label[for='fileSystemAuthTypePubKey']").show();
331+
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
332+
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
316333
}
317334
}
318335

@@ -323,7 +340,8 @@ define(function() {
323340
$('#fileSystemPubKeyRegistrationUrl').prop('required', isPubKeyAuth);
324341
}
325342

326-
$(document).ready(function() {
343+
$(document).ready(function() {
344+
327345
$(document).on('click', '#netFileSystemLink', loadNetFileSystemsList);
328346
$(document).on('click', '.fileSystemDetailsButton', showFileSystemDetails);
329347
$(document).on('click', '.fileSystemDeleteButton', deleteFileSystem);

0 commit comments

Comments
 (0)