remove old process things
This commit is contained in:
parent
af21dcc910
commit
2ca33e221d
|
@ -9,7 +9,6 @@ const navBarItems = [
|
||||||
{value: "Home", to: "/embark", icon: "home", LinkComponent: NavLink},
|
{value: "Home", to: "/embark", icon: "home", LinkComponent: NavLink},
|
||||||
{value: "Contracts", to: "/embark/contracts", icon: "box", LinkComponent: NavLink},
|
{value: "Contracts", to: "/embark/contracts", icon: "box", LinkComponent: NavLink},
|
||||||
{value: "Explorer", to: "/embark/explorer/accounts", icon: "activity", LinkComponent: NavLink},
|
{value: "Explorer", to: "/embark/explorer/accounts", icon: "activity", LinkComponent: NavLink},
|
||||||
{value: "Processes", to: "/embark/processes", icon: "cpu", LinkComponent: NavLink},
|
|
||||||
{value: "Fiddle", to: "/embark/fiddle", icon: "codepen", LinkComponent: NavLink},
|
{value: "Fiddle", to: "/embark/fiddle", icon: "codepen", LinkComponent: NavLink},
|
||||||
{value: "Documentation", to: "/embark/documentation", icon: "file-text", LinkComponent: NavLink}
|
{value: "Documentation", to: "/embark/documentation", icon: "file-text", LinkComponent: NavLink}
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
import React, {Component} from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import {Page} from "tabler-react";
|
|
||||||
import Convert from 'ansi-to-html';
|
|
||||||
import Logs from './Logs';
|
|
||||||
|
|
||||||
const convert = new Convert();
|
|
||||||
|
|
||||||
class Process extends Component {
|
|
||||||
render() {
|
|
||||||
const {processLogs, process}= this.props;
|
|
||||||
return (
|
|
||||||
<Page.Content>
|
|
||||||
<Page.Header><Page.Title className="text-capitalize">{process.name}</Page.Title></Page.Header>
|
|
||||||
<p className="text-capitalize">State: {process.state}</p>
|
|
||||||
<Logs>
|
|
||||||
{
|
|
||||||
processLogs.map((item, i) => <p key={i} className={item.logLevel} dangerouslySetInnerHTML={{__html: convert.toHtml(item.msg)}}></p>)
|
|
||||||
}
|
|
||||||
</Logs>
|
|
||||||
</Page.Content>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process.propTypes = {
|
|
||||||
process: PropTypes.object,
|
|
||||||
processLogs: PropTypes.arrayOf(PropTypes.object)
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Process;
|
|
|
@ -1,64 +0,0 @@
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import React, {Component} from 'react';
|
|
||||||
import connect from "react-redux/es/connect/connect";
|
|
||||||
import {NavLink, Route, Switch, Redirect} from 'react-router-dom';
|
|
||||||
import {
|
|
||||||
Page,
|
|
||||||
Grid,
|
|
||||||
List
|
|
||||||
} from "tabler-react";
|
|
||||||
|
|
||||||
import ProcessContainer from '../containers/ProcessContainer';
|
|
||||||
import {getProcesses} from "../reducers/selectors";
|
|
||||||
import Loading from "./Loading";
|
|
||||||
|
|
||||||
const routePrefix = '/embark/processes';
|
|
||||||
|
|
||||||
class ProcessesLayout extends Component {
|
|
||||||
render() {
|
|
||||||
if (this.props.processes.length === 0) {
|
|
||||||
return <Loading />;
|
|
||||||
}
|
|
||||||
return (<Grid.Row>
|
|
||||||
<Grid.Col md={3}>
|
|
||||||
<Page.Title className="my-5">Processes</Page.Title>
|
|
||||||
<div>
|
|
||||||
<List.Group transparent={true}>
|
|
||||||
{this.props.processes.map((process, index) => {
|
|
||||||
return (<List.GroupItem
|
|
||||||
className="d-flex align-items-center text-capitalize"
|
|
||||||
to={`${routePrefix}/${process.name}`}
|
|
||||||
key={'process-' + process.name}
|
|
||||||
active={index === 0 && this.props.match.isExact === true}
|
|
||||||
RootComponent={NavLink}
|
|
||||||
>
|
|
||||||
{process.name}
|
|
||||||
</List.GroupItem>);
|
|
||||||
})}
|
|
||||||
|
|
||||||
</List.Group>
|
|
||||||
</div>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col md={9}>
|
|
||||||
<Switch>
|
|
||||||
<Route exact path={`${routePrefix}/:processName`} component={() => <ProcessContainer />} />
|
|
||||||
<Redirect exact from={`${routePrefix}/`} to={`${routePrefix}/${this.props.processes[0].name}`} />
|
|
||||||
</Switch>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid.Row>);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessesLayout.propTypes = {
|
|
||||||
processes: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
match: PropTypes.object
|
|
||||||
};
|
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
|
||||||
return {processes: getProcesses(state)};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps
|
|
||||||
)(ProcessesLayout);
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
import React, {Component} from 'react';
|
|
||||||
import {connect} from 'react-redux';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import {withRouter} from "react-router-dom";
|
|
||||||
import {processLogs as processLogsAction, listenToProcessLogs} from '../actions';
|
|
||||||
import DataWrapper from "../components/DataWrapper";
|
|
||||||
import Process from "../components/Process";
|
|
||||||
import {getProcess, getProcessLogsByProcess} from "../reducers/selectors";
|
|
||||||
|
|
||||||
class ProcessContainer extends Component {
|
|
||||||
componentDidMount() {
|
|
||||||
if (this.props.process.state === 'running' && this.props.processLogs.length === 0) {
|
|
||||||
this.props.fetchProcessLogs(this.props.match.params.processName);
|
|
||||||
this.props.listenToProcessLogs(this.props.match.params.processName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<DataWrapper shouldRender={this.props.process !== undefined } {...this.props} render={({process, processLogs}) => (
|
|
||||||
<div className="processes-container">
|
|
||||||
<Process process={process}
|
|
||||||
processLogs={processLogs}/>
|
|
||||||
</div>
|
|
||||||
)} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessContainer.propTypes = {
|
|
||||||
fetchProcessLogs: PropTypes.func,
|
|
||||||
listenToProcessLogs: PropTypes.func,
|
|
||||||
process: PropTypes.object,
|
|
||||||
processLogs: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
error: PropTypes.string,
|
|
||||||
loading: PropTypes.bool,
|
|
||||||
match: PropTypes.object
|
|
||||||
};
|
|
||||||
|
|
||||||
function mapStateToProps(state, props) {
|
|
||||||
return {
|
|
||||||
process: getProcess(state, props.match.params.processName),
|
|
||||||
processLogs: getProcessLogsByProcess(state, props.match.params.processName),
|
|
||||||
error: state.errorMessage,
|
|
||||||
loading: state.loading
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withRouter(connect(
|
|
||||||
mapStateToProps,
|
|
||||||
{
|
|
||||||
fetchProcessLogs: processLogsAction.request,
|
|
||||||
listenToProcessLogs
|
|
||||||
}
|
|
||||||
)(ProcessContainer));
|
|
|
@ -6,7 +6,6 @@ import ContractsContainer from './containers/ContractsContainer';
|
||||||
import ContractContainer from './containers/ContractLayoutContainer';
|
import ContractContainer from './containers/ContractLayoutContainer';
|
||||||
import NoMatch from './components/NoMatch';
|
import NoMatch from './components/NoMatch';
|
||||||
import ExplorerLayout from './components/ExplorerLayout';
|
import ExplorerLayout from './components/ExplorerLayout';
|
||||||
import ProcessesLayout from './components/ProcessesLayout';
|
|
||||||
import FiddleLayout from './components/FiddleLayout';
|
import FiddleLayout from './components/FiddleLayout';
|
||||||
|
|
||||||
const routes = (
|
const routes = (
|
||||||
|
@ -14,7 +13,6 @@ const routes = (
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path="/embark/" component={HomeContainer} />
|
<Route exact path="/embark/" component={HomeContainer} />
|
||||||
<Route path="/embark/explorer/" component={ExplorerLayout} />
|
<Route path="/embark/explorer/" component={ExplorerLayout} />
|
||||||
<Route path="/embark/processes/" component={ProcessesLayout} />
|
|
||||||
<Route path="/embark/contracts/:contractName" component={ContractContainer} />
|
<Route path="/embark/contracts/:contractName" component={ContractContainer} />
|
||||||
<Route path="/embark/contracts" component={ContractsContainer} />
|
<Route path="/embark/contracts" component={ContractsContainer} />
|
||||||
<Route path="/embark/fiddle" component={FiddleLayout} />
|
<Route path="/embark/fiddle" component={FiddleLayout} />
|
||||||
|
|
Loading…
Reference in New Issue