doCheck methods not being called

26 views
Skip to first unread message

Shaun Thompson

unread,
Aug 21, 2017, 5:40:06 PM8/21/17
to Jenkins Developers
I'm currently developing a plugin and trying to do form validation.  I've tried multiple approaches and nothing has worked to invoke the doCheck methods.  Any help would be appreciated.


Here is my index.jelly file

<?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">
<l:layout title="Release" norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<form method="post">
<f:section title="Git">
<table>
<tr>
<td>
<f:entry title="Group URL">
<f:textbox clazz="required" field="gitGroup" />
</f:entry>
</td>
<td>
<f:entry title="Access Token">
<f:textbox clazz="required" field="gitToken" />
</f:entry>
</td>
</tr>
<tr>
<td>
</td>
<td>
<f:validateButton title="Submit" progress="..."
method="${it.fullURL}git" with="gitGroup,gitToken" />
</td>
</tr>

</table>
</f:section>
</form>
</l:main-panel>
</l:layout>

</j:jelly>



Here is my java file

@Extension
public class ReleaseManagement extends ManagementLink implements RootAction, Describable<ReleaseManagement> {
    private static final Logger LOG = LoggerFactory.getLogger(ReleaseManagement.class);
    
    private Api api;
    
    @Override
    public String getIconFileName() {
        return "/plugin/" + Constants.ARTIFACT_ID + "/images/icon.png";
    }
    
    @Override
    public String getUrlName() {
        return Constants.ARTIFACT_ID;
    }
    
    @Override
    public String getDisplayName() {
        return "Release";
    }
    
    @Override
    public String getDescription() {
        return "Release";
    }
    
    public String getFullURL() {
        return Stapler.getCurrentRequest().getOriginalRequestURI().substring(1);
    }
    
    @RequirePOST
    public HttpResponse doGit(@QueryParameter("gitGroup") final String gitGroup, @QueryParameter("gitToken") final String gitToken) {

        }

    
    @SuppressWarnings("unchecked")
    @Override
    public Descriptor<ReleaseManagement> getDescriptor() {
        return Jenkins.getInstance().getDescriptorOrDie(getClass());
    }
    
    @Extension
    public static final class DescriptorImpl extends Descriptor<ReleaseManagement> {
        private Api api;

        public String getGitGroup() {
            return api.getGitGroup();
        }
    
        public String getGitToken() {
            return api.getGitToken();
        }
          
 
        public FormValidation doCheckGitGroup(@QueryParameter final String value) {
            return FormValidation.error("checked username");
        }
        
        public FormValidation doCheckGitToken(@QueryParameter final String value) {
            return FormValidation.ok("checked repo");
        }
        
        @Override
        public String getDisplayName() {
            return "";
        }
    }
    
}


Ivo Bellin Salarin

unread,
Aug 22, 2017, 2:54:26 AM8/22/17
to Jenkins Developers

Perhaps the sidepanel.jelly required the presence of a variable which is missing. This could be sufficient to show your widget but leave it inanimated.

Search for an old thread from February 2015 (https://groups.google.com/forum/m/#!msg/jenkinsci-dev/TgNiBeYEgz4/TqqNGcJ0ng0J)
You will find how I determined the name of the missing variables.

(Just a suggestion, I'm not sure this is the reason of your misbehavior)


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/ffdd67a2-4f9f-48a9-a616-b0ccb9ebe0be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages