Merge "web: integrate re-ansi to render ANSI code in Zuul consoles"

This commit is contained in:
Zuul 2021-11-17 14:10:29 +00:00 committed by Gerrit Code Review
commit a017ba9d94
4 changed files with 26 additions and 5 deletions

View File

@ -10,6 +10,7 @@
"@patternfly/react-charts": "^6.15.23",
"@patternfly/react-core": "4.152.4",
"@patternfly/react-table": "4.29.58",
"@softwarefactory-project/re-ansi": "^0.4.0",
"axios": "^0.19.0",
"js-yaml": "^3.13.0",
"lodash": "^4.17.10",

View File

@ -14,6 +14,7 @@
import * as React from 'react'
import { Fragment } from 'react'
import ReAnsi from '@softwarefactory-project/re-ansi'
import PropTypes from 'prop-types'
import {
Card,
@ -106,11 +107,11 @@ class BuildOutput extends React.Component {
{task.stdout_lines.length > max_lines && (
<details className={`${'foldable'} ${'stdout'}`}><summary></summary>
<pre key="stdout" title="stdout">
{task.stdout_lines.slice(0, -max_lines).join('\n')}
<ReAnsi log={task.stdout_lines.slice(0, -max_lines).join('\n')} />
</pre>
</details>)}
<pre key="stdout" title="stdout">
{task.stdout_lines.slice(-max_lines).join('\n')}
<ReAnsi log={task.stdout_lines.slice(-max_lines).join('\n')} />
</pre>
</Fragment>
)}
@ -119,12 +120,12 @@ class BuildOutput extends React.Component {
{task.stderr_lines.length > max_lines && (
<details className={`${'foldable'} ${'stderr'}`}><summary></summary>
<pre key="stderr" title="stderr">
{task.stderr_lines.slice(0, -max_lines).join('\n')}
<ReAnsi log={task.stderr_lines.slice(0, -max_lines).join('\n')} />
</pre>
</details>
)}
<pre key="stderr" title="stderr">
{task.stderr_lines.slice(-max_lines).join('\n')}
<ReAnsi log={task.stderr_lines.slice(-max_lines).join('\n')} />
</pre>
</Fragment>
)}

View File

@ -15,6 +15,7 @@
import * as moment from 'moment'
import 'moment-duration-format'
import * as React from 'react'
import ReAnsi from '@softwarefactory-project/re-ansi'
import PropTypes from 'prop-types'
import ReactJson from 'react-json-view'
import {
@ -91,7 +92,7 @@ class TaskOutput extends React.Component {
} else if (typeof(value) === 'string') {
ret = (
<pre>
{value}
<ReAnsi log={value} />
</pre>
)
} else if (typeof(value) === 'object') {

View File

@ -1659,6 +1659,14 @@
lodash "^4.17.4"
read-pkg-up "^7.0.0"
"@softwarefactory-project/re-ansi@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@softwarefactory-project/re-ansi/-/re-ansi-0.4.0.tgz#016173e40077d8a0a0dbcc6b55864fe3a2271a8b"
integrity sha512-Qwmp8FRMXm7W2KFop1hrExX94uHzbjz47Yr4Nw/ql96wqb6vcLozFy412H7CRk36+h4wugquH2EjdNh1gB3oRQ==
dependencies:
bs-platform "^8.2.0"
reason-react "^0.9.1"
"@svgr/babel-plugin-add-jsx-attribute@^4.2.0":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz#dadcb6218503532d6884b210e7f3c502caaa44b1"
@ -3333,6 +3341,11 @@ browserslist@^4.0.0, browserslist@^4.11.1, browserslist@^4.12.0, browserslist@^4
node-releases "^1.1.53"
pkg-up "^2.0.0"
bs-platform@^8.2.0:
version "8.3.3"
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.3.3.tgz#68e3796ad0607c55da0f45fe14c0ce0aaf69682c"
integrity sha512-ayS5wdvrOX6PxU2wX7O2rLllzsQDzmGq582NNDFwfM6b9HQu7ki242Pc46o2/CnGHHumKVarpX0IZzjC2Llgcg==
bser@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
@ -12554,6 +12567,11 @@ realpath-native@^1.1.0:
dependencies:
util.promisify "^1.0.0"
reason-react@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.9.1.tgz#30a887158200b659aa03e2d75ff4cc54dc462bb0"
integrity sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA==
recompose@^0.26.0:
version "0.26.0"
resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.26.0.tgz#9babff039cb72ba5bd17366d55d7232fbdfb2d30"