2018-05-22 12:41:39 +02:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import FlatButton from 'material-ui/FlatButton';
|
2018-05-23 04:48:57 +02:00
|
|
|
import Dialog from 'react-dialog'
|
|
|
|
|
|
|
|
|
|
import 'react-dialog/css/index.css';
|
2018-05-22 12:41:39 +02:00
|
|
|
|
|
|
|
|
export class ValidationErrorsInfoDialog extends React.Component {
|
2018-05-21 17:21:23 +02:00
|
|
|
|
|
|
|
|
state = {
|
2018-05-22 12:41:39 +02:00
|
|
|
open: this.props.open,
|
|
|
|
|
}
|
2018-05-21 17:21:23 +02:00
|
|
|
|
|
|
|
|
componentWillReceiveProps(newProps){
|
|
|
|
|
this.setState({open: newProps.open});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleOpen = () => {
|
|
|
|
|
this.setState({ open: true });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleClose = () => {
|
|
|
|
|
this.setState({ open: false });
|
|
|
|
|
this.props.onDismiss();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
2018-05-23 04:48:57 +02:00
|
|
|
|
2018-05-21 17:21:23 +02:00
|
|
|
const actions = [
|
|
|
|
|
<FlatButton
|
|
|
|
|
label="Dismiss"
|
|
|
|
|
primary={true}
|
|
|
|
|
keyboardFocused={true}
|
|
|
|
|
onClick={this.handleClose}
|
|
|
|
|
/>,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
2018-05-23 04:48:57 +02:00
|
|
|
<div className="container">
|
|
|
|
|
{
|
|
|
|
|
this.state.open &&
|
|
|
|
|
<Dialog
|
|
|
|
|
title={this.props.title ? this.props.title : 'Error'}
|
|
|
|
|
isDraggable={this.props.draggable ? this.props.draggable : false}
|
|
|
|
|
buttons={actions}
|
|
|
|
|
hasCloseIcon={false}
|
|
|
|
|
>
|
|
|
|
|
{this.props.errorMessages.map(errorMessage => {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<a>{errorMessage.message}</a>
|
|
|
|
|
<br/>
|
|
|
|
|
</div>
|
|
|
|
|
);})
|
|
|
|
|
}
|
|
|
|
|
</Dialog>
|
|
|
|
|
}
|
2018-05-21 17:21:23 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2018-05-22 12:41:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-05-21 17:21:23 +02:00
|
|
|
module.exports = ValidationErrorsInfoDialog;
|