Upgrade i18next

pull/1137/head
Rick Carlino 2019-04-02 14:59:37 -05:00
parent 977f7244a4
commit 5aa5fccad4
243 changed files with 498 additions and 261 deletions

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { t } from "./i18next_wrapper";
// No reusability here. Why not just keep it from taking up sass?
const STYLES: React.CSSProperties = {

View File

@ -33,7 +33,7 @@ jest.mock("../routes", () => {
import { stopIE } from "../util/stop_ie";
import { shortRevision } from "../util/util";
import { detectLanguage } from "../i18n";
import { init } from "i18next";
import I from "i18next";
describe("entry file", () => {
it("Calls the expected callbacks", async () => {
@ -42,6 +42,6 @@ describe("entry file", () => {
expect(stopIE).toHaveBeenCalled();
expect(shortRevision).toHaveBeenCalled();
expect(detectLanguage).toHaveBeenCalled();
expect(init).toHaveBeenCalled();
expect(I.init).toHaveBeenCalled();
});
});

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import {
Widget,
WidgetHeader,
@ -14,6 +14,7 @@ import { success, error } from "farmbot-toastr/dist";
import { Content } from "../../constants";
import { uniq } from "lodash";
import { BlurablePassword } from "../../ui/blurable_password";
import { t } from "../../i18next_wrapper";
interface PasswordForm {
new_password: string;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import {
Widget,
WidgetHeader,
@ -10,6 +10,7 @@ import {
import { DeleteAccountProps, DeleteAccountState } from "../interfaces";
import { Content } from "../../constants";
import { BlurablePassword } from "../../ui/blurable_password";
import { t } from "../../i18next_wrapper";
export class DeleteAccount extends
React.Component<DeleteAccountProps, DeleteAccountState> {

View File

@ -1,7 +1,8 @@
import * as React from "react";
import { Widget, WidgetHeader, WidgetBody, Row, Col } from "../../ui";
import { Content } from "../../constants";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export function ExportAccountPanel(props: { onClick: () => void }) {
return <Widget>

View File

@ -1,9 +1,10 @@
import * as React from "react";
import { t } from "i18next";
import {
BlurableInput, Widget, WidgetHeader, WidgetBody, SaveBtn
} from "../../ui/index";
import { SettingsPropTypes } from "../interfaces";
import { t } from "../../i18next_wrapper";
export class Settings extends React.Component<SettingsPropTypes, {}> {
render() {

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import { connect } from "react-redux";
import { Settings, DeleteAccount, ChangePassword } from "./components";
import { Props } from "./interfaces";
@ -16,6 +15,7 @@ import { requestAccountExport } from "./request_account_export";
import { DevWidget } from "./dev/dev_widget";
import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app";
import { DevMode } from "./dev/dev_mode";
import { t } from "../i18next_wrapper";
const KEYS: (keyof User)[] = ["id", "name", "email", "created_at", "updated_at"];

View File

@ -2,9 +2,10 @@ import * as React from "react";
import { WidgetHeader, Widget, WidgetBody } from "../../ui/index";
import { LabsFeaturesList } from "./labs_features_list_ui";
import { maybeToggleFeature } from "./labs_features_list_data";
import { t } from "i18next";
import { ToolTips } from "../../constants";
import { GetWebAppConfigValue } from "../../config_storage/actions";
import { t } from "../../i18next_wrapper";
interface LabsFeaturesProps {
getConfigValue: GetWebAppConfigValue;

View File

@ -1,9 +1,10 @@
import { t } from "i18next";
import { BooleanSetting } from "../../session_keys";
import { Content } from "../../constants";
import { VirtualTrail } from "../../farm_designer/map/layers/farmbot/bot_trail";
import { GetWebAppConfigValue, setWebAppConfigValue } from "../../config_storage/actions";
import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app";
import { t } from "../../i18next_wrapper";
export interface LabsFeature {
/** Toggle label. */

View File

@ -1,9 +1,10 @@
import { API } from "../api";
import { Content } from "../constants";
import { success } from "farmbot-toastr";
import { t } from "i18next";
import axios, { AxiosResponse } from "axios";
import { DeviceAccountSettings } from "farmbot/dist/resources/api_resources";
import { t } from "../i18next_wrapper";
interface DataDumpExport { device?: DeviceAccountSettings; }
type Response = AxiosResponse<DataDumpExport | undefined>;

View File

@ -17,11 +17,12 @@ import { ResourceIndex } from "../resources/interfaces";
import { SequenceBodyItem } from "farmbot/dist";
import { Actions } from "../constants";
import { maybeStartTracking } from "./maybe_start_tracking";
import { t } from "i18next";
import { newTaggedResource } from "../sync/actions";
import { arrayUnwrap } from "../resources/util";
import { findByUuid } from "../resources/reducer_support";
import { assign, noop } from "lodash";
import { t } from "../i18next_wrapper";
export function edit(tr: TaggedResource, changes: Partial<typeof tr.body>):
ReduxAction<EditResourceParams> {

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { connect } from "react-redux";
import { init, error } from "farmbot-toastr";
import { NavBar } from "./nav";
@ -24,6 +24,7 @@ import { takeSortedLogs } from "./logs/state_to_props";
import { FirmwareConfig } from "farmbot/dist/resources/configs/firmware";
import { getFirmwareConfig } from "./resources/getters";
import { intersection } from "lodash";
import { t } from "./i18next_wrapper";
/** For the logger module */
init();

View File

@ -7,7 +7,7 @@ import { success, error, info, warning } from "farmbot-toastr";
import { HardwareState } from "../devices/interfaces";
import { GetState, ReduxAction } from "../redux/interfaces";
import { Content, Actions } from "../constants";
import { t } from "i18next";
import {
EXPECTED_MAJOR,
EXPECTED_MINOR,
@ -27,6 +27,7 @@ import { onLogs } from "./log_handlers";
import { ChannelName, MessageType } from "../sequences/interfaces";
import { DeepPartial } from "redux";
import { slowDown } from "./slow_down";
import { t } from "../i18next_wrapper";
export const TITLE = "New message from bot";
/** TODO: This ought to be stored in Redux. It is here because of historical

View File

@ -1,8 +1,9 @@
import * as React from "react";
import { t } from "i18next";
import { Row, Col } from "../ui/index";
import { AxisDisplayGroupProps } from "./interfaces";
import { isNumber } from "lodash";
import { t } from "../i18next_wrapper";
const Axis = ({ val }: { val: number | undefined }) => <Col xs={3}>
<input disabled value={isNumber(val) ? val : "---"} />

View File

@ -1,10 +1,11 @@
import * as React from "react";
import { AxisInputBox } from "./axis_input_box";
import { t } from "i18next";
import { Row, Col } from "../ui/index";
import { AxisInputBoxGroupProps, AxisInputBoxGroupState } from "./interfaces";
import { isNumber } from "lodash";
import { Vector3 } from "farmbot";
import { t } from "../i18next_wrapper";
/** Coordinate input and GO button for Move widget. */
export class AxisInputBoxGroup extends

View File

@ -1,7 +1,7 @@
import * as React from "react";
import { Row, Col } from "../ui/index";
import { ToggleButton } from "./toggle_button";
import { t } from "i18next";
import { t } from "../i18next_wrapper";
export interface KeyValRowProps {
label: string;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { Row, Col } from "../../ui";
import { BotLocationData } from "../../devices/interfaces";
import { moveAbs } from "../../devices/actions";
@ -8,6 +8,7 @@ import { AxisDisplayGroup } from "../axis_display_group";
import { AxisInputBoxGroup } from "../axis_input_box_group";
import { GetWebAppBool } from "./interfaces";
import { BooleanSetting } from "../../session_keys";
import { t } from "../../i18next_wrapper";
export interface BotPositionRowsProps {
locationData: BotLocationData;

View File

@ -2,7 +2,7 @@ import * as React from "react";
import { moveRelative } from "../../devices/actions";
import { DirectionButtonProps, Payl } from "./interfaces";
import { CONFIG_DEFAULTS } from "farmbot/dist/config";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export function directionDisabled(props: DirectionButtonProps): boolean {
const {

View File

@ -4,8 +4,7 @@ import { homeAll, findHome } from "../../devices/actions";
import { JogMovementControlsProps } from "./interfaces";
import { getDevice } from "../../device";
import { buildDirectionProps } from "./direction_axes_props";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
const DEFAULT_STEP_SIZE = 100;
/*

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { McuParams } from "farmbot";
import { BotPosition } from "../../devices/interfaces";
import { changeStepSize } from "../../devices/actions";
@ -7,6 +7,7 @@ import { StepSizeSelector } from "./step_size_selector";
import { GetWebAppBool } from "./interfaces";
import { JogButtons } from "./jog_buttons";
import { BooleanSetting } from "../../session_keys";
import { t } from "../../i18next_wrapper";
interface JogControlsGroupProps {
dispatch: Function;

View File

@ -3,8 +3,9 @@ import { Xyz, LocationName, Dictionary } from "farmbot";
import moment from "moment";
import { BotLocationData, BotPosition } from "../../devices/interfaces";
import { trim } from "../../util";
import { t } from "i18next";
import { cloneDeep, max, get, isNumber, isEqual, takeRight, ceil, range } from "lodash";
import { t } from "../../i18next_wrapper";
const HEIGHT = 50;
const HISTORY_LENGTH_SECONDS = 120;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { Widget, WidgetBody, WidgetHeader } from "../../ui";
import { EStopButton } from "../../devices/components/e_stop_btn";
import { MustBeOnline } from "../../devices/must_be_online";
@ -14,6 +14,7 @@ import { BotPositionRows } from "./bot_position_rows";
import { MotorPositionPlot } from "./motor_position_plot";
import { Popover, Position } from "@blueprintjs/core";
import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app";
import { t } from "../../i18next_wrapper";
export class Move extends React.Component<MoveProps, {}> {

View File

@ -1,10 +1,11 @@
import * as React from "react";
import { t } from "i18next";
import { BooleanSetting } from "../../session_keys";
import { ToggleButton } from "../toggle_button";
import { ToggleWebAppBool, GetWebAppBool } from "./interfaces";
import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app";
import { DevSettings } from "../../account/dev/dev_support";
import { t } from "../../i18next_wrapper";
export const moveWidgetSetting = (toggle: ToggleWebAppBool, getValue: GetWebAppBool) =>
({ label, setting }: { label: string, setting: BooleanConfigKey }) =>

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { error } from "farmbot-toastr";
import { PeripheralList } from "./peripheral_list";
import { PeripheralForm } from "./peripheral_form";
@ -10,6 +10,7 @@ import { getArrayStatus } from "../../resources/tagged_resources";
import { saveAll, init } from "../../api/crud";
import { ToolTips } from "../../constants";
import { uniq } from "lodash";
import { t } from "../../i18next_wrapper";
export class Peripherals
extends React.Component<PeripheralsProps, PeripheralState> {

View File

@ -1,9 +1,10 @@
import * as React from "react";
import { t } from "i18next";
import { destroy, edit } from "../../api/crud";
import { PeripheralFormProps } from "./interfaces";
import { sortResourcesById } from "../../util";
import { KeyValEditRow } from "../key_val_edit_row";
import { t } from "../../i18next_wrapper";
export function PeripheralForm(props: PeripheralFormProps) {
const { dispatch, peripherals } = props;

View File

@ -3,7 +3,7 @@ import { pinToggle } from "../../devices/actions";
import { PeripheralListProps } from "./interfaces";
import { sortResourcesById } from "../../util";
import { KeyValShowRow } from "../key_val_show_row";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export function PeripheralList(props: PeripheralListProps) {
const { pins, disabled } = props;

View File

@ -1,9 +1,10 @@
import * as React from "react";
import moment from "moment";
import { range, clamp } from "lodash";
import { t } from "i18next";
import { SensorReadingPlotProps } from "./interfaces";
import { calcEndOfPeriod } from "./filter_readings";
import { t } from "../../i18next_wrapper";
/** For SensorReadings plot. */
export const calcTimeParams = (timePeriod: number): {

View File

@ -1,12 +1,13 @@
import * as React from "react";
import { Row, Col, BlurableInput } from "../../ui";
import { t } from "i18next";
import { AxisInputBoxGroupState } from "../interfaces";
import { Xyz } from "../../devices/interfaces";
import { AxisInputBox } from "../axis_input_box";
import { isNumber } from "lodash";
import { LocationSelectionProps } from "./interfaces";
import { parseIntInput } from "../../util";
import { t } from "../../i18next_wrapper";
/** Select a location filter for sensor readings. */
export const LocationSelection =

View File

@ -9,10 +9,11 @@ import {
import { LocationSelection, LocationDisplay } from "./location_selection";
import { SensorSelection } from "./sensor_selection";
import { ToolTips } from "../../constants";
import { t } from "i18next";
import { TaggedSensor } from "farmbot";
import { AxisInputBoxGroupState } from "../interfaces";
import { SensorReadingsPlot } from "./graph";
import { t } from "../../i18next_wrapper";
export class SensorReadings
extends React.Component<SensorReadingsProps, SensorReadingsState> {

View File

@ -1,8 +1,9 @@
import * as React from "react";
import { FBSelect, DropDownItem } from "../../ui";
import { t } from "i18next";
import { TaggedSensor } from "farmbot";
import { SensorSelectionProps } from "./interfaces";
import { t } from "../../i18next_wrapper";
const ALL_CHOICE: DropDownItem = { label: t("All"), value: "" };

View File

@ -1,9 +1,10 @@
import * as React from "react";
import { SensorReadingsTableProps, TableRowProps } from "./interfaces";
import { t } from "i18next";
import { xyzTableEntry } from "../../logs/components/logs_table";
import { formatLogTime } from "../../logs";
import moment from "moment";
import { t } from "../../i18next_wrapper";
enum TableColWidth {
sensor = 125,

View File

@ -1,10 +1,11 @@
import * as React from "react";
import { FBSelect, Row, Col, BlurableInput } from "../../ui";
import { t } from "i18next";
import moment from "moment";
import { TaggedSensorReading } from "farmbot";
import { TimePeriodSelectionProps, DateDisplayProps } from "./interfaces";
import { cloneDeep } from "lodash";
import { t } from "../../i18next_wrapper";
/** Look up time period label by seconds. */
const timePeriodLookup = {

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { error } from "farmbot-toastr";
import { SensorList } from "./sensor_list";
import { SensorForm } from "./sensor_form";
@ -10,6 +10,7 @@ import { getArrayStatus } from "../../resources/tagged_resources";
import { saveAll, init } from "../../api/crud";
import { ToolTips } from "../../constants";
import { uniq } from "lodash";
import { t } from "../../i18next_wrapper";
export class Sensors extends React.Component<SensorsProps, SensorState> {
constructor(props: SensorsProps) {

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { destroy, edit } from "../../api/crud";
import { SensorFormProps } from "./interfaces";
import { sortResourcesById } from "../../util";
@ -8,6 +8,7 @@ import {
pinDropdowns
} from "../../sequences/step_tiles/pin_and_peripheral_support";
import { PIN_MODES } from "../../sequences/step_tiles/tile_pin_support";
import { t } from "../../i18next_wrapper";
export function SensorForm(props: SensorFormProps) {
const { dispatch, sensors } = props;

View File

@ -3,9 +3,10 @@ import { readPin } from "../../devices/actions";
import { SensorListProps } from "./interfaces";
import { sortResourcesById } from "../../util";
import { Row, Col } from "../../ui";
import { t } from "i18next";
import { isNumber } from "lodash";
import { ALLOWED_PIN_MODES } from "farmbot";
import { t } from "../../i18next_wrapper";
const SensorReadingDisplay =
({ label, value, mode }:

View File

@ -1,6 +1,7 @@
import * as React from "react";
import { t } from "i18next";
import { ToggleButtonProps } from "./interfaces";
import { t } from "../i18next_wrapper";
export class ToggleButton extends React.Component<ToggleButtonProps, {}> {
caption() {

View File

@ -1,11 +1,12 @@
import * as React from "react";
import { Widget, WidgetHeader, WidgetBody } from "../../ui/index";
import { t } from "i18next";
import { ToolTips } from "../../constants";
import { WebcamPanelProps } from "./interfaces";
import { KeyValEditRow } from "../key_val_edit_row";
import { SpecialStatus, TaggedWebcamFeed } from "farmbot";
import { sortBy } from "lodash";
import { t } from "../../i18next_wrapper";
export function sortedFeeds(feeds: TaggedWebcamFeed[]): TaggedWebcamFeed[] {
return sortBy(feeds, (f) => { return f.body.id || Infinity; });

View File

@ -5,8 +5,9 @@ import { WebcamPanelProps } from "./interfaces";
import { TaggedWebcamFeed, SpecialStatus } from "farmbot";
import { edit, save, destroy, init } from "../../api/crud";
import { error } from "farmbot-toastr";
import { t } from "i18next";
import { WebcamFeed } from "farmbot/dist/resources/api_resources";
import { t } from "../../i18next_wrapper";
const HTTP = "http://";

View File

@ -1,11 +1,12 @@
import * as React from "react";
import { Widget, WidgetHeader, FallbackImg, WidgetBody } from "../../ui/index";
import { t } from "i18next";
import { ToolTips } from "../../constants";
import { WebcamPanelProps } from "./interfaces";
import { PLACEHOLDER_FARMBOT } from "../../farmware/images/image_flipper";
import { Flipper } from "./flipper";
import { sortedFeeds } from "./edit";
import { t } from "../../i18next_wrapper";
type State = {
/** Current index in the webcam feed list.

View File

@ -1,4 +1,4 @@
import { t } from "i18next";
import axios from "axios";
import { success, warning, info, error } from "farmbot-toastr";
import { getDevice } from "../device";
@ -23,6 +23,7 @@ import { FbosConfig } from "farmbot/dist/resources/configs/fbos";
import { FirmwareConfig } from "farmbot/dist/resources/configs/firmware";
import { getFirmwareConfig, getFbosConfig } from "../resources/getters";
import { isObject, isString, get, noop } from "lodash";
import { t } from "../i18next_wrapper";
const ON = 1, OFF = 0;
export type ConfigKey = keyof McuParams;

View File

@ -3,7 +3,7 @@ import { Row, Col } from "../../ui";
import { TaggedDiagnosticDump } from "farmbot";
import { destroy } from "../../api/crud";
import { ago } from "../connectivity/status_checks";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export interface Props {
diag: TaggedDiagnosticDump;
@ -20,8 +20,7 @@ export class DiagnosticDumpRow extends React.Component<Props, {}> {
render() {
return <Row>
<Col xsOffset={3} xs={8}>
{t("Report {{ticket}} (Saved {{age}})",
{ ticket: this.ticket, age: this.age })}
{t("Report {{ticket}} (Saved {{age}})", { ticket: this.ticket, age: this.age })}
</Col>
<Col xs={1}>
<button

View File

@ -1,8 +1,9 @@
import * as React from "react";
import { t } from "i18next";
import { emergencyLock, emergencyUnlock } from "../actions";
import { EStopButtonProps } from "../interfaces";
import { isBotUp } from "../must_be_online";
import { t } from "../../i18next_wrapper";
export class EStopButton extends React.Component<EStopButtonProps, {}> {
render() {

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { FarmbotOsProps, FarmbotOsState } from "../interfaces";
import {
Widget,
@ -25,6 +25,7 @@ import { PowerAndReset } from "./fbos_settings/power_and_reset";
import { SendDiagnosticReport } from "./send_diagnostic_report";
import axios from "axios";
import { t } from "../../i18next_wrapper";
export enum ColWidth {
label = 3,

View File

@ -1,11 +1,12 @@
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import { ToggleButton } from "../../../controls/toggle_button";
import { Content } from "../../../constants";
import { updateConfig } from "../../actions";
import { ColWidth } from "../farmbot_os_settings";
import { AutoSyncRowProps } from "./interfaces";
import { t } from "../../../i18next_wrapper";
export function AutoSyncRow(props: AutoSyncRowProps) {
const autoSync = props.sourceFbosConfig("auto_sync");

View File

@ -1,11 +1,12 @@
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import { ColWidth } from "../farmbot_os_settings";
import { ToggleButton } from "../../../controls/toggle_button";
import { updateConfig } from "../../actions";
import { Content } from "../../../constants";
import { AutoUpdateRowProps } from "./interfaces";
import { t } from "../../../i18next_wrapper";
export function AutoUpdateRow(props: AutoUpdateRowProps) {
const osAutoUpdate = props.sourceFbosConfig("os_auto_update");

View File

@ -1,12 +1,13 @@
import * as React from "react";
import { Row, Col, DropDownItem, FBSelect } from "../../../ui/index";
import { t } from "i18next";
import { info } from "farmbot-toastr";
import { FirmwareHardware } from "farmbot";
import { ColWidth } from "../farmbot_os_settings";
import { updateConfig } from "../../actions";
import { BoardTypeProps } from "./interfaces";
import { Feature } from "../../interfaces";
import { t } from "../../../i18next_wrapper";
const ARDUINO = { label: "Arduino/RAMPS (Genesis v1.2)", value: "arduino" };
const FARMDUINO = { label: "Farmduino (Genesis v1.3)", value: "farmduino" };

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { DropDownItem, Row, Col, FBSelect } from "../../../ui/index";
import { t } from "i18next";
import {
CameraSelectionProps, CameraSelectionState
} from "./interfaces";
@ -8,6 +8,7 @@ import { info, success, error } from "farmbot-toastr";
import { getDevice } from "../../../device";
import { ColWidth } from "../farmbot_os_settings";
import { Feature } from "../../interfaces";
import { t } from "../../../i18next_wrapper";
const CAMERA_CHOICES = [
{ label: t("USB Camera"), value: "USB" },

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { Row, Col, BlurableInput } from "../../../ui/index";
import { t } from "i18next";
import { success, error } from "farmbot-toastr";
import { getDevice } from "../../../device";
import { transferOwnership } from "../../transfer_ownership/transfer_ownership";
@ -8,6 +8,7 @@ import { API } from "../../../api";
import { NonsecureContentWarning } from "./nonsecure_content_warning";
import { Content } from "../../../constants";
import { BlurablePassword } from "../../../ui/blurable_password";
import { t } from "../../../i18next_wrapper";
interface ChangeOwnershipFormState {
email: string;

View File

@ -1,12 +1,13 @@
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import { Content } from "../../../constants";
import { factoryReset, updateConfig } from "../../actions";
import { ToggleButton } from "../../../controls/toggle_button";
import { BotConfigInputBox } from "../bot_config_input_box";
import { FactoryResetRowProps } from "./interfaces";
import { ColWidth } from "../farmbot_os_settings";
import { t } from "../../../i18next_wrapper";
export function FactoryResetRow(props: FactoryResetRowProps) {
const { dispatch, sourceFbosConfig, botOnline } = props;

View File

@ -1,11 +1,12 @@
import * as React from "react";
import { Row, Col, Markdown } from "../../../ui/index";
import { t } from "i18next";
import { OsUpdateButton } from "./os_update_button";
import { Popover, Position } from "@blueprintjs/core";
import { ColWidth } from "../farmbot_os_settings";
import { FarmbotOsRowProps } from "./interfaces";
import { FbosDetails } from "./fbos_details";
import { t } from "../../../i18next_wrapper";
const getVersionString =
(fbosVersion: string | undefined, onBeta: boolean | undefined): string => {

View File

@ -1,7 +1,8 @@
import * as React from "react";
import { Row, Col } from "../../../ui";
import { t } from "i18next";
import { ColWidth } from "../farmbot_os_settings";
import { t } from "../../../i18next_wrapper";
export interface FbosButtonRowProps {
botOnline: boolean;

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { Saucer } from "../../../ui/index";
import { t } from "i18next";
import { ToggleButton } from "../../../controls/toggle_button";
import { updateConfig } from "../../actions";
import { last, isNumber } from "lodash";
@ -8,6 +8,7 @@ import { Content } from "../../../constants";
import { FbosDetailsProps } from "./interfaces";
import { SourceFbosConfig, ShouldDisplay, Feature } from "../../interfaces";
import { ConfigurationName } from "farmbot";
import { t } from "../../../i18next_wrapper";
/** Return an indicator color for the given temperature (C). */
export const colorFromTemp = (temp: number | undefined): string => {

View File

@ -1,10 +1,11 @@
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import moment from "moment";
import { TaggedDevice } from "farmbot";
import { ColWidth } from "../farmbot_os_settings";
import { Content } from "../../../constants";
import { t } from "../../../i18next_wrapper";
export interface LastSeenProps {
onClick?(): void;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { JobProgress, ConfigurationName } from "farmbot/dist";
import { SemverResult, semverCompare } from "../../../util";
import { OsUpdateButtonProps } from "./interfaces";
@ -7,6 +7,7 @@ import { checkControllerUpdates } from "../../actions";
import { isString } from "lodash";
import { BotState, Feature } from "../../interfaces";
import { Content } from "../../../constants";
import { t } from "../../../i18next_wrapper";
/** FBOS update button states. */
enum UpdateButton { upToDate, needsUpdate, unknown, none }

View File

@ -4,11 +4,12 @@ import { Collapse, Popover, Position } from "@blueprintjs/core";
import { FactoryResetRow } from "./factory_reset_row";
import { PowerAndResetProps } from "./interfaces";
import { ChangeOwnershipForm } from "./change_ownership_form";
import { t } from "i18next";
import { Feature } from "../../interfaces";
import { FbosButtonRow } from "./fbos_button_row";
import { Content } from "../../../constants";
import { reboot, powerOff, restartFirmware } from "../../actions";
import { t } from "../../../i18next_wrapper";
export function PowerAndReset(props: PowerAndResetProps) {
const { dispatch, sourceFbosConfig, shouldDisplay, botOnline } = props;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { MCUFactoryReset, bulkToggleControlPanel } from "../actions";
import { Widget, WidgetHeader, WidgetBody, SaveBtn } from "../../ui/index";
import { HardwareSettingsProps } from "../interfaces";
@ -16,6 +16,7 @@ import {
import { SpecialStatus } from "farmbot";
import { Popover, Position } from "@blueprintjs/core";
import { FwParamExportMenu } from "./hardware_settings/export_menu";
import { t } from "../../i18next_wrapper";
export class HardwareSettings extends
React.Component<HardwareSettingsProps, {}> {

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { getDevice } from "../../../device";
import { Axis } from "../../interfaces";
import { LockableButton } from "../lockable_button";
@ -8,6 +8,7 @@ import { ToolTips } from "../../../constants";
import { Row, Col } from "../../../ui/index";
import { CalibrationRowProps } from "../interfaces";
import { commandErr } from "../../actions";
import { t } from "../../../i18next_wrapper";
const calibrate = (axis: Axis) => getDevice()
.calibrate({ axis })

View File

@ -1,10 +1,11 @@
import * as React from "react";
import { t } from "i18next";
import { DangerZoneProps } from "../interfaces";
import { Row, Col } from "../../../ui/index";
import { Header } from "./header";
import { Collapse } from "@blueprintjs/core";
import { Content } from "../../../constants";
import { t } from "../../../i18next_wrapper";
export function DangerZone(props: DangerZoneProps) {

View File

@ -1,7 +1,8 @@
import * as React from "react";
import { McuParams, Encoder, McuParamName } from "farmbot/dist";
import { t } from "i18next";
import { FBSelect, DropDownItem } from "../../../ui/index";
import { t } from "../../../i18next_wrapper";
export interface EncoderTypeProps {
hardware: McuParams;

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import { BooleanMCUInputGroup } from "../boolean_mcu_input_group";
import { ToolTips } from "../../../constants";
import { NumericMCUInputGroup } from "../numeric_mcu_input_group";
@ -7,6 +6,7 @@ import { EncodersProps } from "../interfaces";
import { Header } from "./header";
import { Collapse } from "@blueprintjs/core";
import { Feature } from "../../interfaces";
import { t } from "../../../i18next_wrapper";
export function EncodersAndEndStops(props: EncodersProps) {

View File

@ -1,7 +1,8 @@
import * as React from "react";
import { t } from "i18next";
import { ControlPanelState } from "../../interfaces";
import { toggleControlPanel } from "../../actions";
import { t } from "../../../i18next_wrapper";
interface Props {
dispatch: Function;

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import { BooleanMCUInputGroup } from "../boolean_mcu_input_group";
import { ToolTips } from "../../../constants";
import { NumericMCUInputGroup } from "../numeric_mcu_input_group";
@ -11,6 +10,7 @@ import { HomingAndCalibrationProps } from "../interfaces";
import { Header } from "./header";
import { Collapse } from "@blueprintjs/core";
import { minFwVersionCheck } from "../../../util";
import { t } from "../../../i18next_wrapper";
export function HomingAndCalibration(props: HomingAndCalibrationProps) {

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import { HomingRowProps } from "../interfaces";
import { LockableButton } from "../lockable_button";
import { axisTrackingStatus } from "../axis_tracking_status";
@ -10,6 +9,7 @@ import { CONFIG_DEFAULTS } from "farmbot/dist/config";
import { commandErr } from "../../actions";
import { Axis } from "../../interfaces";
import { getDevice } from "../../../device";
import { t } from "../../../i18next_wrapper";
const speed = CONFIG_DEFAULTS.speed;
const findHome = (axis: Axis) => getDevice()

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import { BooleanMCUInputGroup } from "../boolean_mcu_input_group";
import { ToolTips } from "../../../constants";
import { SpacePanelToolTip } from "../space_panel_tool_tip";
@ -12,6 +11,7 @@ import { Header } from "./header";
import { Collapse } from "@blueprintjs/core";
import { McuInputBox } from "../mcu_input_box";
import { minFwVersionCheck } from "../../../util";
import { t } from "../../../i18next_wrapper";
const SingleSettingRow =
({ label, tooltip, settingType, children }: {

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { PinGuardMCUInputGroup } from "../pin_guard_input_group";
import { PinGuardProps } from "../interfaces";
import { Header } from "./header";
@ -7,6 +7,7 @@ import { Collapse } from "@blueprintjs/core";
import { Row, Col } from "../../../ui/index";
import { SpacePanelToolTip } from "../space_panel_tool_tip";
import { ToolTips } from "../../../constants";
import { t } from "../../../i18next_wrapper";
export function PinGuard(props: PinGuardProps) {

View File

@ -1,6 +1,7 @@
import * as React from "react";
import { t } from "i18next";
import { Row, Col } from "../../../ui/index";
import { t } from "../../../i18next_wrapper";
export function SpacePanelHeader(_: {}) {
return <Row>

View File

@ -1,11 +1,12 @@
import * as React from "react";
import { t } from "i18next";
import { getDevice } from "../../../device";
import { Axis } from "../../interfaces";
import { ToolTips } from "../../../constants";
import { Row, Col } from "../../../ui/index";
import { ZeroRowProps } from "../interfaces";
import { commandErr } from "../../actions";
import { t } from "../../../i18next_wrapper";
const zero =
(axis: Axis) => getDevice().setZero(axis).catch(commandErr("Zeroing"));

View File

@ -6,8 +6,9 @@ import { BlurableInput } from "../../ui/index";
import {
clampUnsignedInteger, IntegerSize, getMaxInputFromIntSize
} from "../../util";
import { t } from "i18next";
import { isUndefined } from "lodash";
import { t } from "../../i18next_wrapper";
export class McuInputBox extends React.Component<McuInputBoxProps, {}> {

View File

@ -4,8 +4,9 @@ import { PinGuardMCUInputGroupProps } from "./interfaces";
import { Row, Col } from "../../ui/index";
import { settingToggle } from "../actions";
import { ToggleButton } from "../../controls/toggle_button";
import { t } from "i18next";
import { isUndefined } from "lodash";
import { t } from "../../i18next_wrapper";
export function PinGuardMCUInputGroup(props: PinGuardMCUInputGroupProps) {

View File

@ -1,7 +1,7 @@
import * as React from "react";
import { Row, Col } from "../../ui";
import { ColWidth } from "./farmbot_os_settings";
import { t } from "i18next";
import { Collapse } from "@blueprintjs/core";
import { Header } from "./hardware_settings/header";
import { ShouldDisplay, Feature } from "../interfaces";
@ -9,6 +9,7 @@ import { TaggedDiagnosticDump } from "farmbot";
import { DiagnosticDumpRow } from "./diagnostic_dump_row";
import { requestDiagnostic } from "../actions";
import { Content } from "../../constants";
import { t } from "../../i18next_wrapper";
export interface DiagReportProps {
dispatch: Function;

View File

@ -1,5 +1,6 @@
import * as React from "react";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
interface SPTTProps {
tooltip?: string | undefined;

View File

@ -3,7 +3,8 @@ import { DiagnosticMessages } from "./diagnostic_messages";
import { Col, Row } from "../../ui/index";
import { bitArray } from "../../util";
import { TRUTH_TABLE } from "./truth_table";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export type DiagnosisName =
| "userAPI"

View File

@ -1,5 +1,5 @@
import { trim } from "../../util";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export namespace DiagnosticMessages {
// "SCV good to go, sir." is also appropriate.

View File

@ -2,7 +2,7 @@ import * as React from "react";
import { StatusRowProps } from "./connectivity_row";
import { CowardlyDictionary } from "../../util";
import { Color } from "../../ui/index";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
export interface ConnectivityDiagramProps {
rowData: StatusRowProps[];

View File

@ -1,6 +1,5 @@
import * as React from "react";
import { Widget, WidgetHeader, WidgetBody, Row, Col } from "../../ui/index";
import { t } from "i18next";
import { ConnectivityRow, StatusRowProps } from "./connectivity_row";
import { RetryBtn } from "./retry_btn";
import { SpecialStatus, InformationalSettings } from "farmbot";
@ -9,6 +8,7 @@ import { ToolTips } from "../../constants";
import {
ChipTemperatureDisplay, WiFiStrengthDisplay
} from "../components/fbos_settings/fbos_details";
import { t } from "../../i18next_wrapper";
interface Props {
onRefresh(): void;

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { SpecialStatus } from "farmbot";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
interface RetryBtnProps {
flags: boolean[];

View File

@ -2,7 +2,7 @@ import { isUndefined } from "lodash";
import moment from "moment";
import { StatusRowProps } from "./connectivity_row";
import { ConnectionStatus } from "../../connectivity/interfaces";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
const HOUR = 1000 * 60 * 60;

View File

@ -1,8 +1,8 @@
import * as React from "react";
import { NetworkState } from "../connectivity/interfaces";
import { SyncStatus } from "farmbot";
import { t } from "i18next";
import { Content } from "../constants";
import { t } from "../i18next_wrapper";
/** Properties for the <MustBeOnline/> element. */
export interface MBOProps {

View File

@ -1,4 +1,4 @@
import { t } from "i18next";
import {
PinBindingType,
PinBindingSpecialAction
@ -7,6 +7,7 @@ import { DropDownItem } from "../../ui";
import { gpio } from "./rpi_gpio_diagram";
import { flattenDeep, isNumber } from "lodash";
import { sysBtnBindings } from "./tagged_pin_binding_init";
import { t } from "../../i18next_wrapper";
export const bindingTypeLabelLookup: { [x: string]: string } = {
[PinBindingType.standard]: t("Sequence"),

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { Row, Col, FBSelect, NULL_CHOICE, DropDownItem } from "../../ui";
import { PinBindingColWidth } from "./pin_bindings";
import { Popover, Position } from "@blueprintjs/core";
@ -23,6 +23,7 @@ import { ResourceIndex } from "../../resources/interfaces";
import {
PinBindingType, PinBindingSpecialAction
} from "farmbot/dist/resources/api_resources";
import { t } from "../../i18next_wrapper";
export class PinBindingInputGroup
extends React.Component<PinBindingInputGroupProps, PinBindingInputGroupState> {

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import { Widget, WidgetBody, WidgetHeader, Row, Col } from "../../ui";
import { ToolTips } from "../../constants";
import { selectAllPinBindings } from "../../resources/selectors";
@ -16,6 +15,7 @@ import {
PinBindingType,
PinBinding
} from "farmbot/dist/resources/api_resources";
import { t } from "../../i18next_wrapper";
/** Width of UI columns in Pin Bindings widget. */
export enum PinBindingColWidth {

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { t } from "i18next";
import {
bindingTypeLabelLookup, specialActionLabelLookup,
generatePinLabel, sortByNameAndPin
@ -11,6 +10,7 @@ import { findSequenceById } from "../../resources/selectors";
import { PinBindingColWidth } from "./pin_bindings";
import { PinBindingsListProps } from "./interfaces";
import { sysBtnBindings } from "./tagged_pin_binding_init";
import { t } from "../../i18next_wrapper";
export const PinBindingsList = (props: PinBindingsListProps) => {
const { pinBindings, resources, dispatch } = props;

View File

@ -7,7 +7,7 @@ import {
import { PinBindingListItems } from "./interfaces";
import { stockPinBindings } from "./list_and_label_support";
import { initSave } from "../../api/crud";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
/** Return the correct Pin Binding resource according to binding type. */
export const pinBindingBody =

View File

@ -1,6 +1,7 @@
import { t } from "i18next";
import { Content } from "../../constants";
import { isString } from "lodash";
import { t } from "../../i18next_wrapper";
/** Used for every new account the first time the Device page is loaded. */
const ONLY_ONCE = {

View File

@ -6,10 +6,11 @@
import { detectLanguage } from "./i18n";
import { shortRevision } from "./util";
import { stopIE } from "./util/stop_ie";
import { init } from "i18next";
import { attachAppToDom } from "./routes";
import I from "i18next";
stopIE();
console.log(shortRevision());
detectLanguage().then(config => init(config, attachAppToDom));
detectLanguage().then(config => I.init(config, attachAppToDom));

View File

@ -1,6 +1,7 @@
import * as React from "react";
import { t } from "i18next";
import { Widget, WidgetHeader, WidgetBody } from "../ui";
import { t } from "../i18next_wrapper";
/*
* Widget to display if the desired widget fails to load.

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import moment from "moment";
import { connect } from "react-redux";
import { mapStateToPropsAddEdit, } from "./map_state_to_props_add_edit";
@ -17,6 +17,7 @@ import {
DesignerPanel, DesignerPanelHeader, DesignerPanelContent
} from "../plants/designer_panel";
import { variableList } from "../../sequences/locals_list/variable_support";
import { t } from "../../i18next_wrapper";
interface State {
uuid: string;

View File

@ -5,7 +5,8 @@ import { mapStateToPropsAddEdit } from "./map_state_to_props_add_edit";
import { history } from "../../history";
import { TaggedFarmEvent } from "farmbot";
import { EditFEForm } from "./edit_fe_form";
import { t } from "i18next";
import { t } from "../../i18next_wrapper";
@connect(mapStateToPropsAddEdit)
export class EditFarmEvent extends React.Component<AddEditFarmEventProps, {}> {

View File

@ -1,6 +1,6 @@
import * as React from "react";
import moment from "moment";
import { t } from "i18next";
import { success, error, warning } from "farmbot-toastr";
import {
TaggedFarmEvent, SpecialStatus, TaggedSequence, TaggedRegimen,
@ -44,6 +44,7 @@ import {
import {
AllowedVariableNodes
} from "../../sequences/locals_list/locals_list_support";
import { t } from "../../i18next_wrapper";
type FormEvent = React.SyntheticEvent<HTMLInputElement>;
export const NEVER: TimeUnit = "never";

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import {
Row, Col, BlurableInput, FBSelect, DropDownItem
} from "../../ui/index";
@ -8,6 +8,7 @@ import { keyBy } from "lodash";
import { FarmEventViewModel } from "./edit_fe_form";
import { EventTimePicker } from "./event_time_picker";
import { TimeUnit } from "farmbot/dist/resources/api_resources";
import { t } from "../../i18next_wrapper";
type Ev = React.SyntheticEvent<HTMLInputElement>;
type Key = keyof FarmEventViewModel;

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { connect } from "react-redux";
import { t } from "i18next";
import { Row } from "../../ui/index";
import { mapStateToProps } from "./map_state_to_props";
import {
@ -17,6 +17,7 @@ import {
EmptyStateWrapper, EmptyStateGraphic
} from "../../ui/empty_state_wrapper";
import { some, uniq, map, sortBy } from "lodash";
import { t } from "../../i18next_wrapper";
const filterSearch = (term: string) => (item: CalendarOccurrence) =>
item.heading.toLowerCase().includes(term)

View File

@ -1,7 +1,7 @@
import { AddEditFarmEventProps } from "../interfaces";
import { Everything } from "../../interfaces";
import moment from "moment";
import { t } from "i18next";
import { history, getPathArray } from "../../history";
import {
selectAllFarmEvents,
@ -33,6 +33,7 @@ import {
import { hasId } from "../../resources/util";
import { ExecutableType } from "farmbot/dist/resources/api_resources";
import { getFbosConfig } from "../../resources/getters";
import { t } from "../../i18next_wrapper";
export let formatTime = (input: string, timeOffset: number) => {
const iso = new Date(input).toISOString();

View File

@ -1,7 +1,8 @@
import * as React from "react";
import { t } from "i18next";
import { timezoneMismatch } from "../../devices/timezones/guess_timezone";
import { Content } from "../../constants";
import { t } from "../../i18next_wrapper";
interface TzWarningProps {
deviceTimezone: string | undefined;

View File

@ -1,9 +1,10 @@
import * as React from "react";
import { t } from "i18next";
import { transformXY } from "../util";
import { MapTransformProps, BotSize } from "../interfaces";
import { random, range, some, clamp, sample } from "lodash";
import { getEggStatus, setEggStatus, EggKeys } from "./status";
import { t } from "../../../i18next_wrapper";
export interface BugsProps {
mapTransformProps: MapTransformProps;

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { BlurableInput } from "../../../../ui/index";
import { t } from "i18next";
import { offsetTime } from "../../../farm_events/edit_fe_form";
import {
setWebAppConfigValue, GetWebAppConfigValue
@ -10,6 +10,7 @@ import {
formatDate, formatTime
} from "../../../farm_events/map_state_to_props_add_edit";
import { Slider } from "@blueprintjs/core";
import { t } from "../../../../i18next_wrapper";
interface ImageFilterMenuState {
beginDate: string | undefined;

View File

@ -1,4 +1,4 @@
import { t } from "i18next";
import { error } from "farmbot-toastr";
import { Content } from "../../../../constants";
import { initSave, edit, save } from "../../../../api/crud";
@ -15,6 +15,7 @@ import { findBySlug } from "../../../search_selectors";
import { transformXY, round } from "../../util";
import { movePlant } from "../../../actions";
import { cachedCrop } from "../../../../open_farm/icons";
import { t } from "../../../../i18next_wrapper";
/** Return a new plant or plantTemplate object. */
export const newPlantKindAndBody = (props: {

View File

@ -5,8 +5,9 @@ import { TaggedSensorReading } from "farmbot";
import { MapTransformProps } from "../../interfaces";
import { isNumber } from "lodash";
import { formatLogTime } from "../../../../logs";
import { t } from "i18next";
import { Color } from "../../../../ui";
import { t } from "../../../../i18next_wrapper";
const VISIBLE_PERIOD_SECONDS = 24 * 60 * 60.;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { t } from "i18next";
import { LayerToggle } from "../legend/layer_toggle";
import { GardenMapLegendProps } from "../interfaces";
import { history } from "../../../history";
@ -12,6 +12,7 @@ import { SavedGardensLink } from "../../saved_gardens/saved_gardens";
import { GetWebAppConfigValue } from "../../../config_storage/actions";
import { BooleanSetting } from "../../../session_keys";
import { DevSettings } from "../../../account/dev/dev_support";
import { t } from "../../../i18next_wrapper";
const OriginSelector = ({ quadrant, update }: {
quadrant: BotOriginQuadrant,

View File

@ -1,6 +1,7 @@
import * as React from "react";
import { Popover, Position } from "@blueprintjs/core";
import { t } from "i18next";
import { t } from "../../../i18next_wrapper";
export interface LayerToggleProps {
label: string;

View File

@ -3,7 +3,7 @@ import { Row, Col } from "../ui";
import { Everything } from "../interfaces";
import { BotPosition } from "../devices/interfaces";
import { connect } from "react-redux";
import { t } from "i18next";
import { moveAbs } from "../devices/actions";
import { history } from "../history";
import { AxisInputBox } from "../controls/axis_input_box";
@ -17,6 +17,7 @@ import {
} from "./plants/designer_panel";
import { DevSettings } from "../account/dev/dev_support";
import { DesignerNavTabs } from "./panel_header";
import { t } from "../i18next_wrapper";
export function mapStateToProps(props: Everything) {
return {

Some files were not shown because too many files have changed in this diff Show More