import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import Group from '../common/group.component'
import Param from '../common/param.component'
import * as systemActions from './system.actions'
class System extends Component {
constructor(props){
super()
}
render(){
const { site, server, relay, rpc, actions } = this.props
return (
{site.name} System
{server.status}
{server.error &&
{server.error.message}
}
{relay.status}
{rpc.status}
pix2pix dataset.py
pix2pix train.py
train samplernn
{this.renderCommandOutput()}
)
}
renderCommandOutput(){
const { cmd } = this.props
let output
if (cmd.loading) {
output = 'Loading: ' + cmd.name
}
else if (cmd.loaded) {
if (cmd.error) {
output = 'Error: ' + cmd.name + '\n\n' + JSON.stringify(cmd.error, null, 2)
} else {
output = cmd.stdout
if (cmd.stderr) {
output += '\n\n_________________________________\n\n'
output += cmd.stderr
}
}
}
return (
)
}
}
const mapStateToProps = state => ({
...state.system
})
const mapDispatchToProps = (dispatch, ownProps) => ({
actions: bindActionCreators(systemActions, dispatch)
})
export default connect(mapStateToProps, mapDispatchToProps)(System)