Skip to content
Permalink
Browse files
[JENKINS-36472] utilize icon shim functionality
- added icons for all sizes
- implemented IconSpec interface in all report actions
- replaced <img> markup with <lsi:icon> shim markup
  • Loading branch information
cpoenisch committed Jul 21, 2016
1 parent 7520274 commit d91c9993b7096836b31affc0c921c0ec0e375000
Showing with 75 additions and 117 deletions.
  1. +2 −2 src/main/java/de/tracetronic/jenkins/plugins/ecutest/ETPlugin.java
  2. +6 −40 src/main/java/de/tracetronic/jenkins/plugins/ecutest/report/AbstractReportAction.java
  3. +8 −8 src/main/java/de/tracetronic/jenkins/plugins/ecutest/report/atx/AbstractATXAction.java
  4. +2 −11 ...n/java/de/tracetronic/jenkins/plugins/ecutest/report/generator/AbstractReportGeneratorAction.java
  5. +2 −2 src/main/java/de/tracetronic/jenkins/plugins/ecutest/report/log/AbstractETLogAction.java
  6. +2 −2 src/main/java/de/tracetronic/jenkins/plugins/ecutest/report/trf/AbstractTRFAction.java
  7. +0 −1 ...main/resources/de/tracetronic/jenkins/plugins/ecutest/report/AbstractReportPublisher/config.jelly
  8. +20 −18 src/main/resources/de/tracetronic/jenkins/plugins/ecutest/report/atx/ATXBuildAction/index.jelly
  9. +7 −7 src/main/resources/de/tracetronic/jenkins/plugins/ecutest/report/atx/ATXBuildAction/report.jelly
  10. +6 −6 ...es/de/tracetronic/jenkins/plugins/ecutest/report/generator/ReportGeneratorBuildAction/index.jelly
  11. +2 −2 ...s/de/tracetronic/jenkins/plugins/ecutest/report/generator/ReportGeneratorBuildAction/report.jelly
  12. +6 −6 src/main/resources/de/tracetronic/jenkins/plugins/ecutest/report/log/ETLogBuildAction/index.jelly
  13. +2 −2 src/main/resources/de/tracetronic/jenkins/plugins/ecutest/report/log/ETLogBuildAction/report.jelly
  14. +7 −7 src/main/resources/de/tracetronic/jenkins/plugins/ecutest/report/trf/TRFBuildAction/index.jelly
  15. +3 −3 src/main/resources/de/tracetronic/jenkins/plugins/ecutest/report/trf/TRFBuildAction/report.jelly
  16. BIN src/main/webapp/icons/16x16/{atx.png → atx-report.png}
  17. BIN src/main/webapp/icons/16x16/{trf.png → trf-report.png}
  18. BIN src/main/webapp/icons/24x24/{atx.png → atx-report.png}
  19. BIN src/main/webapp/icons/24x24/report-generator.png
  20. BIN src/main/webapp/icons/24x24/{trf.png → trf-report.png}
  21. BIN src/main/webapp/icons/32x32/{atx.png → atx-report.png}
  22. BIN src/main/webapp/icons/32x32/{trf.png → trf-report.png}
  23. BIN src/main/webapp/icons/48x48/{atx.png → atx-report.png}
  24. BIN src/main/webapp/icons/48x48/{trf.png → trf-report.png}
