/** * File: dialog-new-visualization.js * Author: Markus Grigull * Date: 03.03.2017 * Copyright: 2017, Institute for Automation of Complex Power Systems, EONERC * This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential. * Unauthorized copying of this file, via any medium is strictly prohibited. **********************************************************************************/ import React, { Component, PropTypes } from 'react'; import { FormGroup, FormControl, ControlLabel } from 'react-bootstrap'; import Dialog from './dialog'; class EditVisualizationDialog extends Component { static propTypes = { show: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired, visualization: PropTypes.object.isRequired }; valid: false; constructor(props) { super(props); this.state = { name: '', _id: '' } } onClose(canceled) { if (canceled === false) { this.props.onClose(this.state); } else { this.props.onClose(); } } handleChange(e) { this.setState({ [e.target.id]: e.target.value }); } resetState() { this.setState({ name: this.props.visualization.name, _id: this.props.visualization._id }); } validateForm(target) { // check all controls var name = true; if (this.state.name === '') { name = false; } this.valid = name; // return state to control if (target === 'name') return name ? "success" : "error"; return "success"; } render() { return ( this.onClose(c)} onReset={() => this.resetState()} valid={this.valid}>
Name this.handleChange(e)} />
); } } export default EditVisualizationDialog;