2017-11-09 09:45:11 -07:00
|
|
|
import * as React from "react";
|
|
|
|
import { Row, Col } from "../../../ui/index";
|
2019-04-02 13:59:37 -06:00
|
|
|
|
2017-12-07 21:05:22 -07:00
|
|
|
import { ColWidth } from "../farmbot_os_settings";
|
2018-01-10 17:37:36 -07:00
|
|
|
import { ToggleButton } from "../../../controls/toggle_button";
|
|
|
|
import { updateConfig } from "../../actions";
|
|
|
|
import { Content } from "../../../constants";
|
2018-01-27 02:29:13 -07:00
|
|
|
import { AutoUpdateRowProps } from "./interfaces";
|
2019-04-02 13:59:37 -06:00
|
|
|
import { t } from "../../../i18next_wrapper";
|
2017-11-09 09:45:11 -07:00
|
|
|
|
|
|
|
export function AutoUpdateRow(props: AutoUpdateRowProps) {
|
2018-01-27 02:29:13 -07:00
|
|
|
const osAutoUpdate = props.sourceFbosConfig("os_auto_update");
|
2017-11-09 09:45:11 -07:00
|
|
|
return <Row>
|
2017-12-07 21:05:22 -07:00
|
|
|
<Col xs={ColWidth.label}>
|
2017-11-09 09:45:11 -07:00
|
|
|
<label>
|
2018-01-11 23:18:26 -07:00
|
|
|
{t("FARMBOT OS AUTO UPDATE")}
|
2017-11-09 09:45:11 -07:00
|
|
|
</label>
|
|
|
|
</Col>
|
2018-01-11 23:18:26 -07:00
|
|
|
<Col xs={ColWidth.description}>
|
|
|
|
<p>
|
|
|
|
{t(Content.OS_AUTO_UPDATE)}
|
|
|
|
</p>
|
2017-11-09 09:45:11 -07:00
|
|
|
</Col>
|
2018-01-11 23:18:26 -07:00
|
|
|
<Col xs={ColWidth.button}>
|
2018-01-27 02:29:13 -07:00
|
|
|
<ToggleButton toggleValue={osAutoUpdate.value}
|
|
|
|
dim={!osAutoUpdate.consistent}
|
2018-01-11 23:18:26 -07:00
|
|
|
toggleAction={() => {
|
2018-01-27 02:29:13 -07:00
|
|
|
const newOsAutoUpdateNum = !osAutoUpdate.value ? 1 : 0;
|
|
|
|
props.dispatch(updateConfig({ os_auto_update: newOsAutoUpdateNum }));
|
2018-01-11 23:18:26 -07:00
|
|
|
}} />
|
2017-11-09 09:45:11 -07:00
|
|
|
</Col>
|
|
|
|
</Row>;
|
|
|
|
}
|