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