Merge branch 'staging' into grid_planting

pull/1575/head
Rick Carlino 2019-11-14 08:01:04 -06:00
commit 2f4f470499
6 changed files with 9 additions and 3 deletions

View File

@ -43,7 +43,7 @@ describe("<FarmbotOsSettings />", () => {
botToMqttStatus: "up",
sourceFbosConfig: x =>
({ value: bot.hardware.configuration[x], consistent: true }),
shouldDisplay: jest.fn(),
shouldDisplay: jest.fn(() => true),
isValidFbosConfig: false,
env: {},
saveFarmwareEnv: jest.fn(),

View File

@ -138,6 +138,7 @@ export class FarmbotOsSettings
timeSettings={this.props.timeSettings}
sourceFbosConfig={sourceFbosConfig} />
<AutoUpdateRow
shouldDisplay={this.props.shouldDisplay}
timeFormat={timeFormat}
device={this.props.deviceAccount}
dispatch={this.props.dispatch}

View File

@ -21,6 +21,7 @@ describe("<AutoUpdateRow/>", () => {
const fakeProps = (): AutoUpdateRowProps => ({
timeFormat: "12h",
shouldDisplay: jest.fn(() => true),
device: fakeDevice(),
dispatch: jest.fn(x => x(jest.fn(), () => state)),
sourceFbosConfig: () => ({ value: 1, consistent: true })

View File

@ -7,15 +7,17 @@ import { Content } from "../../../constants";
import { AutoUpdateRowProps } from "./interfaces";
import { t } from "../../../i18next_wrapper";
import { OtaTimeSelector, changeOtaHour } from "./ota_time_selector";
import { Feature } from "../../interfaces";
export function AutoUpdateRow(props: AutoUpdateRowProps) {
const osAutoUpdate = props.sourceFbosConfig("os_auto_update");
return <div>
<OtaTimeSelector
{props.shouldDisplay(Feature.ota_update_hour) && <OtaTimeSelector
timeFormat={props.timeFormat}
disabled={!osAutoUpdate.value}
value={props.device.body.ota_hour}
onChange={changeOtaHour(props.dispatch, props.device)} />
onChange={changeOtaHour(props.dispatch, props.device)} />}
<Row>
<Col xs={ColWidth.label}>
<label>

View File

@ -24,6 +24,7 @@ export interface AutoUpdateRowProps {
timeFormat: PreferredHourFormat;
sourceFbosConfig: SourceFbosConfig;
device: TaggedDevice;
shouldDisplay: ShouldDisplay;
}
export interface CameraSelectionProps {

View File

@ -86,6 +86,7 @@ export enum Feature {
mark_as_step = "mark_as_step",
named_pins = "named_pins",
none_firmware = "none_firmware",
ota_update_hour = "ota_update_hour",
rpi_led_control = "rpi_led_control",
sensors = "sensors",
use_update_channel = "use_update_channel",