-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove all style attributes and replace with classes - use only standard jenkins variables and color so everything looks good with dark theme as well - do all styling via an explicit css file - use jenkins-table where appropriate - use a grid layout instead of tables to arrange the portlets - wrap the portlet in a div instead of a table - use new weather icons for job statistics - sort jobs by full name for job grid - add border to portlets without table - border around the content - dedicated jelly for tables with tweaked styling - move implementation guide to separate file
- Loading branch information
1 parent
9c68383
commit a74654f
Showing
48 changed files
with
1,239 additions
and
1,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Implementation Guide | ||
|
||
Much of the benefit of this plugin will be realized when other plugins that | ||
enhance Jenkins offer support for it. | ||
|
||
## Add support in your plugin | ||
|
||
- Extend the DashboardPortlet class and provide a descriptor that | ||
extends the `Descriptor<DashboardPortlet>` | ||
- Create a jelly view called *portlet.jelly* | ||
- Optionally create a jelly view called *main.jelly* to be used when the portlet | ||
is in maximized mode (otherwise the same *portlet.jelly* view will be used) | ||
|
||
It is possible to define custom parameters for the DashboardPortlet. The | ||
displayName is always required. To add new parameters: | ||
|
||
- create a jelly file called *config.jelly* to be used when the portlet is | ||
configured (added to the view in 'Edit View' config page); | ||
- modify constructor (with `@DataBoundConstructor`) to receive the new | ||
parameters. | ||
|
||
Looking at the source code of this plugin will show a number of examples | ||
of doing this. The core portlets do the same thing that your plugin | ||
would do. | ||
|
||
## Sample files | ||
|
||
***MyPortlet.java*** | ||
|
||
``` | ||
import hudson.plugins.view.dashboard.DashboardPortlet; | ||
class MyPortlet extends DashboardPortlet { | ||
@DataBoundConstructor | ||
public MyPortlet(String name) { | ||
super(name); | ||
} | ||
// do whatever you want | ||
@Extension | ||
public static class DescriptorImpl extends Descriptor<DashboardPortlet> { | ||
@Override | ||
public String getDisplayName() { | ||
return "MyPortlet"; | ||
} | ||
} | ||
}; | ||
``` | ||
|
||
***portlet.jelly*** | ||
|
||
If you want to show a single table inside the portlet use *dp:decorate-table*. This ensures that the table is properly | ||
rendered and really fills the complete area (The default styling of Jenkins adds rounded borders everywhere and a margin | ||
at the bottom that make it look not so nice).<br/> | ||
You can pass additional classes to be set on the table, e.g. to make it sortable.<br/> | ||
``` | ||
<j:jelly xmlns:j="jelly:core" xmlns:dp="/hudson/plugins/view/dashboard"> | ||
<dp:decorate-table portlet="${it}" class="sortable"> <!-- This is to say that this is a dashboard view portlet for a table--> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<j:forEach var="col" items="${it.myitems}"> | ||
<tr> | ||
<td>${col.name}</td> | ||
<td>${col.description}</td> | ||
</tr> | ||
</j:forEach> | ||
</tbody> | ||
</dp:decorate-table> | ||
</j:jelly> | ||
``` | ||
|
||
To show any other kind of content use *dp:decorate-plain* | ||
``` | ||
<j:jelly xmlns:j="jelly:core" xmlns:dp="/hudson/plugins/view/dashboard"> | ||
<dp:decorate-plain portlet="${it}"> <!-- This is to say that this is a dashboard view portlet --> | ||
<!-- you can include a separate file with the logic to display your data or you can write here directly --> | ||
<st:include page="myportlet.jelly"/> | ||
</dp:decorate-plain> | ||
</j:jelly> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.