@@ -201,14 +201,14 @@ public void start() throws Exception {
super.start();

for (final String name : new String[] {
"atx",
"atx-report",
"atx-trend",
"ecu-test",
"ecu-test-pkg",
"ecu-test-prj",
"report-generator",
"test-guide",
"trf",
"trf-report",
}) {
// Register small (16x16) icons
IconSet.icons.addIcon(new Icon(
@@ -29,24 +29,20 @@
*/
package de.tracetronic.jenkins.plugins.ecutest.report;

import hudson.PluginWrapper;
import hudson.model.Action;
import hudson.model.Job;
import hudson.model.Run;

import java.io.File;
import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.CheckForNull;

import jenkins.model.Jenkins;
import jenkins.util.VirtualFile;

import org.jenkins.ui.icon.IconSet;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.stapler.StaplerRequest;

import de.tracetronic.jenkins.plugins.ecutest.ETPlugin;
import de.tracetronic.jenkins.plugins.ecutest.report.atx.AbstractATXAction;
import de.tracetronic.jenkins.plugins.ecutest.report.trf.AbstractTRFAction;

@@ -55,9 +51,7 @@
*
* @author Christian Pönisch <christian.poenisch@tracetronic.de>
*/
public abstract class AbstractReportAction extends AbstractRequestHandler implements Action {

private static final Logger LOGGER = Logger.getLogger(AbstractReportAction.class.getName());
public abstract class AbstractReportAction extends AbstractRequestHandler implements Action, IconSpec {

private final boolean projectLevel;

@@ -111,36 +105,8 @@ protected VirtualFile getArchiveTargetDir(final File rootDir) {
@CheckForNull
protected abstract Run<?, ?> getLastReportBuild(final Job<?, ?> project);

/**
* Gets the icon path inside of this plugin.
*
* @param icon
* the icon to search
* @return the full icon path or {@code null} if the icon does not exist
*/
@CheckForNull
protected String getIconPath(final String icon) {
String iconPath = null;
if (icon == null) {
return iconPath;
}
// Try plugin icons dir, fallback to Jenkins image
final Jenkins instance = Jenkins.getInstance();
if (instance != null) {
final PluginWrapper wrapper = instance.getPluginManager().getPlugin(ETPlugin.class);
boolean pluginIconExists = false;
try {
pluginIconExists = wrapper != null
&& new File(wrapper.baseResourceURL.toURI().getPath() + "/icons/" + icon).exists();
} catch (final URISyntaxException e) {
LOGGER.log(Level.WARNING, e.getMessage());
}
if (pluginIconExists) {
iconPath = "/plugin/" + wrapper.getShortName() + "/icons/" + icon;
} else {
iconPath = "/images/48x48/document.png";
}
}
return iconPath;
@Override
public String getIconFileName() {
return IconSet.icons.getIconByClassSpec(getIconClassName() + " icon-xlg").getUrl();
}
}
@@ -66,21 +66,21 @@ public String getUrlName() {
}

@Override
public String getIconFileName() {
return getIconPath("48x48/test-guide.png");
public String getIconClassName() {
return "icon-ecutest-test-guide";
}

/**
* @return the report icon file name
* @return the report icon class name
*/
public String getReportIconFileName() {
return getIconPath("24x24/atx.png");
public String getReportIconClassName() {
return "icon-ecutest-atx-report";
}

/**
* @return the trend icon file name
* @return the trend icon class name
*/
public String getTrendIconFileName() {
return getIconPath("24x24/atx-trend.png");
public String getTrendIconClassName() {
return "icon-ecutest-atx-trend";
}
}
@@ -66,16 +66,7 @@ public String getUrlName() {
}

@Override
public String getIconFileName() {
return getIconPath("48x48/report-generator.png");
}

/**
* Gets the small icon file name.
*
* @return the small icon file name
*/
public String getSmallIconFileName() {
return getIconPath("24x24/report-generator.png");
public String getIconClassName() {
return "icon-ecutest-report-generator";
}
}
@@ -77,7 +77,7 @@ public String getUrlName() {
}

@Override
public String getIconFileName() {
return getIconPath("48x48/ecu-test.png");
public String getIconClassName() {
return "icon-ecutest-ecu-test";
}
}
@@ -67,7 +67,7 @@ public String getUrlName() {
}

@Override
public String getIconFileName() {
return getIconPath("48x48/trf.png");
public String getIconClassName() {
return "icon-ecutest-trf-report";
}
}
@@ -30,7 +30,6 @@

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<f:advanced title="${%publishing.title}">
<f:section title="${%publishing.title}">
<j:if test="${empty(showArchiving)}">
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2015 TraceTronic GmbH
Copyright (c) 2015-2016 TraceTronic GmbH
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -29,14 +29,14 @@
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:lsi="/shim/layout/icon">
<j:set var="owner" value="${it.getOwner(request)}" />
<j:set var="build" value="${it.getBuild(request)}" />
<l:layout title="${it.displayName}" norefresh="true">
<st:include page="sidepanel.jelly" it="${owner}" />
<l:main-panel>
<h1>
<img src="${resURL}${it.iconFileName}" alt="ATX reports" height="48" width="48" />
<lsi:icon class="${it.iconClassName} icon-xlg" alt="ATX reports" />
${it.displayName}
</h1>
<j:if test="${owner != null}">
@@ -48,25 +48,27 @@
<table class="fileList">
<j:set var="indent" value="0" />
<j:set var="reports" value="${it.getATXReports()}" />
<j:forEach var="report" items="reports">
<st:include page="report.jelly" />
</j:forEach>
<j:choose>
<j:when test="${empty(reports)}">
${%reports.empty}
</j:when>
<j:when test="${it.hasArchivedReports()}">
<tr>
<td style="text-align:right;" colspan="2">
<div style="margin-top: 1em;">
<img src="${resURL}/images/16x16/package.png" /><st:nbsp />
<a href="${rootURL}/${build.url}${it.urlName}/zipDownload">
${%download.zip}
</a>
</div>
</td>
</tr>
</j:when>
<j:otherwhise>
<j:forEach var="report" items="${reports}">
<st:include page="report.jelly" />
</j:forEach>
<j:if test="${it.hasArchivedReports()}">
<tr>
<td style="text-align:right;" colspan="2">
<div style="margin-top: 1em;">
<l:icon class="icon-package icon-sm" /><st:nbsp />
<a href="${rootURL}/${build.url}${it.urlName}/zipDownload">
${%download.zip}
</a>
</div>
</td>
</tr>
</j:if>
</j:otherwhise>
</j:choose>
</table>
</j:if>
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2015 TraceTronic GmbH
Copyright (c) 2015-2016 TraceTronic GmbH
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -29,23 +29,23 @@
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:lsi="/shim/layout/icon">
<tr>
<td>
<div style="text-indent: ${indent}px;">
<j:choose>
<j:when test="${report.hasTrendReport()}">
<lsi:icon class="${it.trendIconClassName} icon-sm" alt="ATX report" />
<st:nbsp />
<j:if test="${owner == build}">
<img src="${resURL}${it.trendIconFileName}" alt="ATX report" height="16" width="16" />
<st:nbsp /><a href="${report.url}" target="_blank">${%trend.view}</a>
<a href="${report.url}" target="_blank">${%trend.view}</a>
</j:if>
<j:if test="${owner != build}">
<img src="${resURL}${it.trendIconFileName}" alt="ATX trend report" height="16" width="16" />
<st:nbsp /><a href="${rootURL}/${build.url}${it.urlName}/${report.id}" target="_blank">${%trend.view}</a>
<a href="${rootURL}/${build.url}${it.urlName}/${report.id}" target="_blank">${%trend.view}</a>
</j:if>
</j:when>
<j:otherwise>
<img src="${resURL}${it.reportIconFileName}" alt="ATX report" height="16" width="16" />
<lsi:icon class="${it.reportIconClassName} icon-sm" alt="ATX report" />
<st:nbsp />
<j:if test="${owner == build}">
<a href="${report.url}" target="_blank">${report.title}</a>
@@ -29,14 +29,14 @@
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:lsi="/shim/layout/icon">
<j:set var="owner" value="${it.getOwner(request)}" />
<j:set var="build" value="${it.getBuild(request)}" />
<l:layout title="${it.displayName}" norefresh="true">
<st:include page="sidepanel.jelly" it="${owner}" />
<l:main-panel>
<h1>
<img src="${resURL}${it.iconFileName}" alt="Generated reports" height="48" width="48" />
<lsi:icon class="${it.iconClassName} icon-xlg" alt="Generated reports" />
${it.displayName}
</h1>
<j:if test="${owner != null}">
@@ -48,18 +48,18 @@
<table class="fileList">
<j:set var="indent" value="0" />
<j:set var="reports" value="${it.getGeneratorReports()}" />
<j:forEach var="report" items="reports">
<st:include page="report.jelly" />
</j:forEach>
<j:choose>
<j:when test="${empty(reports)}">
${%reports.empty}
</j:when>
<j:otherwise>
<j:forEach var="report" items="${reports}">
<st:include page="report.jelly" />
</j:forEach>
<tr>
<td style="text-align:right;" colspan="2">
<div style="margin-top: 1em;">
<img src="${resURL}/images/16x16/package.png" /><st:nbsp />
<l:icon class="icon-package icon-sm" /><st:nbsp />
<a href="${rootURL}/${build.url}${it.urlName}/zipDownload">
${%download.zip}
</a>
@@ -29,11 +29,11 @@
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:lsi="/shim/layout/icon">
<tr>
<td>
<div style="text-indent: ${indent}px;">
<img src="${resURL}${it.smallIconFileName}" alt="Generated report" height="16" width="16" />
<lsi:icon class="${it.iconClassName} icon-sm" alt="Generated report" />
<st:nbsp />
<j:if test="${owner == build}">
<a href="${report.url}/zipDownload">${report.title}</a>
@@ -29,15 +29,15 @@
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:lsi="/shim/layout/icon">
<j:set var="owner" value="${it.getOwner(request)}" />
<j:set var="build" value="${it.getBuild(request)}" />
<l:layout title="${it.displayName}" norefresh="true">
<link type="text/css" href="${resURL}/plugin/ecutest/css/style.css" rel="stylesheet" />
<st:include page="sidepanel.jelly" it="${owner}" />
<l:main-panel>
<h1>
<img src="${resURL}${it.iconFileName}" alt="ECU-TEST Logs" height="48" width="48" />
<lsi:icon class="${it.iconClassName} icon-xlg" alt="ECU-TEST Logs" />
${it.displayName}
</h1>
<j:if test="${owner != null}">
@@ -49,18 +49,18 @@
<table class="fileList" id="logs">
<j:set var="indent" value="0" />
<j:set var="reports" value="${it.getLogReports()}" />
<j:forEach var="report" items="reports">
<st:include page="report.jelly" />
</j:forEach>
<j:choose>
<j:when test="${empty(reports)}">
${%reports.empty}
</j:when>
<j:otherwise>
<j:forEach var="report" items="${reports}">
<st:include page="report.jelly" />
</j:forEach>
<tr>
<td style="text-align:right;" colspan="3">
<div style="margin-top: 1em;">
<img src="${resURL}/images/16x16/package.png" /><st:nbsp />
<l:icon class="icon-package icon-sm" /><st:nbsp />
<a href="${rootURL}/${build.url}${it.urlName}/zipDownload">
${%download.zip}
</a>
@@ -29,11 +29,11 @@
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:lsi="/shim/layout/icon">
<tr>
<td>
<div style="text-indent: ${indent}px;">
<img src="${resURL}${it.iconFileName}" alt="ECU-TEST Log" height="16" width="16" />
<lsi:icon class="${it.iconClassName} icon-sm" alt="ECU-TEST Log" />
<st:nbsp />
<j:choose>
<j:when test="${!report.fileName.endsWith('.log')}">

0 comments on commit d91c999

Please sign in to comment.