feat(contrainers/HomeContainer): introduce contracts list in dashboard

This commit is contained in:
Pascal Precht 2018-10-08 11:34:51 +02:00
parent 35d86beab7
commit 588641222b
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 21 additions and 1 deletions

View File

@ -3,12 +3,23 @@ import React, {Component} from 'react';
import {connect} from 'react-redux';
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 Processes from '../components/Processes';
import Console from '../components/Console';
import {getProcesses, getProcessLogs} from "../reducers/selectors";
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 {
constructor(props) {
@ -38,6 +49,7 @@ class HomeContainer extends Component {
this.props.listenToProcessLogs(processName);
}
this.props.fetchContracts();
this.setState({activeProcess: processName});
}
@ -48,6 +60,11 @@ class HomeContainer extends Component {
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({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}) => (
<Console activeProcess={this.state.activeProcess}
@ -72,6 +89,8 @@ HomeContainer.propTypes = {
function mapStateToProps(state) {
return {
processes: getProcesses(state),
contracts: getContracts(state),
commands: getCommands(state),
error: state.errorMessage,
processLogs: getProcessLogs(state),
loading: state.loading
@ -83,6 +102,7 @@ export default connect(
{
postCommand: commandsAction.post,
fetchProcessLogs: processLogsAction.request,
fetchContracts: contractsAction.request,
listenToProcessLogs,
stopProcessLogs
}