add autoscroll and limit height

This commit is contained in:
Jonathan Rainville 2018-09-05 16:21:41 -04:00 committed by Pascal Precht
parent 0df3a84227
commit 77117c0a76
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
3 changed files with 43 additions and 12 deletions

View File

@ -0,0 +1,14 @@
import React from 'react';
import autoscroll from 'autoscroll-react';
class Logs extends React.Component {
render() {
return (
<div className="logs" {...this.props}>
{this.props.children}
</div>
);
}
}
export default autoscroll(Logs);

View File

@ -2,6 +2,8 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {Page} from "tabler-react"; import {Page} from "tabler-react";
import Convert from 'ansi-to-html'; import Convert from 'ansi-to-html';
import Logs from './Logs';
const convert = new Convert(); const convert = new Convert();
class Process extends Component { class Process extends Component {
@ -11,11 +13,11 @@ class Process extends Component {
<Page.Content> <Page.Content>
<Page.Header><Page.Title className="text-capitalize">{process.name}</Page.Title></Page.Header> <Page.Header><Page.Title className="text-capitalize">{process.name}</Page.Title></Page.Header>
<p className="text-capitalize">State: {process.state}</p> <p className="text-capitalize">State: {process.state}</p>
<div className="logs"> <Logs>
{ {
processLogs.map((item, i) => <p key={i} className={item.logLevel} dangerouslySetInnerHTML={{__html: convert.toHtml(item.msg)}}></p>) processLogs.map((item, i) => <p key={i} className={item.logLevel} dangerouslySetInnerHTML={{__html: convert.toHtml(item.msg)}}></p>)
} }
</div> </Logs>
</Page.Content> </Page.Content>
); );
} }

View File

@ -1,22 +1,27 @@
.logs { .logs {
margin: 10px 0; margin: 10px 0;
background-color: #333333; background-color: #333333;
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 14px; font-size: 14px;
color: white; color: white;
padding: 10px; padding: 10px;
border-radius: 8px; border-radius: 8px;
max-height: 400px;
overflow: auto;
} }
.logs .error { .logs .error {
color: #dc3546; color: #dc3546;
} }
.logs .warn { .logs .warn {
color: #fec107; color: #fec107;
} }
.logs .debug { .logs .debug {
color: #b7c1cc; color: #b7c1cc;
} }
.logs .trace { .logs .trace {
color: #8f98a2; color: #8f98a2;
} }
@ -25,38 +30,48 @@
white-space: pre-wrap; white-space: pre-wrap;
font-family: monospace; font-family: monospace;
} }
.card.card-fullscreen{
.card.card-fullscreen {
z-index: 6; z-index: 6;
} }
.card.warnings-card, .card.errors-card{
.card.warnings-card, .card.errors-card {
text-transform: capitalize; text-transform: capitalize;
} }
.card.warnings-card .card-options a, .card.errors-card .card-options a{
cursor:pointer; .card.warnings-card .card-options a, .card.errors-card .card-options a {
cursor: pointer;
} }
.compilation-summary { .compilation-summary {
float: right; float: right;
margin-bottom: 3px; margin-bottom: 3px;
visibility: hidden; visibility: hidden;
} }
.compilation-summary.visible{
.compilation-summary.visible {
visibility: visible; visibility: visible;
} }
.compilation-summary .badge-link:not(:last-child){
.compilation-summary .badge-link:not(:last-child) {
margin-right: 5px; margin-right: 5px;
} }
.ace_editor { .ace_editor {
margin-bottom: 24px; margin-bottom: 24px;
} }
.loader, .loader:before, .loader:after{
.loader, .loader:before, .loader:after {
width: 1.2rem; width: 1.2rem;
height: 1.2rem; height: 1.2rem;
} }
.loader:before, .loader:after{
.loader:before, .loader:after {
margin: -0.6rem 0 0 -0.6rem; margin: -0.6rem 0 0 -0.6rem;
left: 0; left: 0;
} }
.loader, .loader-text{
.loader, .loader-text {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
padding-left: 0.6rem; padding-left: 0.6rem;