Thanks Robert - a quick and awesome solution.

Sorry if the question was a bit silly - first plugin syndrome over here!

On Tuesday, February 23, 2016 at 12:34:50 PM UTC+1, Robert Sandell wrote:
>
> Well first your code suggests that you are adding two side panels, first 
> the build's side panel and then your own that contains something strange.
>
> For including the widget I would look at how it's included in the existing 
> side panel today and try to do something similar:
>
> https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/hudson/model/AbstractProject/sidepanel.jelly#L62
>
> e.g.
>
> l.side_panel { 
>
>     st.include(it:my.historyWidget, page:"index.jelly") 
> } 
>
> On Tue, Feb 23, 2016 at 10:14 AM, <[email protected] <javascript:>> 
> wrote:
>
>> I've been investigating how to include the build history widget on an 
>> Action extension plugin.
>>
>>  
>>
>> We are currently using stapler via a groovy context to render some 
>> information pertaining to a particular run, as well as get the build 
>> history in the side panel - code below.
>>
>>  
>> def st = namespace("jelly:stapler")
>>
>> st.include(it: my.run, page: "sidepanel") 
>>
>> l.side_panel { 
>>
>>     st.include(it:my.proj, page:"/hudson/widgets/HistoryWidget/all") 
>> } 
>>
>> l.main_panel { 
>>     //Rendering other components 
>> }
>>
>>
>> Including the historyWidget/all has some undesirable effects - see 
>> attached '1'
>>
>>
>>
>> <https://lh3.googleusercontent.com/-SdlCKtBqYRM/Vswikioz5SI/AAAAAAAAAAM/-dBfO5CJkAo/s1600/1.png>
>>
>>
>>
>> It seems to include the entire page, plus the widget in the plugin's view.
>>
>>  
>>
>> If I try to use the default widget (not *all* of the entries), I see a 
>> much different error - see attached, callstack below. I suspect I may be 
>> hitting this issue as I am not providing a relative context for the include 
>> call (perhaps I need to add the 'from' parameter, but I'm not quite sure 
>> what value I'd pass through).
>>
>>  
>>
>> java.lang.RuntimeException: org.apache.commons.jelly.JellyTagException: 
>> jar:file:/C:/Users/jgamble/Perforce/JenkinsDev/JenkinsDev/Plugins/job-summary-plugin/dev/target/work/webapp/WEB-INF/lib/jenkins-core-1.625.2.jar!/lib/layout/layout.jelly:247:25:
>>  
>> <d:invokeBody> org.apache.commons.jelly.JellyTagException: 
>> jar:file:/C:/Users/jgamble/Perforce/JenkinsDev/JenkinsDev/Plugins/job-summary-plugin/dev/target/work/webapp/WEB-INF/lib/jenkins-core-1.625.2.jar!/lib/layout/main-panel.jelly:36:21:
>>  
>> <d:invokeBody> org.apache.commons.jelly.JellyTagException: 
>> jar:file:/C:/Users/jgamble/Perforce/JenkinsDev/JenkinsDev/Plugins/job-summary-plugin/dev/target/work/webapp/WEB-INF/lib/jenkins-core-1.625.2.jar!/hudson/widgets/HistoryWidget/index.jelly:57:40:
>>  
>> <st:include> No page found 'entries.jelly' for class 
>> hudson.model.FreeStyleProject
>>
>> at 
>> org.kohsuke.stapler.jelly.groovy.JellyBuilder.doInvokeMethod(JellyBuilder.java:280)
>>
>> at 
>> org.kohsuke.stapler.jelly.groovy.Namespace$ProxyImpl.invoke(Namespace.java:92)
>>
>> at com.sun.proxy.$Proxy56.layout(Unknown Source)
>>
>> at lib.LayoutTagLib$layout.call(Unknown Source)
>>
>> at 
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
>>
>> at 
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>>
>> at 
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>
>> at index.run(index.groovy:11)
>>
>> at 
>> org.kohsuke.stapler.jelly.groovy.GroovierJellyScript.run(GroovierJellyScript.java:74)
>>
>> at 
>> org.kohsuke.stapler.jelly.groovy.GroovierJellyScript.run(GroovierJellyScript.java:62)
>>
>> at 
>> org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
>>
>> at 
>> org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
>>
>> at 
>> org.kohsuke.stapler.jelly.JellyRequestDispatcher.forward(JellyRequestDispatcher.java:55)
>>
>> at 
>> org.kohsuke.stapler.jelly.groovy.GroovyFacet.handleIndexRequest(GroovyFacet.java:121)
>>
>> at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:735)
>>
>> at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>>
>> at org.kohsuke.stapler.MetaClass$13.dispatch(MetaClass.java:411)
>>
>> at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
>>
>> at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>>
>> at org.kohsuke.stapler.MetaClass$13.dispatch(MetaClass.java:411)
>>
>> at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
>>
>> at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>>
>> at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
>>
>> at 
>> org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
>>
>> at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
>>
>> at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>>
>> at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
>>
>> at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
>>
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>
>> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
>>
>>  
>>
>> So my question: How can I simply include the Build History widget via 
>> stapler/jelly into my plugin's view? 
>>
>>  
>> Thanks!
>>
>>  
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-dev/bc144b15-2173-4d1a-b642-1fe0e738a470%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-dev/bc144b15-2173-4d1a-b642-1fe0e738a470%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Robert Sandell
> *Software Engineer*
> *CloudBees Inc.*
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/a027efb5-46eb-4a0f-8362-abedd8656842%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to