Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomomdahan committed Oct 15, 2024
1 parent cc487b9 commit 7fb59bd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/main/java/hudson/scm/SubversionSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -2544,10 +2544,10 @@ public FormValidation doCheckExcludedCommitMessages(@QueryParameter String value
* Validates the remote server supports custom revision properties
*/
@RequirePOST
public FormValidation doCheckRevisionPropertiesSupported(@AncestorInPath Item context,
public FormValidation doCheckExcludedRevprop(@AncestorInPath Item context,
@QueryParameter String value,
@QueryParameter("svn.remote.loc") String remoteLocation,
@QueryParameter("svn.remote.cred") String credentialsId
@QueryParameter String remoteLocation,
@QueryParameter String remoteCredentialsId
) throws IOException, ServletException {

String v = Util.fixNull(remoteLocation).trim();
Expand All @@ -2564,7 +2564,7 @@ public FormValidation doCheckRevisionPropertiesSupported(@AncestorInPath Item co

try {
SVNURL repoURL = SVNURL.parseURIDecoded(new EnvVars(EnvVars.masterEnvVars).expand(v));
StandardCredentials credentials = lookupCredentials(context, credentialsId, repoURL);
StandardCredentials credentials = lookupCredentials(context, remoteCredentialsId, repoURL);
SVNNodeKind node = null;
try {
node = checkRepositoryPath(context,repoURL, credentials);
Expand Down Expand Up @@ -3231,7 +3231,7 @@ public FormValidation doCheckRemote(/* TODO unused, delete */StaplerRequest req,
*/
@RequirePOST
public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath Item context,
@QueryParameter("remoteLocation") String remote, @QueryParameter String value) {
@QueryParameter String remote, @QueryParameter String value) {

// Test the connection only if we may use the credentials (cf. hudson.plugins.git.UserRemoteConfig.DescriptorImpl.doCheckUrl)
if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:c="/lib/credentials">

<f:entry title="${%Repository URL}" field="remoteLocation" help="/scm/SubversionSCM/url-help">
<f:textbox checkUrl="${rootURL}/descriptorByName/hudson.scm.SubversionSCM%24ModuleLocation/checkRemote" checkDependsOn=""/>
<f:entry title="${%Repository URL}" field="remote" help="/scm/SubversionSCM/url-help">
<f:textbox />
</f:entry>

<f:entry title="${%Credentials}" field="credentialsId">
<c:select checkMethod="post"/>
</f:entry>
Expand Down
9 changes: 3 additions & 6 deletions src/main/resources/hudson/scm/SubversionSCM/config.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,17 @@ THE SOFTWARE.
</f:entry>

<st:adjunct includes="hudson.scm.SubversionSCM.excludedRevprop-validation" />

<f:invisibleEntry>
<f:entry field="svn.remote.loc" >
<f:entry field="remoteLocation" >
<f:textbox />
</f:entry>
<f:entry field="svn.remote.cred" >
<f:entry field="remoteCredentialsId" >
<f:textbox />
</f:entry>
</f:invisibleEntry>

<f:entry title="${%Exclusion revprop name}" field="excludedRevprop">
<f:textbox checkUrl="${rootURL}/descriptorByName/hudson.scm.SubversionSCM/checkRevisionPropertiesSupported" checkDependsOn="svn.remote.loc svn.remote.cred" />
<f:textbox />
</f:entry>

<f:entry title="${%Filter changelog}" field="filterChangelog">
<f:checkbox />
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Behaviour.specify("input[name='_.remoteLocation']", 'SubversionSCM.RemoteLocation', 0, function(element) {
Behaviour.specify("input[name='_.remote']", 'SubversionSCM.RemoteLocation', 0, function(element) {
element.addEventListener('blur', updateHiddenFields);
});

Expand All @@ -8,13 +8,13 @@ Behaviour.specify("select[name='_.credentialsId'][filldependson='remote']", 'Sub

function updateHiddenFields() {

var remoteLocationElement = document.querySelector("input[name='_.remoteLocation']");
var remoteLocationElement = document.querySelector("input[name='_.remote']");
var credentialsIdElement = document.querySelector("select[name='_.credentialsId'][filldependson='remote']");
var selectedOption = credentialsIdElement.options[credentialsIdElement.selectedIndex].value;


var remoteHidden = document.querySelector("input[name='_.svn.remote.loc']");
var credentialsHidden = document.querySelector("input[name='_.svn.remote.cred']");
var remoteHidden = document.querySelector("input[name='_.remoteLocation']");
var credentialsHidden = document.querySelector("input[name='_.remoteCredentialsId']");

if (remoteHidden) {
remoteHidden.value = remoteLocationElement.value;
Expand Down

0 comments on commit 7fb59bd

Please sign in to comment.