Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRT-876: fix saving on samba/sftp file systems on System page #262

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/webapp/WEB-INF/pages/system/netfilesystem_ajax.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@
<tr class="fileSystemDetailsIrodsZoneRow">
<td><label for="fileSystemIrodsZone">
<spring:message code="system.netfilesystem.details.client.irods.zone" /></label></td>
<td><input id="fileSystemIrodsZone" type="text" style="width: 20em" required/></td>
<td><input id="fileSystemIrodsZone" type="text" style="width: 20em" /></td>
</tr>
<tr class="fileSystemDetailsIrodsHomeDirRow">
<td><label for="fileSystemIrodsHomeDir">
<spring:message code="system.netfilesystem.details.client.irods.homedir" /></label></td>
<td><input id="fileSystemIrodsHomeDir" type="text" style="width: 20em" required/></td>
<td><input id="fileSystemIrodsHomeDir" type="text" style="width: 20em" /></td>
</tr>
<tr class="fileSystemDetailsIrodsPortRow">
<td><label for="fileSystemIrodsPort">
Expand Down Expand Up @@ -178,7 +178,7 @@
<tr class="fileSystemDetailsIrodsAuthRow">
<td><label><spring:message code="system.netfilesystem.details.client.irods.auth" /></label></td>
<td>
<label><input type="radio" id="iRODSfileSystemAuthTypeNative" name="iRODSfileSystemAuthType" value="NATIVE" required>
<label><input type="radio" id="iRODSfileSystemAuthTypeNative" name="iRODSfileSystemAuthType" value="NATIVE">
<span id="iRODSfileSystemAuthTypeNativeSpan"><spring:message code="system.netfilesystem.details.client.irods.auth.native" /></span></label>
<label><input type="radio" id="iRODSfileSystemAuthTypePAM" name="iRODSfileSystemAuthType" value="PAM">
<span id="iRODSfileSystemAuthTypePAMSpan"><spring:message code="system.netfilesystem.details.client.irods.auth.pam" /></span></label>
Expand Down
53 changes: 26 additions & 27 deletions src/main/webapp/scripts/pages/system/netfilesystem_mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ define(function() {
$('#fileSystemIrodsZone').val(clientOptions.IRODS_ZONE);
$('#fileSystemIrodsHomeDir').val(clientOptions.IRODS_HOME_DIR);
$('#fileSystemIrodsPort').val(clientOptions.IRODS_PORT);
$('#fileSystemIrodsCsneg').val(clientOptions.IRODS_CSNEG);
$('#fileSystemIrodsCsneg').val(clientOptions.IRODS_CSNEG);
}

var isPasswordAuth = isExistingFileSystem && fileSystem.authType === 'PASSWORD';
Expand All @@ -174,18 +174,17 @@ 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.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) {
Expand Down Expand Up @@ -316,34 +315,34 @@ define(function() {
$('.fileSystemDetailsIrodsHomeDirRow').toggle(isIrodsClient);
$('.fileSystemDetailsIrodsPortRow').toggle(isIrodsClient);
$('.fileSystemDetailsIrodsCsnegRow').toggle(isIrodsClient);
$('.fileSystemDetailsIrodsAuthRow').toggle(isIrodsClient);

$('#fileSystemAuthTypePubKey').prop('disabled', isSambaClient);
if (isSambaClient) {
$('.fileSystemDetailsIrodsAuthRow').toggle(isIrodsClient);

$('#fileSystemIrodsZone').prop('required', isIrodsClient);
$('#fileSystemIrodsHomeDir').prop('required', isIrodsClient);
$('#iRODSfileSystemAuthTypeNative').prop('required', isIrodsClient);
$('#iRODSfileSystemAuthTypePAM').prop('required', isIrodsClient);

$('#fileSystemAuthTypePubKey').prop('disabled', isSambaClient || isSambaSmbjClient);
$("label[for='fileSystemAuthTypePubKey']").toggle(!isIrodsClient);
if (isSambaClient || isIrodsClient) {
$('#fileSystemAuthTypePassword').click();
}
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
if (isIrodsClient) {
$("label[for='fileSystemUrl']").text('iRODS Host');
}

if (isSambaClient || isSambaSmbjClient) {
$('#fileSystemUrl')
.attr('title', 'Samba server URL should start with smb://')
.attr('pattern', '^smb://.*');
$("label[for='fileSystemAuthTypePubKey']").show();
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
} else if (isIrodsClient) {
$('#fileSystemAuthTypePassword').click();
$('#fileSystemUrl')
.removeAttr('pattern')
.attr('title', 'iRODS hostname or IP without protocol');
$("label[for='fileSystemUrl']").text('iRODS Host');
$("label[for='fileSystemAuthTypePubKey']").hide();
//$('#fileSystemAuthTypePasswordSpan').text('Native');
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
} else {
$('#fileSystemUrl').removeAttr('title').removeAttr('pattern');
$("label[for='fileSystemAuthTypePubKey']").show();
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
}
}

Expand Down