feat(contrainers/HomeContainer): introduce contracts list in dashboard
This commit is contained in:
parent
35d86beab7
commit
588641222b
|
@ -3,12 +3,23 @@ import React, {Component} from 'react';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {Page} from "tabler-react";
|
import {Page} from "tabler-react";
|
||||||
|
|
||||||
import {commands as commandsAction, listenToProcessLogs, processLogs as processLogsAction, stopProcessLogs} from "../actions";
|
import {
|
||||||
|
contracts as contractsAction,
|
||||||
|
commands as commandsAction,
|
||||||
|
listenToProcessLogs,
|
||||||
|
processLogs as processLogsAction,
|
||||||
|
stopProcessLogs
|
||||||
|
} from "../actions";
|
||||||
|
|
||||||
import DataWrapper from "../components/DataWrapper";
|
import DataWrapper from "../components/DataWrapper";
|
||||||
import Processes from '../components/Processes';
|
import Processes from '../components/Processes';
|
||||||
import Console from '../components/Console';
|
import Console from '../components/Console';
|
||||||
import {getProcesses, getProcessLogs} from "../reducers/selectors";
|
import {getProcesses, getProcessLogs} from "../reducers/selectors";
|
||||||
import {EMBARK_PROCESS_NAME} from '../constants';
|
import {EMBARK_PROCESS_NAME} from '../constants';
|
||||||
|
import ContractsList from '../components/ContractsList';
|
||||||
|
import {getContracts, getProcesses, getCommands, getProcessLogs} from "../reducers/selectors";
|
||||||
|
|
||||||
|
const EMBARK_PROCESS_NAME = 'Embark';
|
||||||
|
|
||||||
class HomeContainer extends Component {
|
class HomeContainer extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -38,6 +49,7 @@ class HomeContainer extends Component {
|
||||||
this.props.listenToProcessLogs(processName);
|
this.props.listenToProcessLogs(processName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.props.fetchContracts();
|
||||||
this.setState({activeProcess: processName});
|
this.setState({activeProcess: processName});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +60,11 @@ class HomeContainer extends Component {
|
||||||
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes}) => (
|
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes}) => (
|
||||||
<Processes processes={processes} />
|
<Processes processes={processes} />
|
||||||
)} />
|
)} />
|
||||||
|
<DataWrapper shouldRender={this.props.contracts.length > 0} {...this.props} render={({contracts}) => (
|
||||||
|
<div style={{maxHeight: '227px', marginBottom: '1.5rem', overflow: 'auto'}}>
|
||||||
|
<ContractsList contracts={contracts} />
|
||||||
|
</div>
|
||||||
|
)} />
|
||||||
|
|
||||||
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes, postCommand, processLogs}) => (
|
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes, postCommand, processLogs}) => (
|
||||||
<Console activeProcess={this.state.activeProcess}
|
<Console activeProcess={this.state.activeProcess}
|
||||||
|
@ -72,6 +89,8 @@ HomeContainer.propTypes = {
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
return {
|
return {
|
||||||
processes: getProcesses(state),
|
processes: getProcesses(state),
|
||||||
|
contracts: getContracts(state),
|
||||||
|
commands: getCommands(state),
|
||||||
error: state.errorMessage,
|
error: state.errorMessage,
|
||||||
processLogs: getProcessLogs(state),
|
processLogs: getProcessLogs(state),
|
||||||
loading: state.loading
|
loading: state.loading
|
||||||
|
@ -83,6 +102,7 @@ export default connect(
|
||||||
{
|
{
|
||||||
postCommand: commandsAction.post,
|
postCommand: commandsAction.post,
|
||||||
fetchProcessLogs: processLogsAction.request,
|
fetchProcessLogs: processLogsAction.request,
|
||||||
|
fetchContracts: contractsAction.request,
|
||||||
listenToProcessLogs,
|
listenToProcessLogs,
|
||||||
stopProcessLogs
|
stopProcessLogs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue