Skip to content

Commit 50a98ad

Browse files
authored
PRT-876: fix saving of new Samba/SFTP file systems on System page (#262)
- set 'required' prop on irods fields only when setting irods - minor refactoring
1 parent 2379a2a commit 50a98ad

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

src/main/webapp/WEB-INF/pages/system/netfilesystem_ajax.jsp

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@
123123
<tr class="fileSystemDetailsIrodsZoneRow">
124124
<td><label for="fileSystemIrodsZone">
125125
<spring:message code="system.netfilesystem.details.client.irods.zone" /></label></td>
126-
<td><input id="fileSystemIrodsZone" type="text" style="width: 20em" required/></td>
126+
<td><input id="fileSystemIrodsZone" type="text" style="width: 20em" /></td>
127127
</tr>
128128
<tr class="fileSystemDetailsIrodsHomeDirRow">
129129
<td><label for="fileSystemIrodsHomeDir">
130130
<spring:message code="system.netfilesystem.details.client.irods.homedir" /></label></td>
131-
<td><input id="fileSystemIrodsHomeDir" type="text" style="width: 20em" required/></td>
131+
<td><input id="fileSystemIrodsHomeDir" type="text" style="width: 20em" /></td>
132132
</tr>
133133
<tr class="fileSystemDetailsIrodsPortRow">
134134
<td><label for="fileSystemIrodsPort">
@@ -178,7 +178,7 @@
178178
<tr class="fileSystemDetailsIrodsAuthRow">
179179
<td><label><spring:message code="system.netfilesystem.details.client.irods.auth" /></label></td>
180180
<td>
181-
<label><input type="radio" id="iRODSfileSystemAuthTypeNative" name="iRODSfileSystemAuthType" value="NATIVE" required>
181+
<label><input type="radio" id="iRODSfileSystemAuthTypeNative" name="iRODSfileSystemAuthType" value="NATIVE">
182182
<span id="iRODSfileSystemAuthTypeNativeSpan"><spring:message code="system.netfilesystem.details.client.irods.auth.native" /></span></label>
183183
<label><input type="radio" id="iRODSfileSystemAuthTypePAM" name="iRODSfileSystemAuthType" value="PAM">
184184
<span id="iRODSfileSystemAuthTypePAMSpan"><spring:message code="system.netfilesystem.details.client.irods.auth.pam" /></span></label>

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

+26-27
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ define(function() {
162162
$('#fileSystemIrodsZone').val(clientOptions.IRODS_ZONE);
163163
$('#fileSystemIrodsHomeDir').val(clientOptions.IRODS_HOME_DIR);
164164
$('#fileSystemIrodsPort').val(clientOptions.IRODS_PORT);
165-
$('#fileSystemIrodsCsneg').val(clientOptions.IRODS_CSNEG);
165+
$('#fileSystemIrodsCsneg').val(clientOptions.IRODS_CSNEG);
166166
}
167167

168168
var isPasswordAuth = isExistingFileSystem && fileSystem.authType === 'PASSWORD';
@@ -174,18 +174,17 @@ define(function() {
174174

175175
$('#fileSystemPubKeyRegistrationUrl').val("");
176176

177-
178-
if (fileSystem.clientType === 'IRODS'){
179-
var rows = fileSystem.clientOptions.split('\n');
180-
for (var i = 0; i < rows.length; i++) {
181-
var currRow = rows[i];
182-
var currRowValue = currRow.substring(currRow.indexOf('=') + 1);
183-
if (currRow.indexOf('IRODS_AUTH') === 0) {
184-
$('#iRODSfileSystemAuthTypeNative').prop('checked', currRowValue === 'NATIVE');
185-
$('#iRODSfileSystemAuthTypePAM').prop('checked', currRowValue === 'PAM');
186-
}
177+
if (fileSystem.clientType === 'IRODS'){
178+
var rows = fileSystem.clientOptions.split('\n');
179+
for (var i = 0; i < rows.length; i++) {
180+
var currRow = rows[i];
181+
var currRowValue = currRow.substring(currRow.indexOf('=') + 1);
182+
if (currRow.indexOf('IRODS_AUTH') === 0) {
183+
$('#iRODSfileSystemAuthTypeNative').prop('checked', currRowValue === 'NATIVE');
184+
$('#iRODSfileSystemAuthTypePAM').prop('checked', currRowValue === 'PAM');
187185
}
188-
}
186+
}
187+
}
189188

190189
if (fileSystem.authOptions) {
191190
if (isPubKeyAuth) {
@@ -316,34 +315,34 @@ define(function() {
316315
$('.fileSystemDetailsIrodsHomeDirRow').toggle(isIrodsClient);
317316
$('.fileSystemDetailsIrodsPortRow').toggle(isIrodsClient);
318317
$('.fileSystemDetailsIrodsCsnegRow').toggle(isIrodsClient);
319-
$('.fileSystemDetailsIrodsAuthRow').toggle(isIrodsClient);
320-
321-
$('#fileSystemAuthTypePubKey').prop('disabled', isSambaClient);
322-
if (isSambaClient) {
318+
$('.fileSystemDetailsIrodsAuthRow').toggle(isIrodsClient);
319+
320+
$('#fileSystemIrodsZone').prop('required', isIrodsClient);
321+
$('#fileSystemIrodsHomeDir').prop('required', isIrodsClient);
322+
$('#iRODSfileSystemAuthTypeNative').prop('required', isIrodsClient);
323+
$('#iRODSfileSystemAuthTypePAM').prop('required', isIrodsClient);
324+
325+
$('#fileSystemAuthTypePubKey').prop('disabled', isSambaClient || isSambaSmbjClient);
326+
$("label[for='fileSystemAuthTypePubKey']").toggle(!isIrodsClient);
327+
if (isSambaClient || isIrodsClient) {
323328
$('#fileSystemAuthTypePassword').click();
324329
}
330+
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
331+
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
332+
if (isIrodsClient) {
333+
$("label[for='fileSystemUrl']").text('iRODS Host');
334+
}
325335

326336
if (isSambaClient || isSambaSmbjClient) {
327337
$('#fileSystemUrl')
328338
.attr('title', 'Samba server URL should start with smb://')
329339
.attr('pattern', '^smb://.*');
330-
$("label[for='fileSystemAuthTypePubKey']").show();
331-
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
332-
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
333340
} else if (isIrodsClient) {
334-
$('#fileSystemAuthTypePassword').click();
335341
$('#fileSystemUrl')
336342
.removeAttr('pattern')
337343
.attr('title', 'iRODS hostname or IP without protocol');
338-
$("label[for='fileSystemUrl']").text('iRODS Host');
339-
$("label[for='fileSystemAuthTypePubKey']").hide();
340-
//$('#fileSystemAuthTypePasswordSpan').text('Native');
341-
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
342344
} else {
343345
$('#fileSystemUrl').removeAttr('title').removeAttr('pattern');
344-
$("label[for='fileSystemAuthTypePubKey']").show();
345-
$('#fileSystemAuthTypePasswordSpan').text(sysNetfileSysDetAuthPasswd);
346-
$("label[for='fileSystemUrl']").text(sysNetFileSysDetUrl);
347346
}
348347
}
349348

0 commit comments

Comments
 (0)