Groovy views?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Groovy views?

Vladimir Sizikov
Hi,

The plugin tutorial mentions that Hudson supports jelly and groovy
based views. While there are plenty of jelly-based views, I wasn't
able to find any good examples or instructions on how to use groovy
based views. The tutorial refers to "architecture.html" for more info,
but there is nothing there about groovy.

Is there any guidance when it's better to use jelly and when groovy is
more appropriate?

Thanks,
  --Vladimir

--
Vladimir Sizikov
Sun Microsystems                   [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Groovy views?

Kohsuke Kawaguchi-2
Vladimir Sizikov wrote:
> The plugin tutorial mentions that Hudson supports jelly and groovy
> based views. While there are plenty of jelly-based views, I wasn't
> able to find any good examples or instructions on how to use groovy
> based views. The tutorial refers to "architecture.html" for more info,
> but there is nothing there about groovy.

Indeed. I guess I got more doc fix to do.

> Is there any guidance when it's better to use jelly and when groovy is
> more appropriate?

There's one groovy view in Hudson, which is at:

   ./core/src/main/resources/lib/hudson/buildStatusSummary.groovy

To me, if the page contains a lot of program logic, like variable
assignments, loop, if/else, and so on, then it'd be better to use
Groovy. For example, you probably already know how ugly it is to write
if/then/else in Jelly, but in Groovy, it just flows much more nicely.

Jelly, OTOH, is nicer when you are mostly trying to generate HTML pages,
like layout.jelly.

The above buildStatusSummary.groovy is not really a good example,
because it doesn't show how well two languages are integrated. Maybe I
should find one such logic-heavy jelly script and convert that in
Groovy. Then I think you'll see better.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment