diff --git a/web/src/containers/build/BuildOutput.jsx b/web/src/containers/build/BuildOutput.jsx index 8e25c0cfd0..cdd7489315 100644 --- a/web/src/containers/build/BuildOutput.jsx +++ b/web/src/containers/build/BuildOutput.jsx @@ -13,6 +13,7 @@ // under the License. import * as React from 'react' +import { Fragment } from 'react' import PropTypes from 'prop-types' import { Panel } from 'react-bootstrap' import { @@ -54,6 +55,7 @@ class BuildOutput extends React.Component { } renderFailedTask (host, task) { + const max_lines = 42 return ( {host}: {task.name} @@ -71,14 +73,31 @@ class BuildOutput extends React.Component {
{task.exception}
)} {task.stdout_lines && task.stdout_lines.length > 0 && ( -
-              {task.stdout_lines.slice(-42).join('\n')}
-            
+ + {task.stdout_lines.length > max_lines && ( +
+
+                    {task.stdout_lines.slice(0, -max_lines).join('\n')}
+                  
+
)} +
+              {task.stdout_lines.slice(-max_lines).join('\n')}
+              
+
)} {task.stderr_lines && task.stderr_lines.length > 0 && ( -
-              {task.stderr_lines.slice(-42).join('\n')}
+            
+              {task.stderr_lines.length > max_lines && (
+                  
+
+                      {task.stderr_lines.slice(0, -max_lines).join('\n')}
+                    
+
+ )} +
+              {task.stderr_lines.slice(-max_lines).join('\n')}
             
+
)} diff --git a/web/src/index.css b/web/src/index.css index 476a559057..2d8849b8bf 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -272,3 +272,32 @@ pre.zuul-log-output .highlight { background: rgb(255, 255, 204); } + +details.foldable pre { + white-space: pre-wrap; +} + +details.stderr pre { + color: #9b0000; +} + +/* Used to make the "more/less" fold, look like a normal hyperlink */ +details.foldable summary +{ + color: #0088ce; + text-decoration: none; + cursor: pointer; +} + +details.foldable summary:hover +{ + text-decoration: underline; +} + +details.foldable summary::before { + content: "more"; +} + +details.foldable[open] summary::before { + content: "less"; +}