import React from 'react' class ConfigList extends React.Component { constructor() { super() this.handleChange = this.handleChange.bind(this) } componentDidMount () { console.log('ConfigList did mount', this) const { configGetRequest } = this.props.configActions configGetRequest() } handleChange (event) { event.preventDefault() const { configChangeForm } = this.props.configActions const nextConfig = { _id: this.configid ? this.configid.value : null, key: this.key.value, description: this.description.value, value: this.value.value } configChangeForm(nextConfig) } render () { const state = this.props.config const actions = this.props.configActions const config = state.configForm return (

{(config._id) ? "Konfiguration editieren" : "Neue Konfiguration"}

{config._id ? {this.configid = input}} id="configid"/> : null} {this.key = input}} id="key" value={config.key} placeholder="Schluessel" onChange={this.handleChange} readOnly={!!config._id}> {this.description = input}} id="description" value={config.description} placeholder="Beschreibung" onChange={this.handleChange}> {this.value = input}} id="value" value={config.value} placeholder="Wert" onChange={this.handleChange}> { event.preventDefault() if (config._id) { actions.configEditRequest(config) } else { actions.configAddRequest(config) } }} /> { event.preventDefault() actions.configClearForm(event) }} />
{state.configs ? state.configs.map((configData, key) => ) : ""}
SchluesselBeschreibungWertWert
{configData.key} {configData.description} {configData.value} actions.configLoadForm(key)}>editieren actions.configDeleteRequest(key)}>loeschen
) } } export default ConfigList