58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import PropTypes from 'prop-types';
|
|
import { reduxForm, formValueSelector } from 'redux-form';
|
|
import { Trans, withNamespaces } from 'react-i18next';
|
|
import flow from 'lodash/flow';
|
|
|
|
import Controls from './Controls';
|
|
import { getWebAddress } from '../../helpers/helpers';
|
|
|
|
let Submit = props => (
|
|
<div className="setup__step">
|
|
<div className="setup__group">
|
|
<h1 className="setup__title">
|
|
<Trans>install_submit_title</Trans>
|
|
</h1>
|
|
<p className="setup__desc">
|
|
<Trans>install_submit_desc</Trans>
|
|
</p>
|
|
</div>
|
|
<Controls
|
|
openDashboard={props.openDashboard}
|
|
address={getWebAddress(props.webIp, props.webPort)}
|
|
/>
|
|
</div>
|
|
);
|
|
|
|
Submit.propTypes = {
|
|
webIp: PropTypes.string.isRequired,
|
|
webPort: PropTypes.number.isRequired,
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
pristine: PropTypes.bool.isRequired,
|
|
submitting: PropTypes.bool.isRequired,
|
|
openDashboard: PropTypes.func.isRequired,
|
|
};
|
|
|
|
const selector = formValueSelector('install');
|
|
|
|
Submit = connect((state) => {
|
|
const webIp = selector(state, 'web.ip');
|
|
const webPort = selector(state, 'web.port');
|
|
|
|
return {
|
|
webIp,
|
|
webPort,
|
|
};
|
|
})(Submit);
|
|
|
|
|
|
export default flow([
|
|
withNamespaces(),
|
|
reduxForm({
|
|
form: 'install',
|
|
destroyOnUnmount: false,
|
|
forceUnregisterOnUnmount: true,
|
|
}),
|
|
])(Submit);
|