Farmbot-Web-App/frontend/devices/devices.tsx

54 lines
2.0 KiB
TypeScript
Raw Normal View History

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";
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">
<Row>
<Col xs={12} sm={6}>
<FarmbotOsSettings
2019-06-07 18:26:12 -06:00
deviceAccount={this.props.deviceAccount}
dispatch={this.props.dispatch}
2019-07-12 14:39:40 -06:00
alerts={this.props.alerts}
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}
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} />
</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}
bot={this.props.bot}
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} />
</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);