Add ascii color conversion
This commit is contained in:
parent
45cc50c371
commit
f592145b60
|
@ -135,6 +135,14 @@
|
|||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"ansi-to-html": {
|
||||
"version": "0.6.6",
|
||||
"resolved": "https://registry.npmjs.org/ansi-to-html/-/ansi-to-html-0.6.6.tgz",
|
||||
"integrity": "sha512-90M/2sZna3OsoOEbSyXK46poFnlClBC53Rx6etNKQK7iShsX5fI5E/M9Ld6FurtLaxAWLuAPi0Jp8p3y5oAkxg==",
|
||||
"requires": {
|
||||
"entities": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"anymatch": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"ansi-to-html": "^0.6.6",
|
||||
"react": "^16.5.0",
|
||||
"react-dom": "^16.5.0",
|
||||
"react-router-dom": "^4.3.1",
|
||||
|
|
|
@ -5,6 +5,9 @@ import Timestamp from './timestamp.js'
|
|||
import { api, httpGET, httpStreamGET } from '../http.js'
|
||||
import './output.css'
|
||||
|
||||
let Convert = require('ansi-to-html')
|
||||
let converter = new Convert()
|
||||
|
||||
export default class Output extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
@ -54,6 +57,7 @@ export default class Output extends Component {
|
|||
let xhr = httpStreamGET(api("/jobs/" + id + "/log"),
|
||||
(chunk) => { // Progress
|
||||
let target = this.refs["output"]
|
||||
chunk = converter.toHtml(chunk)
|
||||
target.innerHTML += chunk.replace(/\n/g, "<br/>")
|
||||
this.autoScroll()
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue