Ajax issue

75 views
Skip to first unread message

Nikhil Bhoski

unread,
Sep 5, 2023, 7:19:25 AM9/5/23
to Jenkins Developers
Hi I want to reder a table on a index.jelly  and one <td> value will be an error which will be pulled from results.json in workspace. i know JUNIT and others are using xmlHTTTP response . However i dont understand how do they bind it in action class. can you please help? 

BulDArtifact.java is my action class 

Below is my jelly 


if i use <r:failed-test/> houw can i make /summary visible on click or how can i bind the values from Jelly to the Action class for AJAX.

Nikhil

Winter, Markus

unread,
Sep 5, 2023, 12:09:06 PM9/5/23
to jenkin...@googlegroups.com

You might want to look at https://www.jenkins.io/doc/developer/handling-requests/

 

But if I understand you right you want to show the summary.jelly from your action. So looking at https://github.com/jenkinsci/junit-plugin/blob/master/src/main/resources/lib/hudson/test/failed-test.jelly,  all you need to do is to use the url attribute pointing to your action to make it appear when clicked.

<r:failed-test url=”<url to your action>”/>

--
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/78b22f84-0d84-48a2-9c2b-f46f2390f312n%40googlegroups.com.

Nikhil Bhoski

unread,
Sep 5, 2023, 1:23:53 PM9/5/23
to Jenkins Developers
Thanks Alot for responding.

does URL point to the method of action class ? like ${it.Url}/? this where the confusion is I am not sure where this URL points how would it look like in my jelly ? 

Regards 
Nikhil 

Winter, Markus

unread,
Sep 5, 2023, 1:34:42 PM9/5/23
to jenkin...@googlegroups.com

The url should point to the root of the action (see https://github.com/jenkinsci/junit-plugin/blob/d569357186902e13d5ca4d38e1691b2dec0bf078/src/main/resources/lib/hudson/test/failed-test.jelly#L65C99-L65C99 how the “/summary” is appended to it), assuming that the action is applied to a run it would be something like <jenkinsroot>/job/myjob/1/buildresult (note that the url you used for your action “buildresults” is very generic, I would include make it “matlabresults” instead). You also don’t need the doSummary method in your action when you already have a summary.jelly that will render the data.

Nikhil Bhoski

unread,
Sep 6, 2023, 3:24:40 AM9/6/23
to Jenkins Developers
Thanks Alot .

This worked very well ! i could finally render my summary. I am sorry to being rooky here but i have two more questions 

1) I am getting only Jenkins root URL using Jenkins.get().getRootURL() any way that i could get the URL till the build run that i have 
eg in my case /job/sidepanel_view/17/${it.urlName} 
This is the complete URL that i need to uppend to root to get summary displayed. Any way i could get it directly in Jelly 
like ${rootURL} etc 

2) instead of summary do you suggest any other way that i could render a short error result on click of the button. I would like to use XMLHTTP response like here https://github.com/jenkinsci/junit-plugin/blob/d569357186902e13d5ca4d38e1691b2dec0bf078/src/main/resources/lib/hudson/test/js/failureSummary.js#L10

Thanks in advance for all your support so far getting to learn good things 

Regards 
Nikhil 

Nikhil Bhoski

unread,
Sep 6, 2023, 5:48:34 AM9/6/23
to Jenkins Developers
Also With above i am not sure why do i see the summary automatically on m index page how can i avoid it showing up on index page 
I basically want to show error on click of the + sign index1.PNGindex2.PNG



Reply all
Reply to author
Forward
0 new messages