1 | import React, { Component } from 'react'
|
2 | import ChangePasswordModal from './ChangePasswordModal.js'
|
3 | import Studio from 'jsreport-studio'
|
4 |
|
5 | export default class DataEditor extends Component {
|
6 | componentDidMount () {
|
7 | if (this.props.entity.__isNew && !this.props.entity.password) {
|
8 | Studio.openModal(ChangePasswordModal, { entity: this.props.entity })
|
9 | }
|
10 | }
|
11 |
|
12 | render () {
|
13 | const { entity, onUpdate } = this.props
|
14 |
|
15 | return <div className='custom-editor'>
|
16 | <h1><i className='fa fa-user' /> {entity.username}</h1>
|
17 | <div>
|
18 | {Studio.authentication.useEditorComponents.map((c, i) => <div key={i}>{c(entity, onUpdate)}</div>)}
|
19 | </div>
|
20 | </div>
|
21 | }
|
22 | }
|
23 |
|
24 | DataEditor.propTypes = {
|
25 | entity: React.PropTypes.object.isRequired,
|
26 | onUpdate: React.PropTypes.func.isRequired
|
27 | }
|
28 |
|
\ | No newline at end of file |