From 5731f7e1df5d7f8ba09848306b9916dc7ca63614 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Tue, 7 Aug 2018 10:34:40 +0100 Subject: [PATCH] Add processes to home --- embark-ui/package.json | 1 + embark-ui/src/components/Process.js | 4 +- embark-ui/src/components/Processes.js | 44 +++++++++++++++ embark-ui/src/components/ProcessesLayout.js | 2 +- embark-ui/src/components/Status.js | 61 --------------------- embark-ui/src/containers/HomeContainer.js | 15 ++++- embark-ui/src/general.css | 4 -- 7 files changed, 60 insertions(+), 71 deletions(-) create mode 100644 embark-ui/src/components/Processes.js delete mode 100644 embark-ui/src/components/Status.js diff --git a/embark-ui/package.json b/embark-ui/package.json index 830597e9e..27d4e9ee9 100644 --- a/embark-ui/package.json +++ b/embark-ui/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "axios": "^0.18.0", + "classnames": "^2.2.6", "connected-react-router": "^4.3.0", "history": "^4.7.2", "prop-types": "^15.6.2", diff --git a/embark-ui/src/components/Process.js b/embark-ui/src/components/Process.js index 7a73e064b..ac197dc8e 100644 --- a/embark-ui/src/components/Process.js +++ b/embark-ui/src/components/Process.js @@ -7,8 +7,8 @@ class Process extends Component { render() { const logs = this.props.logs; return ( - -

State: {this.props.state}

+ +

State: {this.props.state}

{!logs && } {logs && diff --git a/embark-ui/src/components/Processes.js b/embark-ui/src/components/Processes.js new file mode 100644 index 000000000..56338ca05 --- /dev/null +++ b/embark-ui/src/components/Processes.js @@ -0,0 +1,44 @@ +import PropTypes from "prop-types"; +import React from 'react'; +import {Link} from "react-router-dom"; +import {Grid, Card} from 'tabler-react'; +import classNames from 'classnames'; + +function stampClasses(state){ + return classNames('stamp stamp-md mr-3', { + 'bg-green': state === 'running', + 'bg-danger': state !== 'running' + }); +} + +const Process = ({name, state}) => ( + + +
+ + + +
+

{name}

+
+
+
+
+); + +Process.propTypes = { + name: PropTypes.string, + state: PropTypes.string +}; + +const Processes = ({processes}) => ( + + {Object.keys(processes).map((name) => )} + +); + +Processes.propTypes = { + processes: PropTypes.object, +}; + +export default Processes; diff --git a/embark-ui/src/components/ProcessesLayout.js b/embark-ui/src/components/ProcessesLayout.js index 25e93774f..01b8592e2 100644 --- a/embark-ui/src/components/ProcessesLayout.js +++ b/embark-ui/src/components/ProcessesLayout.js @@ -28,7 +28,7 @@ class ProcessesLayout extends Component { {processNames.map((processName, index) => { return ( ( - - - -
- - - -
-

IPFS

- version 2.5 -
-
-
-
- - -
- - - -
-

Ethereum

- Geth 1.6.7-stable -
-
-
-
- - -
- - - -
-

Whisper

- V5 -
-
-
-
- - -
- - - -
-

Webserver

- http://localhost:8000 -
-
-
-
-
-); - -export default Status; diff --git a/embark-ui/src/containers/HomeContainer.js b/embark-ui/src/containers/HomeContainer.js index 9b8e88911..f5cb2c159 100644 --- a/embark-ui/src/containers/HomeContainer.js +++ b/embark-ui/src/containers/HomeContainer.js @@ -1,8 +1,9 @@ +import PropTypes from "prop-types"; import React, {Component} from 'react'; import {connect} from 'react-redux'; import {Page} from "tabler-react"; -import Status from '../components/Status'; +import Processes from '../components/Processes'; import Console from '../components/Console'; class HomeContainer extends Component { @@ -10,14 +11,22 @@ class HomeContainer extends Component { return ( Dashboard - + {this.props.processes.data && } ); } } +HomeContainer.propTypes = { + processes: PropTypes.object +}; + +function mapStateToProps(state) { + return {processes: state.processes}; +} + export default connect( - null, + mapStateToProps, null, )(HomeContainer); diff --git a/embark-ui/src/general.css b/embark-ui/src/general.css index 60588a998..fb95550c1 100644 --- a/embark-ui/src/general.css +++ b/embark-ui/src/general.css @@ -20,7 +20,3 @@ .logs .trace { color: #8f98a2; } - -.capitalize { - text-transform: capitalize; -}