Skip to content

Commit b68f1a6

Browse files
committed
Add a new column type NUMBER to show numbers right aligned.
1 parent eb99dd7 commit b68f1a6

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<url>https://github.com/jenkinsci/data-tables-api-plugin</url>
1919

2020
<properties>
21-
<revision>1.10.21-4</revision>
21+
<revision>1.10.23-1</revision>
2222
<changelist>-SNAPSHOT</changelist>
2323
<datatables.version>1.10.23</datatables.version>
2424

src/main/java/io/jenkins/plugins/datatables/TableColumn.java

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,34 @@ public class TableColumn {
3131
private final String headerLabel;
3232
private final String definition;
3333

34+
/**
35+
* Renders a expandable details column with the specified text.
36+
*
37+
* @param detailsText
38+
* the text to show if the column has been expanded.
39+
*
40+
* @return the HTML div to create the details column
41+
*/
3442
public static String renderDetailsColumn(final String detailsText) {
3543
return renderDetailsColumn(detailsText, new JenkinsFacade());
3644
}
3745

46+
/**
47+
* Renders a expandable details column with the specified text.
48+
*
49+
* @param detailsText
50+
* the text to show if the column has been expanded.
51+
* @param jenkinsFacade
52+
* facade for Jenkins API calls
53+
*
54+
* @return the HTML div to create the details column
55+
*/
3856
public static String renderDetailsColumn(final String detailsText, final JenkinsFacade jenkinsFacade) {
3957
return div()
4058
.withClass("details-control")
4159
.attr("data-description", detailsText)
42-
.with(new UnescapedText(new SvgTag(DETAILS_COLUMN_ICON_NAME, jenkinsFacade).withClasses("details-icon").render()))
60+
.with(new UnescapedText(
61+
new SvgTag(DETAILS_COLUMN_ICON_NAME, jenkinsFacade).withClasses("details-icon").render()))
4362
.render();
4463
}
4564

@@ -101,8 +120,8 @@ public TableColumn setHeaderClass(final ColumnCss headerClass) {
101120
}
102121

103122
/**
104-
* Sets the width of the column. Will be expanded to the class {@code col-width-[width]}, see
105-
* {@code jenkins-style.css} for details about the actual percentages.
123+
* Sets the width of the column. Will be expanded to the class {@code col-width-[width]}, see {@code
124+
* jenkins-style.css} for details about the actual percentages.
106125
*
107126
* @param width
108127
* the width CSS class to select for the column
@@ -138,10 +157,14 @@ public enum ColumnCss {
138157
/** No special rendering, the display property will be shown as such. */
139158
NONE(""),
140159
/**
141-
* Dates will be shown using Luxon. The display value will be a human friendly relative time like
142-
* "two weeks ago", rather than an absolute time. A tooltip is available that shows the absolute time.
160+
* Dates will be shown using Luxon. The display value will be a human friendly relative time like "two weeks
161+
* ago", rather than an absolute time. A tooltip is available that shows the absolute time.
143162
*/
144163
DATE("date"),
164+
/**
165+
* Numbers will be shown right aligned so they can be compared more easily..
166+
*/
167+
NUMBER("text-right"),
145168
/** Disables sorting of the column. Rendering is the same as with {@code NONE}. */
146169
NO_SORT("nosort");
147170

0 commit comments

Comments
 (0)