Skip to content

Commit

Permalink
Fix Reports Success/Warning icons, counts
Browse files Browse the repository at this point in the history
  • Loading branch information
sultan committed Oct 17, 2022
1 parent bce8646 commit abc6566
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,59 +136,11 @@ protected void renderOverview()
*/
protected <Q extends OverviewStats> void renderOverviewTableRow( Q stats )
{
sink.tableCell();
renderSuccessIcon();
sink.tableCell_();
sink.tableCell();
sink.text( getText( "report.overview.numUpToDate" ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( stats.getUpToDate() ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderWarningIcon();
sink.tableCell_();
sink.tableCell();
sink.text( getText( "report.overview.numNewerVersionAvailable" ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( stats.getAny() ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderWarningIcon();
sink.tableCell_();
sink.tableCell();
sink.text( getText( "report.overview.numNewerIncrementalAvailable" ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( stats.getIncremental() ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderWarningIcon();
sink.tableCell_();
sink.tableCell();
sink.text( getText( "report.overview.numNewerMinorAvailable" ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( stats.getMinor() ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderWarningIcon();
sink.tableCell_();
sink.tableCell();
sink.text( getText( "report.overview.numNewerMajorAvailable" ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( stats.getMajor() ) );
sink.tableCell_();
renderStatRow( "report.overview.numUpToDate", stats.getUpToDate(), true );
renderStatRow( "report.overview.numNewerVersionAvailable", stats.getAny(), false );
renderStatRow( "report.overview.numNewerIncrementalAvailable", stats.getIncremental(), false );
renderStatRow( "report.overview.numNewerMinorAvailable", stats.getMinor(), false );
renderStatRow( "report.overview.numNewerMajorAvailable", stats.getMajor(), false );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,8 @@ protected void renderSummaryTableHeader( boolean hasScope, boolean hasType )
protected <T extends OverviewStats> void renderOverviewTableRow( T stats )
{
super.renderOverviewTableRow( stats );
sink.tableCell();
sink.text( getText( "report.overview.numNewerDependenciesAvailable" ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( ( (PluginOverviewStats) stats ).getDependencies() ) );
sink.tableCell_();
super.renderStatRow( "report.overview.numNewerDependenciesAvailable",
( (PluginOverviewStats) stats ).getDependencies(), false );
}

protected void renderSummaryTableRow( Dependency artifact, PluginUpdatesDetails details )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,28 @@ protected void renderSuccessIcon()
sink.figureGraphics( "images/icon_success_sml.gif" );
}

protected void renderStatRow( String textKey, int statCount, boolean forceSuccessIcon )
{
sink.tableRow();
sink.tableCell();
if ( statCount == 0 || forceSuccessIcon )
{
renderSuccessIcon();
}
else
{
renderWarningIcon();
}
sink.tableCell_();
sink.tableCell();
sink.text( getText( textKey ) );
sink.tableCell_();
sink.tableCell();
sink.text( Integer.toString( statCount ) );
sink.tableCell_();
sink.tableRow_();
}

protected boolean equals( ArtifactVersion v1, ArtifactVersion v2 )
{
return v1 == v2 || ( v1 != null && v1.equals( v2 ) )
Expand Down

0 comments on commit abc6566

Please sign in to comment.