2017-06-29 12:54:02 -06:00
|
|
|
import * as React from "react";
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
import { HardwareSettings } from "./components/hardware_settings";
|
|
|
|
import { FarmbotOsSettings } from "./components/farmbot_os_settings";
|
2018-01-20 07:46:44 -07:00
|
|
|
import { Page, Col, Row } from "../ui/index";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { mapStateToProps } from "./state_to_props";
|
|
|
|
import { Props } from "./interfaces";
|
2019-07-15 16:53:28 -06:00
|
|
|
import { isFwHardwareValue } from "./components/firmware_hardware_support";
|
2020-03-13 15:06:40 -06:00
|
|
|
import { maybeOpenPanel } from "./components/maybe_highlight";
|
2017-09-25 12:37:24 -06:00
|
|
|
|
2019-09-19 13:09:00 -06:00
|
|
|
export class RawDevices extends React.Component<Props, {}> {
|
2020-03-13 15:06:40 -06:00
|
|
|
|
|
|
|
componentDidMount = () =>
|
|
|
|
this.props.dispatch(maybeOpenPanel(this.props.bot.controlPanelState));
|
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
render() {
|
|
|
|
if (this.props.auth) {
|
2019-06-03 17:41:59 -06:00
|
|
|
const { value } = this.props.sourceFbosConfig("firmware_hardware");
|
|
|
|
const firmwareHardware = isFwHardwareValue(value) ? value : undefined;
|
2019-02-06 18:36:11 -07:00
|
|
|
return <Page className="device-page">
|
2017-10-25 17:02:39 -06:00
|
|
|
<Row>
|
|
|
|
<Col xs={12} sm={6}>
|
|
|
|
<FarmbotOsSettings
|
2019-06-07 18:26:12 -06:00
|
|
|
deviceAccount={this.props.deviceAccount}
|
2017-10-25 17:02:39 -06:00
|
|
|
dispatch={this.props.dispatch}
|
2019-07-12 14:39:40 -06:00
|
|
|
alerts={this.props.alerts}
|
2017-10-25 17:02:39 -06:00
|
|
|
bot={this.props.bot}
|
2019-04-09 23:17:03 -06:00
|
|
|
timeSettings={this.props.timeSettings}
|
2018-03-07 22:08:00 -07:00
|
|
|
sourceFbosConfig={this.props.sourceFbosConfig}
|
2018-03-10 02:42:15 -07:00
|
|
|
shouldDisplay={this.props.shouldDisplay}
|
2018-11-01 11:17:18 -06:00
|
|
|
env={this.props.env}
|
2020-03-13 15:06:40 -06:00
|
|
|
saveFarmwareEnv={this.props.saveFarmwareEnv} />
|
2017-10-25 17:02:39 -06:00
|
|
|
</Col>
|
|
|
|
<Col xs={12} sm={6}>
|
|
|
|
<HardwareSettings
|
|
|
|
controlPanelState={this.props.bot.controlPanelState}
|
|
|
|
dispatch={this.props.dispatch}
|
2019-06-21 15:45:44 -06:00
|
|
|
resources={this.props.resources}
|
2018-01-15 09:36:10 -07:00
|
|
|
bot={this.props.bot}
|
2018-05-02 01:05:02 -06:00
|
|
|
shouldDisplay={this.props.shouldDisplay}
|
2019-06-03 17:41:59 -06:00
|
|
|
firmwareHardware={firmwareHardware}
|
2018-03-09 02:34:24 -07:00
|
|
|
sourceFwConfig={this.props.sourceFwConfig}
|
2018-03-08 21:03:02 -07:00
|
|
|
firmwareConfig={this.props.firmwareConfig} />
|
2017-10-25 17:02:39 -06:00
|
|
|
</Col>
|
|
|
|
</Row>
|
2017-06-29 12:54:02 -06:00
|
|
|
</Page>;
|
|
|
|
} else {
|
|
|
|
throw new Error("Log in first");
|
|
|
|
}
|
|
|
|
}
|
2017-07-04 07:20:51 -06:00
|
|
|
}
|
2019-09-19 13:09:00 -06:00
|
|
|
|
|
|
|
export const Devices = connect(mapStateToProps)(RawDevices);
|