From 0f0d45f6a041050eb53878ea8af7bbfe292cff23 Mon Sep 17 00:00:00 2001 From: Leonardo Lenoci Date: Fri, 28 Jun 2024 17:00:56 +0200 Subject: [PATCH 1/3] [39] Addresses suggestions re iRODS file system setup UX --- .../com/researchspace/netfiles/NfsFactory.java | 8 +++++++- .../resources/bundles/system/system.properties | 2 +- .../WEB-INF/pages/system/netfilesystem_ajax.jsp | 8 ++++---- .../scripts/pages/system/netfilesystem_mod.js | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/researchspace/netfiles/NfsFactory.java b/src/main/java/com/researchspace/netfiles/NfsFactory.java index 239684429..4bf521131 100644 --- a/src/main/java/com/researchspace/netfiles/NfsFactory.java +++ b/src/main/java/com/researchspace/netfiles/NfsFactory.java @@ -89,10 +89,16 @@ public NfsClient getNfsClient(String nfsusername, String nfspassword, NfsFileSys fileSystem.getClientOption(NfsFileSystemOption.SFTP_SERVER_PUBLIC_KEY)); } if (NfsClientType.IRODS.equals(clientType)) { + int irodsPort; + if (StringUtils.isEmpty(fileSystem.getClientOption(NfsFileSystemOption.IRODS_PORT))) { + irodsPort = 1247; + } else { + irodsPort = Integer.parseInt(fileSystem.getClientOption(NfsFileSystemOption.IRODS_PORT)); + } return new IRODSClient( new IRODSAccount( fileSystem.getUrl(), - Integer.parseInt(fileSystem.getClientOption(NfsFileSystemOption.IRODS_PORT)), + irodsPort, nfsusername, nfspassword, fileSystem.getClientOption(NfsFileSystemOption.IRODS_HOME_DIR), diff --git a/src/main/resources/bundles/system/system.properties b/src/main/resources/bundles/system/system.properties index 4cd8c632a..2cecccbf9 100644 --- a/src/main/resources/bundles/system/system.properties +++ b/src/main/resources/bundles/system/system.properties @@ -277,7 +277,7 @@ system.netfilesystem.details.client.sftp.server.public.key=SFTP server public ke system.netfilesystem.details.client.sftp.server.dir.choice=User subdirectory required system.netfilesystem.details.client.irods=iRODS system.netfilesystem.details.client.irods.zone=iRODS Zone -system.netfilesystem.details.client.irods.homedir=Home Directory +system.netfilesystem.details.client.irods.homedir=iRODS Search Path system.netfilesystem.details.client.irods.port= iRODS Port system.netfilesystem.details.auth=Authentication Type system.netfilesystem.details.auth.password=Username/Password diff --git a/src/main/webapp/WEB-INF/pages/system/netfilesystem_ajax.jsp b/src/main/webapp/WEB-INF/pages/system/netfilesystem_ajax.jsp index a6720bf80..86313a724 100644 --- a/src/main/webapp/WEB-INF/pages/system/netfilesystem_ajax.jsp +++ b/src/main/webapp/WEB-INF/pages/system/netfilesystem_ajax.jsp @@ -123,12 +123,12 @@ - + - + + + + + + + + + + + + @@ -162,6 +174,18 @@ + + + + + + + + + + diff --git a/src/main/webapp/scripts/pages/system/netfilesystem_mod.js b/src/main/webapp/scripts/pages/system/netfilesystem_mod.js index 1a4421746..58e1533db 100644 --- a/src/main/webapp/scripts/pages/system/netfilesystem_mod.js +++ b/src/main/webapp/scripts/pages/system/netfilesystem_mod.js @@ -157,12 +157,12 @@ define(function() { $('#fileSystemSambaDomain').val(clientOptions.SAMBA_DOMAIN); $('#fileSystemSambaShare').val(clientOptions.SAMBA_SHARE_NAME); } else if (isSftpClient) { - // $('#fileSystemDetailsSftpDirChoiceRow').show(); $('#fileSystemSftpServerPublicKey').val(clientOptions.SFTP_SERVER_PUBLIC_KEY); } else if(isIrodsClient) { $('#fileSystemIrodsZone').val(clientOptions.IRODS_ZONE); $('#fileSystemIrodsHomeDir').val(clientOptions.IRODS_HOME_DIR); $('#fileSystemIrodsPort').val(clientOptions.IRODS_PORT); + $('#fileSystemIrodsCsneg').val(clientOptions.IRODS_CSNEG); } var isPasswordAuth = isExistingFileSystem && fileSystem.authType === 'PASSWORD'; @@ -174,6 +174,19 @@ define(function() { $('#fileSystemPubKeyRegistrationUrl').val(""); + + if (fileSystem.clientType === 'IRODS'){ + var rows = fileSystem.clientOptions.split('\n'); + for (var i = 0; i < rows.length; i++) { + var currRow = rows[i]; + var currRowValue = currRow.substring(currRow.indexOf('=') + 1); + if (currRow.indexOf('IRODS_AUTH') === 0) { + $('#iRODSfileSystemAuthTypeNative').prop('checked', currRowValue === 'NATIVE'); + $('#iRODSfileSystemAuthTypePAM').prop('checked', currRowValue === 'PAM'); + } + } + } + if (fileSystem.authOptions) { if (isPubKeyAuth) { var rows = fileSystem.authOptions.split('\n'); @@ -236,9 +249,7 @@ define(function() { clientOptions +="\nUSER_DIRS_REQUIRED=" + dirsRequired; } } else if (clientType === 'IRODS') { - clientOptions = "IRODS_ZONE=" + $('#fileSystemIrodsZone').val() - + "\nIRODS_HOME_DIR=" + $('#fileSystemIrodsHomeDir').val() - + "\nIRODS_PORT=" + $('#fileSystemIrodsPort').val(); + clientOptions = "IRODS_ZONE=" + $('#fileSystemIrodsZone').val() + "\nIRODS_HOME_DIR=" + $('#fileSystemIrodsHomeDir').val() + "\nIRODS_PORT=" + $('#fileSystemIrodsPort').val()+"\nIRODS_CSNEG=" + $('#fileSystemIrodsCsneg').val()+"\nIRODS_AUTH=" + $('input[name="iRODSfileSystemAuthType"]:checked').val()+"\n"; } var fileSystem = { @@ -251,7 +262,7 @@ define(function() { clientOptions: clientOptions, authOptions: authOptions }; - console.log("File System:", fileSystem); + //console.log("File System:", fileSystem); RS.blockPage("Saving..."); var jqxhr = RS.sendJsonPostRequestToUrl('/system/netfilesystem/save', fileSystem); jqxhr.done(function() { @@ -304,7 +315,9 @@ define(function() { $('.fileSystemDetailsIrodsZoneRow').toggle(isIrodsClient); $('.fileSystemDetailsIrodsHomeDirRow').toggle(isIrodsClient); $('.fileSystemDetailsIrodsPortRow').toggle(isIrodsClient); - + $('.fileSystemDetailsIrodsCsnegRow').toggle(isIrodsClient); + $('.fileSystemDetailsIrodsAuthRow').toggle(isIrodsClient); + $('#fileSystemAuthTypePubKey').prop('disabled', isSambaClient); if (isSambaClient) { $('#fileSystemAuthTypePassword').click(); @@ -323,8 +336,9 @@ define(function() { .removeAttr('pattern') .attr('title', 'iRODS hostname or IP without protocol'); $("label[for='fileSystemUrl']").text('iRODS Host'); - $("label[for='fileSystemAuthTypePubKey']").hide(); - $('#fileSystemAuthTypePasswordSpan').text('Native'); + $("label[for='fileSystemAuthTypePubKey']").hide(); + //$('#fileSystemAuthTypePasswordSpan').text('Native'); + $('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd); } else { $('#fileSystemUrl').removeAttr('title').removeAttr('pattern'); $("label[for='fileSystemAuthTypePubKey']").show();