Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plot description #58

Merged
merged 5 commits into from
Mar 9, 2020

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Feb 27, 2020

I would like to add a description to the plots. As you can see in the following plot, the idea is to add a small text below the plots.

The text is only shown the first time that I load the site, then the text disappear. any thoughts on this?

Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde force-pushed the ahcorde/feature/description branch from 1a7e9d0 to 2f826e7 Compare February 27, 2020 10:26
@codecov
Copy link

codecov bot commented Feb 27, 2020

Codecov Report

Merging #58 into master will decrease coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #58      +/-   ##
============================================
- Coverage     43.54%   43.35%   -0.19%     
- Complexity      187      224      +37     
============================================
  Files            18       18              
  Lines          1254     1610     +356     
  Branches        193      278      +85     
============================================
+ Hits            546      698     +152     
- Misses          643      843     +200     
- Partials         65       69       +4     
Impacted Files Coverage Δ Complexity Δ
src/main/java/hudson/plugins/plot/PlotBuilder.java 49.65% <0.00%> (-12.51%) 29.00% <0.00%> (+7.00%) ⬇️
src/main/java/hudson/plugins/plot/CSVSeries.java 60.50% <0.00%> (+0.38%) 31.00% <0.00%> (+2.00%)
.../java/hudson/plugins/plot/MatrixPlotPublisher.java 57.54% <0.00%> (+0.40%) 18.00% <0.00%> (+2.00%)
src/main/java/hudson/plugins/plot/PlotReport.java 51.11% <0.00%> (+4.11%) 11.00% <0.00%> (+1.00%)
src/main/java/hudson/plugins/plot/Plot.java 31.50% <0.00%> (+5.54%) 55.00% <0.00%> (+25.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efbbacb...7d8730c. Read the comment docs.

Copy link
Contributor

@vgaidarji vgaidarji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahcorde I would rename Description title field to Plot description and move it below Plot title in jelly file.
image


It would be nice to follow one of the PR requirements -> Git commits follow best practices.

@@ -176,6 +176,12 @@
@SuppressWarnings("visibilitymodifier")
public String title;

/**
* Description .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a more descriptive java doc.

this.title = title;
this.yaxis = yaxis;
this.group = group;
this.numBuilds = numBuilds;
this.description = description;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow parameters order in CTOR and assignments order inside CTOR -> move below yaxisMaximum.

@@ -420,7 +427,8 @@ public String toString() {
+ getRightBuildNum() + "),HASLEGEND(" + hasLegend()
+ "),ISLOGARITHMIC(" + isLogarithmic() + "),YAXISMINIMUM("
+ yaxisMinimum + "),YAXISMAXIMUM(" + yaxisMaximum
+ "),FILENAME(" + getCsvFileName() + ")";
+ "),FILENAME(" + getCsvFileName() + "),DESCRIPTION"
+ getDescription() + ")";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing opening "(" before getDescription().

@@ -97,6 +99,11 @@ public final void setTitle(@CheckForNull String title) {
this.title = Util.fixEmptyAndTrim(title);
}

@DataBoundSetter
public final void setDescription(@CheckForNull String title) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move it below setYaxisMaximum to preserve the order since description is the last parameter and is after yaxisMaximum parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title -> description

@@ -51,6 +51,9 @@
</div>
</j:if>
<img src="getPlot?index=${index}&amp;width=750&amp;height=450" width="750" height="450" lazymap="getPlotMap?index=${index}" />
<div>
<h4>Description</h4>: ${plot.description}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case no description provided, the empty description is shown
image

Since the intent was to make this plot parameter optional, we shouldn't show it if the field is empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make the text bold using <b> tag instead of <h4>? This way you can keep text in one line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper way of retrieving the description text would be ${it.getPlotDescription(index)} and adding following method to PlotReport.java

    // called from PlotReport/index.jelly
    public String getPlotDescription(int i) {
        Plot plot = getPlot(i);
        return plot.getDescription();
    }

@@ -51,6 +51,9 @@
</div>
</j:if>
<img src="getPlot?index=${index}&amp;width=750&amp;height=450" width="750" height="450" lazymap="getPlotMap?index=${index}" />
<div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add style="width:750px" to description div to align its max width with plot image.

<div style="width:750px">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also solve the issue of very long text which will go to the next line after max width is reached 👍

@@ -637,6 +658,7 @@ public void plotGraph(StaplerRequest req, StaplerResponse rsp)
setTitle(req);
setStyle(req);
setUseDescr(req);
setDescription(req);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will remove description set, please remove.

@@ -665,6 +687,7 @@ public void plotGraphMap(StaplerRequest req, StaplerResponse rsp) throws IOExcep
setTitle(req);
setStyle(req);
setUseDescr(req);
setDescription(req);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will remove description set, please remove.

@@ -0,0 +1,3 @@
<div>
Optional. Specifies the plot description.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-space between sentences.

@ahcorde ahcorde requested a review from vgaidarji March 4, 2020 07:51
Copy link
Contributor

@vgaidarji vgaidarji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahcorde I still think having plot group, title, description together creates better visual organization, and please rename Description title to Plot description.
76144240-f7f2f380-6086-11ea-8865-a020fcc7a0fa

Everything else works just fine 👍

@vgaidarji vgaidarji self-assigned this Mar 7, 2020
@ahcorde ahcorde force-pushed the ahcorde/feature/description branch from 0878019 to 7d8730c Compare March 7, 2020 13:39
@vgaidarji vgaidarji changed the title Added description to plots Add plot description Mar 9, 2020
@vgaidarji vgaidarji merged commit e26dfc0 into jenkinsci:master Mar 9, 2020
@ahcorde
Copy link
Contributor Author

ahcorde commented Mar 9, 2020

Thank you for the reviews!

@vgaidarji
Copy link
Contributor

@ahcorde welcome. Thanks for your contribution 🎉 Will release the new plugin version soon.

@vgaidarji
Copy link
Contributor

vgaidarji commented Mar 9, 2020

@ahcorde 2.1.5 version (see it in repo.jenkins-ci.org) was published which includes changes from current PR. The new plugin version should appear in plugins update center in the matter of hours.
Thanks a lot!

@vgaidarji vgaidarji added the feature New feature or improvement label Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants