diff --git a/frontend/__test_support__/user.ts b/frontend/__test_support__/user.ts index 28f503ad0..b2fe1c6d6 100644 --- a/frontend/__test_support__/user.ts +++ b/frontend/__test_support__/user.ts @@ -1,4 +1,4 @@ -import { User } from "../auth/interfaces"; +import { User } from "farmbot/dist/resources/api_resources"; import { TaggedUser, SpecialStatus } from "farmbot"; export let user: User = { diff --git a/frontend/__tests__/controls_popup_test.tsx b/frontend/__tests__/controls_popup_test.tsx index a7e57989e..92c7153bd 100644 --- a/frontend/__tests__/controls_popup_test.tsx +++ b/frontend/__tests__/controls_popup_test.tsx @@ -45,7 +45,7 @@ describe("", () => { expect(button.props().title).toBe("move x axis (100)"); button.simulate("click"); expect(mockDevice.moveRelative) - .toHaveBeenCalledWith({ speed: 100, x: 100, y: 0, z: 0 }); + .toHaveBeenCalledWith({ x: 100, y: 0, z: 0 }); }); it("y axis is not inverted", () => { @@ -53,7 +53,7 @@ describe("", () => { expect(button.props().title).toBe("move y axis (100)"); button.simulate("click"); expect(mockDevice.moveRelative) - .toHaveBeenCalledWith({ speed: 100, x: 0, y: 100, z: 0 }); + .toHaveBeenCalledWith({ x: 0, y: 100, z: 0 }); }); it("disabled when closed", () => { @@ -72,7 +72,7 @@ describe("", () => { expect(button.props().title).toBe("move x axis (100)"); button.simulate("click"); expect(mockDevice.moveRelative) - .toHaveBeenCalledWith({ speed: 100, x: 100, y: 0, z: 0 }); + .toHaveBeenCalledWith({ x: 100, y: 0, z: 0 }); }); it("takes photo", () => { diff --git a/frontend/account/index.tsx b/frontend/account/index.tsx index 1936db15d..60fa42582 100644 --- a/frontend/account/index.tsx +++ b/frontend/account/index.tsx @@ -6,7 +6,7 @@ import { import { Props } from "./interfaces"; import { Page, Row, Col } from "../ui"; import { mapStateToProps } from "./state_to_props"; -import { User } from "../auth/interfaces"; +import { User } from "farmbot/dist/resources/api_resources"; import { edit, save } from "../api/crud"; import { updateNO } from "../resources/actions"; import { deleteUser, resetAccount } from "./actions"; diff --git a/frontend/account/interfaces.ts b/frontend/account/interfaces.ts index 89a4a4a77..1678b6522 100644 --- a/frontend/account/interfaces.ts +++ b/frontend/account/interfaces.ts @@ -1,4 +1,3 @@ -import { User } from "../auth/interfaces"; import { TaggedUser } from "farmbot"; import { GetWebAppConfigValue } from "../config_storage/actions"; import { Thunk } from "../redux/interfaces"; @@ -9,14 +8,6 @@ export interface Props { getConfigValue: GetWebAppConfigValue; } -/** JSON form that gets POSTed to the API when user updates their info. */ -export interface UserInfo extends Record { - password: string; - new_password: string; - new_password_confirmation: string; - password_deletion_confirmation: string; -} - export interface DeletionRequest { password: string; } diff --git a/frontend/auth/interfaces.ts b/frontend/auth/interfaces.ts index 597090d23..cbc8cfee7 100644 --- a/frontend/auth/interfaces.ts +++ b/frontend/auth/interfaces.ts @@ -1,4 +1,4 @@ -export interface Token { +interface Token { unencoded: UnencodedToken; encoded: string; } @@ -7,7 +7,7 @@ export interface AuthState { token: Token; } -export interface UnencodedToken { +interface UnencodedToken { /** ISSUER - Where token came from (API URL). */ iss: string; /** Where to download RPi software */ @@ -17,11 +17,3 @@ export interface UnencodedToken { /** JSON Token Identifier- auto sync needs this to hear its echo on MQTT */ jti: string; } - -export interface User { - id: number; - name: string; - email: string; - created_at?: string; - updated_at?: string; -} diff --git a/frontend/connectivity/device_is_throttled.ts b/frontend/connectivity/device_is_throttled.ts index d50beb191..590790cc2 100644 --- a/frontend/connectivity/device_is_throttled.ts +++ b/frontend/connectivity/device_is_throttled.ts @@ -1,4 +1,4 @@ -import { DeviceAccountSettings } from "../devices/interfaces"; +import { DeviceAccountSettings } from "farmbot/dist/resources/api_resources"; /** Determines if the device was forced to wait due to log flooding. */ export const deviceIsThrottled = diff --git a/frontend/controls/move/__tests__/direction_button_test.tsx b/frontend/controls/move/__tests__/direction_button_test.tsx index dadeaa3f8..fb6695454 100644 --- a/frontend/controls/move/__tests__/direction_button_test.tsx +++ b/frontend/controls/move/__tests__/direction_button_test.tsx @@ -54,7 +54,7 @@ describe("", function () { const btn = mount(); btn.simulate("click"); expect(mockDevice.moveRelative) - .toHaveBeenCalledWith({ speed: 100, x: 0, y: 1000, z: 0 }); + .toHaveBeenCalledWith({ x: 0, y: 1000, z: 0 }); }); }); diff --git a/frontend/controls/move/__tests__/jog_buttons_test.tsx b/frontend/controls/move/__tests__/jog_buttons_test.tsx index c8c5e32fa..c856c17d7 100644 --- a/frontend/controls/move/__tests__/jog_buttons_test.tsx +++ b/frontend/controls/move/__tests__/jog_buttons_test.tsx @@ -77,7 +77,7 @@ describe("", function () { expect(button.props().title).toBe("move x axis (100)"); button.simulate("click"); expect(mockDevice.moveRelative) - .toHaveBeenCalledWith({ speed: 100, x: 100, y: 0, z: 0 }); + .toHaveBeenCalledWith({ x: 100, y: 0, z: 0 }); }); it("has swapped xy jog buttons", () => { @@ -89,6 +89,6 @@ describe("", function () { expect(button.props().title).toBe("move y axis (100)"); button.simulate("click"); expect(mockDevice.moveRelative) - .toHaveBeenCalledWith({ speed: 100, x: 0, y: 100, z: 0 }); + .toHaveBeenCalledWith({ x: 0, y: 100, z: 0 }); }); }); diff --git a/frontend/controls/move/direction_button.tsx b/frontend/controls/move/direction_button.tsx index 7bc9aa473..dd0658ce6 100644 --- a/frontend/controls/move/direction_button.tsx +++ b/frontend/controls/move/direction_button.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { moveRelative } from "../../devices/actions"; -import { DirectionButtonProps, Payl } from "./interfaces"; -import { CONFIG_DEFAULTS } from "farmbot/dist/config"; +import { DirectionButtonProps } from "./interfaces"; import { t } from "../../i18next_wrapper"; +import { MoveRelProps } from "../../devices/interfaces"; export function directionDisabled(props: DirectionButtonProps): boolean { const { @@ -41,7 +41,7 @@ export function calculateDistance(props: DirectionButtonProps) { export class DirectionButton extends React.Component { sendCommand = () => { - const payload: Payl = { speed: CONFIG_DEFAULTS.speed, x: 0, y: 0, z: 0 }; + const payload: MoveRelProps = { x: 0, y: 0, z: 0 }; payload[this.props.axis] = calculateDistance(this.props); moveRelative(payload); } diff --git a/frontend/controls/move/interfaces.ts b/frontend/controls/move/interfaces.ts index 8c5c9a310..905ba80ca 100644 --- a/frontend/controls/move/interfaces.ts +++ b/frontend/controls/move/interfaces.ts @@ -31,13 +31,6 @@ export interface DirectionButtonProps { disabled: boolean | undefined; } -export interface Payl { - speed: number; - x: number; - y: number; - z: number; -} - export interface StepSizeSelectorProps { choices: number[]; selected: number; diff --git a/frontend/devices/components/__tests__/pin_number_dropdown_test.tsx b/frontend/devices/components/__tests__/pin_number_dropdown_test.tsx index 5d481efc4..d8f8a8647 100644 --- a/frontend/devices/components/__tests__/pin_number_dropdown_test.tsx +++ b/frontend/devices/components/__tests__/pin_number_dropdown_test.tsx @@ -33,6 +33,14 @@ describe("", () => { it("renders undefined", () => { const wrapper = mount(); expect(wrapper.text()).toEqual("Select a pin"); + expect(wrapper.find(FBSelect).props().extraClass).toEqual(""); + }); + + it("renders when inconsistent", () => { + const p = fakeProps(); + p.sourceFwConfig = () => ({ value: 0, consistent: false }); + const wrapper = mount(); + expect(wrapper.find(FBSelect).props().extraClass).toEqual("dim"); }); it("renders pin label", () => { diff --git a/frontend/devices/components/pin_number_dropdown.tsx b/frontend/devices/components/pin_number_dropdown.tsx index 7270e2151..cef960cf4 100644 --- a/frontend/devices/components/pin_number_dropdown.tsx +++ b/frontend/devices/components/pin_number_dropdown.tsx @@ -31,6 +31,7 @@ export const PinNumberDropdown = (props: PinNumberDropdownProps) => { const peripheralIds = peripheralDictionary(resources); const pinNumberNode = pinNumOrNamedPin(pinNumberValue, peripheralIds); return >; -/** How the device is stored in the API side. - * This is what comes back from the API as JSON. - */ -export interface DeviceAccountSettings { - id: number; - name: string; - timezone?: string | undefined; - tz_offset_hrs: number; - throttled_until?: string; - throttled_at?: string; - fbos_version?: string | undefined; - last_saw_api?: string | undefined; - last_saw_mq?: string | undefined; -} - export interface BotState { /** The browser optimistically overwrites FBOS sync status to "syncing..." * to reduce UI latency. When AJAX/sync operations fail, we need @@ -160,11 +145,6 @@ export type BotLocationData = Record; export type StepsPerMmXY = Record<"x" | "y", (number | undefined)>; -export interface CalibrationButtonProps { - disabled: boolean; - axis: Axis; -} - export type UserEnv = Record; export interface FarmbotOsProps { diff --git a/frontend/farm_designer/farm_events/calendar/interfaces.ts b/frontend/farm_designer/farm_events/calendar/interfaces.ts index 6f0822fa9..d57b03fee 100644 --- a/frontend/farm_designer/farm_events/calendar/interfaces.ts +++ b/frontend/farm_designer/farm_events/calendar/interfaces.ts @@ -1,6 +1,6 @@ import { Regimen } from "../../../regimens/interfaces"; import { Sequence } from "../../../sequences/interfaces"; -import { ExecutableType, FarmEvent } from "farmbot/dist/resources/api_resources"; +import { FarmEvent } from "farmbot/dist/resources/api_resources"; /** Would it be better to make a fully formed farm event? Join regimen, sequence, etc. */ @@ -22,14 +22,4 @@ export interface FarmEventWithRegimen extends FarmEvent { } /** STEP 2: Once all the resource queries are done, create data that looks - * like this: */ -export interface NewCalendarItem { - dayOfMonth: number; - month: string; - executable_id: number; - executable_type: ExecutableType; - farm_event_id: number; - label: string; - sortKey: number; - timeStr: string; -} + * like `CalendarDay`. */ diff --git a/frontend/farm_designer/interfaces.ts b/frontend/farm_designer/interfaces.ts index 51c5e2dd7..3cf93efa3 100644 --- a/frontend/farm_designer/interfaces.ts +++ b/frontend/farm_designer/interfaces.ts @@ -269,8 +269,3 @@ export interface CurrentPointPayl { r: number; color?: string; } - -export interface SavedGarden { - id?: number; - name?: string; -} diff --git a/frontend/farm_designer/map/interfaces.ts b/frontend/farm_designer/map/interfaces.ts index de6262203..35ed42329 100644 --- a/frontend/farm_designer/map/interfaces.ts +++ b/frontend/farm_designer/map/interfaces.ts @@ -24,10 +24,6 @@ export interface PlantLayerProps { animate: boolean; } -export interface CropSpreadDict { - [key: string]: number | undefined; -} - export interface GardenMapLegendProps { zoom: (value: number) => () => void; toggle: (property: keyof State) => () => void; @@ -76,7 +72,7 @@ export interface GardenPointProps { point: TaggedGenericPointer; } -export interface DragHelpersBaseProps { +interface DragHelpersBaseProps { dragging: boolean; mapTransformProps: MapTransformProps; zoomLvl: number;