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 download option to 'Console output', move 'View as plain text' and 'Copy' buttons to app bar #9169

Merged
merged 12 commits into from
May 22, 2024
21 changes: 17 additions & 4 deletions core/src/main/resources/hudson/model/Run/console.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,28 @@ THE SOFTWARE.
Displays the console output
-->
<?jelly escape-by-default='true'?>
<st:compress 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:i="jelly:fmt">
<st:compress xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:dd="/lib/layout/dropdowns">
janfaracik marked this conversation as resolved.
Show resolved Hide resolved
<l:layout title="${it.fullDisplayName} Console">
<st:include page="sidepanel.jelly" />
<l:breadcrumb title="${%Console Output}" />

<l:breadcrumb title="${%Console Output}" />

<l:main-panel>
<t:buildCaption>
<j:set var="controls">
<a class="jenkins-button" href="consoleText" download="${it.displayName}.txt">
<l:icon src="symbol-download" />
${%Download}
</a>
<l:copyButton ref="out" label="${%Copy}" />
<a class="jenkins-button" href="consoleText">
${%View as plain text}
</a>
</j:set>

<t:buildCaption controls="${controls}">
${%Console Output}
<l:copyButton message="${%successfullyCopied}" tooltip="${%clickToCopy}" ref="out"/>
</t:buildCaption>

<j:set var="threshold" value="${h.getSystemProperty('hudson.consoleTailKB')?:'150'}" />
<!-- Show at most last 150KB (can override with system property) unless consoleFull is set -->
<j:set var="offset" value="${empty(consoleFull) ? it.logText.length()-threshold*1024 : 0}" />
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/resources/hudson/model/Run/console.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
# THE SOFTWARE.

skipSome=Skipping {0,number,integer} KB.. <a href="{1}">Full Log</a>
clickToCopy=Click to copy
successfullyCopied=Copied to clipboard
7 changes: 7 additions & 0 deletions core/src/main/resources/lib/hudson/buildCaption.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ THE SOFTWARE.
-->
<?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">
<st:documentation>
<st:attribute name="controls">
Optional field to set controls in the app bar
</st:attribute>
</st:documentation>

<div class="jenkins-app-bar">
<div class="jenkins-app-bar__content jenkins-build-caption" data-status-url="${rootURL}/${it.url}statusIcon">
<l:icon alt="${it.iconColor.description}" src="symbol-status-${it.iconColor.iconName}"
Expand All @@ -47,6 +53,7 @@ THE SOFTWARE.
</div>
</j:if>
<st:adjunct includes="lib.hudson.build-caption"/>
<j:out value="${attrs.controls}" />
</div>
</div>
</j:jelly>
13 changes: 1 addition & 12 deletions core/src/main/resources/lib/hudson/project/console-link.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,5 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<!-- Displays a console link for a build. -->
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<j:choose>
<j:when test="${it.logFile.length() > 200000}">
<!-- Show raw link directly so user need not click through live console page, though this is not so bad now as they would just see: Skipping nnn KB.. Full Log. -->
<l:task href="${h.getConsoleUrl(it) ?: (buildUrl.baseUrl + '/console')}" icon="icon-terminal icon-md" title="${%Console Output}"/>
<l:task href="${buildUrl.baseUrl}/consoleText" icon="icon-document icon-md" title="${%View as plain text}"/>
</j:when>
<j:otherwise>
<l:task icon="images/svgs/terminal.svg" href="${h.getConsoleUrl(it) ?: (buildUrl.baseUrl + '/console')}" title="${%Console Output}">
<l:task href="${buildUrl.baseUrl}/consoleText" icon="icon-document icon-md" title="${%View as plain text}"/>
</l:task>
</j:otherwise>
</j:choose>
<l:task href="${h.getConsoleUrl(it) ?: (buildUrl.baseUrl + '/console')}" icon="icon-terminal icon-md" title="${%Console Output}" />
</j:jelly>
6 changes: 5 additions & 1 deletion core/src/main/resources/lib/layout/copyButton.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ THE SOFTWARE.
<st:attribute name="clazz">
Additional CSS class names
</st:attribute>
<st:attribute name="label">
Optional label for the button, hides the tooltip if set
</st:attribute>
<st:attribute name="ref" use="required">
The id of the target element to be copied
@since 2.449
Expand All @@ -54,9 +57,10 @@ THE SOFTWARE.
text="${attrs.text}"
ref="${attrs.ref}"
message="${attrs.message ?: '%Copied'}"
tooltip="${attrs.tooltip ?: '%Copy'}"
tooltip="${attrs.label != null ? null : attrs.tooltip ?: '%Copy'}"
type="button">
<span class="jenkins-copy-button__icon" />
${attrs.label}
</button>

<st:adjunct includes="lib.layout.copyButton.copyButton"/>
Expand Down
Loading