fix install and devices
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { reduxForm, formValueSelector } from 'redux-form';
|
||||
import { Trans, withTranslation } from 'react-i18next';
|
||||
import flow from 'lodash/flow';
|
||||
|
||||
@@ -10,7 +8,6 @@ import Guide from '../../components/ui/Guide';
|
||||
import Controls from './Controls';
|
||||
|
||||
import AddressList from './AddressList';
|
||||
import { FORM_NAME } from '../../helpers/constants';
|
||||
import { DhcpInterface } from '../../initialState';
|
||||
|
||||
interface DevicesProps {
|
||||
@@ -19,7 +16,7 @@ interface DevicesProps {
|
||||
dnsPort: number;
|
||||
}
|
||||
|
||||
let Devices = (props: DevicesProps) => (
|
||||
const Devices = ({ interfaces, dnsIp, dnsPort }: DevicesProps) => (
|
||||
<div className="setup__step">
|
||||
<div className="setup__group">
|
||||
<div className="setup__subtitle">
|
||||
@@ -34,7 +31,7 @@ let Devices = (props: DevicesProps) => (
|
||||
</div>
|
||||
|
||||
<div className="mt-1">
|
||||
<AddressList interfaces={props.interfaces} address={props.dnsIp} port={props.dnsPort} isDns />
|
||||
<AddressList interfaces={interfaces} address={dnsIp} port={dnsPort} isDns />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,23 +42,6 @@ let Devices = (props: DevicesProps) => (
|
||||
</div>
|
||||
);
|
||||
|
||||
const selector = formValueSelector('install');
|
||||
|
||||
Devices = connect((state) => {
|
||||
const dnsIp = selector(state, 'dns.ip');
|
||||
const dnsPort = selector(state, 'dns.port');
|
||||
|
||||
return {
|
||||
dnsIp,
|
||||
dnsPort,
|
||||
};
|
||||
})(Devices);
|
||||
|
||||
export default flow([
|
||||
withTranslation(),
|
||||
reduxForm({
|
||||
form: FORM_NAME.INSTALL,
|
||||
destroyOnUnmount: false,
|
||||
forceUnregisterOnUnmount: true,
|
||||
}),
|
||||
])(Devices);
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { reduxForm, formValueSelector } from 'redux-form';
|
||||
import { Trans, withTranslation } from 'react-i18next';
|
||||
import flow from 'lodash/flow';
|
||||
|
||||
import Controls from './Controls';
|
||||
import { FORM_NAME } from '../../helpers/constants';
|
||||
|
||||
interface SubmitProps {
|
||||
webIp: string;
|
||||
@@ -17,7 +14,7 @@ interface SubmitProps {
|
||||
openDashboard: (...args: unknown[]) => unknown;
|
||||
}
|
||||
|
||||
let Submit = (props: SubmitProps) => (
|
||||
const Submit = (props: SubmitProps) => (
|
||||
<div className="setup__step">
|
||||
<div className="setup__group">
|
||||
<h1 className="setup__title">
|
||||
@@ -29,27 +26,11 @@ let Submit = (props: SubmitProps) => (
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* TODO props webIp webPort */}
|
||||
<Controls openDashboard={props.openDashboard} ip={props.webIp} port={props.webPort} />
|
||||
</div>
|
||||
);
|
||||
|
||||
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([
|
||||
withTranslation(),
|
||||
reduxForm({
|
||||
form: FORM_NAME.INSTALL,
|
||||
destroyOnUnmount: false,
|
||||
forceUnregisterOnUnmount: true,
|
||||
}),
|
||||
])(Submit);
|
||||
|
||||
@@ -89,9 +89,9 @@ const Setup = () => {
|
||||
case 3:
|
||||
return <Auth onAuthSubmit={handleFormSubmit} />;
|
||||
case 4:
|
||||
return <Devices interfaces={interfaces} />;
|
||||
return <Devices interfaces={interfaces} dnsIp={dns.ip} dnsPort={dns.port} />;
|
||||
case 5:
|
||||
return <Submit openDashboard={openDashboard} />;
|
||||
return <Submit openDashboard={openDashboard} webIp={web.ip} webPort={web.port} />;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user