Done moving imports. TODO: Re-publish fbjs
parent
f41d962499
commit
6190cbd5ce
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { ChangePassword } from "../components/index";
|
||||
import { mount } from "enzyme";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import * as moxios from "moxios";
|
||||
import { API } from "../../api/api";
|
||||
import { error } from "farmbot-toastr";
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
WidgetBody,
|
||||
SaveBtn
|
||||
} from "../../ui/index";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import Axios from "axios";
|
||||
import { API } from "../../api/index";
|
||||
import { prettyPrintApiErrors, equals, trim } from "../../util";
|
||||
|
|
|
@ -21,7 +21,7 @@ import { ReduxAction } from "../../redux/interfaces";
|
|||
import { maybeStartTracking } from "../maybe_start_tracking";
|
||||
import { API } from "../api";
|
||||
import { betterCompact } from "../../util";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import * as _ from "lodash";
|
||||
|
||||
describe("AJAX data tracking", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { destroyNO } from "../../resources/actions";
|
||||
import { destroyCatch } from "../crud";
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
TaggedResource
|
||||
TaggedResource, SpecialStatus
|
||||
} from "farmbot";
|
||||
import {
|
||||
isTaggedResource,
|
||||
SpecialStatus,
|
||||
} from "../resources/tagged_resources";
|
||||
import {
|
||||
ResourceName,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SpecialStatus } from "../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
export interface EditResourceParams {
|
||||
uuid: string;
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
handleUpdate,
|
||||
handleCreateOrUpdate
|
||||
} from "../auto_sync";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { Actions } from "../../constants";
|
||||
import { fakeState } from "../../__test_support__/fake_state";
|
||||
import { GetState } from "../../redux/interfaces";
|
||||
|
|
|
@ -9,7 +9,7 @@ import { bot } from "../../../__test_support__/fake_state/bot";
|
|||
import { PeripheralsProps } from "../../../devices/interfaces";
|
||||
import { fakePeripheral } from "../../../__test_support__/fake_state/resources";
|
||||
import { clickButton } from "../../../__test_support__/helpers";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { error } from "farmbot-toastr";
|
||||
|
||||
describe("<Peripherals />", () => {
|
||||
|
|
|
@ -7,11 +7,10 @@ import { Widget, WidgetBody, WidgetHeader, SaveBtn } from "../../ui/index";
|
|||
import { PeripheralsProps } from "../../devices/interfaces";
|
||||
import { PeripheralState } from "./interfaces";
|
||||
import {
|
||||
TaggedPeripheral,
|
||||
TaggedPeripheral, SpecialStatus,
|
||||
} from "farmbot";
|
||||
import {
|
||||
getArrayStatus,
|
||||
SpecialStatus
|
||||
} from "../../resources/tagged_resources";
|
||||
import { saveAll, init } from "../../api/crud";
|
||||
import { ToolTips } from "../../constants";
|
||||
|
|
|
@ -10,7 +10,7 @@ import { SensorsProps } from "../../../devices/interfaces";
|
|||
import { fakeSensor } from "../../../__test_support__/fake_state/resources";
|
||||
import { error } from "farmbot-toastr";
|
||||
import { clickButton } from "../../../__test_support__/helpers";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<Sensors />", () => {
|
||||
function fakeProps(): SensorsProps {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { fakeWebcamFeed } from "../../../__test_support__/fake_state/resources";
|
|||
import { mount } from "enzyme";
|
||||
import { props } from "../test_helpers";
|
||||
import { Edit } from "../edit";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { clickButton } from "../../../__test_support__/helpers";
|
||||
import { WebcamPanelProps } from "../interfaces";
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import { mount } from "enzyme";
|
|||
import { WebcamPanel, preToggleCleanup } from "../index";
|
||||
import { fakeWebcamFeed } from "../../../__test_support__/fake_state/resources";
|
||||
import { destroy, save } from "../../../api/crud";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { clickButton, allButtonText } from "../../../__test_support__/helpers";
|
||||
|
||||
describe("<WebcamPanel/>", () => {
|
||||
|
|
|
@ -47,7 +47,7 @@ import { Actions } from "../../constants";
|
|||
import { buildResourceIndex } from "../../__test_support__/resource_index_builder";
|
||||
import { API } from "../../api/index";
|
||||
import axios from "axios";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { McuParamName } from "farmbot";
|
||||
import { bot } from "../../__test_support__/fake_state/bot";
|
||||
import { success, error, warning, info } from "farmbot-toastr";
|
||||
|
|
|
@ -13,7 +13,7 @@ import { fakeResource } from "../../../__test_support__/fake_resource";
|
|||
import { FarmbotOsProps } from "../../interfaces";
|
||||
import axios from "axios";
|
||||
import { Actions } from "../../../constants";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<FarmbotOsSettings/>", () => {
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from "react";
|
|||
import { fakeResource } from "../../../../__test_support__/fake_resource";
|
||||
import { LastSeen, LastSeenProps } from "../last_seen_row";
|
||||
import { mount } from "enzyme";
|
||||
import { SpecialStatus } from "../../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<LastSeen/>", () => {
|
||||
const resource = () => fakeResource("Device", {
|
||||
|
@ -28,7 +28,7 @@ describe("<LastSeen/>", () => {
|
|||
});
|
||||
|
||||
it("tells you the device has never been seen", () => {
|
||||
const wrapper = mount(<LastSeen {...props() } />);
|
||||
const wrapper = mount(<LastSeen {...props()} />);
|
||||
expect(wrapper.text()).toContain("network connectivity issue");
|
||||
});
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { SpacePanelHeader } from "./hardware_settings/space_panel_header";
|
|||
import {
|
||||
HomingAndCalibration
|
||||
} from "./hardware_settings/homing_and_calibration";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { Popover, Position } from "@blueprintjs/core";
|
||||
import { FwParamExportMenu } from "./hardware_settings/export_menu";
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { render, mount } from "enzyme";
|
|||
import { ConnectivityPanel } from "../index";
|
||||
import { StatusRowProps } from "../connectivity_row";
|
||||
import * as _ from "lodash";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { bot } from "../../../__test_support__/fake_state/bot";
|
||||
|
||||
describe("<ConnectivityPanel/>", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
import { RetryBtn } from "../retry_btn";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<RetryBtn/>", () => {
|
||||
it("is green before saving", () => {
|
||||
|
|
|
@ -3,7 +3,7 @@ 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 } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { ConnectivityDiagram } from "./diagram";
|
||||
import { ToolTips } from "../../constants";
|
||||
import {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as React from "react";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { t } from "i18next";
|
||||
|
||||
interface RetryBtnProps {
|
||||
|
@ -16,5 +16,5 @@ export function RetryBtn(props: RetryBtnProps) {
|
|||
className={css + " fb-button"}
|
||||
onClick={props.onClick}>
|
||||
{t("Check Again")}
|
||||
</button>;
|
||||
</button>;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
} from "../edit_fe_form";
|
||||
import { isString } from "lodash";
|
||||
import { repeatOptions } from "../map_state_to_props_add_edit";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { success, error } from "farmbot-toastr";
|
||||
import * as moment from "moment";
|
||||
import { fakeState } from "../../../__test_support__/fake_state";
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
ExecutableType
|
||||
} from "../interfaces";
|
||||
import { BackArrow } from "../../ui/index";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
interface State {
|
||||
uuid: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { MapImage, MapImageProps } from "../map_image";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { trim } from "../../../util";
|
||||
import { fakeMapTransformProps } from "../../../__test_support__/map_transform_props";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { editRegimen, selectRegimen } from "../actions";
|
||||
import { fakeRegimen } from "../../__test_support__/fake_state/resources";
|
||||
import { Actions } from "../../constants";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("editRegimen()", () => {
|
||||
it("doesn't call edit", () => {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ActiveEditor } from "../active_editor";
|
|||
import { fakeRegimen } from "../../../__test_support__/fake_state/resources";
|
||||
import { ActiveEditorProps } from "../interfaces";
|
||||
import { Actions } from "../../../constants";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<ActiveEditor />", () => {
|
||||
const props: ActiveEditorProps = {
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as React from "react";
|
|||
import { mount } from "enzyme";
|
||||
import { CopyButton } from "../copy_button";
|
||||
import { fakeRegimen } from "../../../__test_support__/fake_state/resources";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { Actions } from "../../../constants";
|
||||
import { push } from "../../../history";
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { fakeRegimen } from "../../../__test_support__/fake_state/resources";
|
|||
import { RegimenEditorProps } from "../interfaces";
|
||||
import { destroy, save } from "../../../api/crud";
|
||||
import { clickButton } from "../../../__test_support__/helpers";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<RegimenEditor />", () => {
|
||||
function fakeProps(): RegimenEditorProps {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { RegimenListItemProps } from "../../interfaces";
|
|||
import { RegimenListItem } from "../regimen_list_item";
|
||||
import { render, shallow } from "enzyme";
|
||||
import { fakeRegimen } from "../../../__test_support__/fake_state/resources";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { Actions } from "../../../constants";
|
||||
|
||||
describe("<RegimenListItem/>", () => {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { updateOK, generalizedError, GeneralizedError } from "../actions";
|
|||
import { fakeUser } from "../../__test_support__/fake_state/resources";
|
||||
import { Actions } from "../../constants";
|
||||
import { toastErrors } from "../../toast_errors";
|
||||
import { SpecialStatus } from "../tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("updateOK()", () => {
|
||||
it("creates an action", () => {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { fakeTool } from "../../__test_support__/fake_state/resources";
|
||||
import { SpecialStatus, getArrayStatus } from "../tagged_resources";
|
||||
import { getArrayStatus } from "../tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("getArrayStatus()", () => {
|
||||
const toolArray = () => [fakeTool(), fakeTool(), fakeTool()];
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
TaggedPlantPointer,
|
||||
TaggedGenericPointer,
|
||||
PointerType,
|
||||
SpecialStatus,
|
||||
} from "farmbot";
|
||||
|
||||
export interface TaggedResourceBase {
|
||||
|
@ -30,17 +31,6 @@ export interface TaggedResourceBase {
|
|||
specialStatus: SpecialStatus;
|
||||
}
|
||||
|
||||
/** Denotes special status of resource */
|
||||
export enum SpecialStatus {
|
||||
/** The local copy is different than the one on the remote end. */
|
||||
DIRTY = "DIRTY",
|
||||
/** The local copy is being saved on the remote end right now? */
|
||||
SAVING = "SAVING",
|
||||
/** API and FE are in sync. Using "" for now because its falsey like old
|
||||
* `undefined` value */
|
||||
SAVED = ""
|
||||
}
|
||||
|
||||
/** Given an array of TaggedResources, returns the most "important" special status.
|
||||
* the hierarchy is SAVED => DIRTY => SAVING */
|
||||
export function getArrayStatus(i: TaggedResource[]): SpecialStatus {
|
||||
|
@ -52,61 +42,6 @@ export function getArrayStatus(i: TaggedResource[]): SpecialStatus {
|
|||
return SpecialStatus.SAVED;
|
||||
}
|
||||
}
|
||||
export interface Resource<T extends ResourceName, U extends object>
|
||||
extends TaggedResourceBase {
|
||||
kind: T;
|
||||
body: U;
|
||||
}
|
||||
|
||||
// export type TaggedPinBinding = Resource<"PinBinding", PinBinding>;
|
||||
// // export type TaggedDeviceConfig = Resource<"DeviceConfig", DeviceConfig>;
|
||||
// export type TaggedRegimen = Resource<"Regimen", Regimen>;
|
||||
// export type TaggedTool = Resource<"Tool", Tool>;
|
||||
// export type TaggedSequence = Resource<"Sequence", Sequence>;
|
||||
// export type TaggedFarmEvent = Resource<"FarmEvent", FarmEvent>;
|
||||
// export type TaggedImage = Resource<"Image", Image>;
|
||||
// export type TaggedLog = Resource<"Log", Log>;
|
||||
// export type TaggedPeripheral = Resource<"Peripheral", Peripheral>;
|
||||
// export type TaggedFbosConfig = Resource<"FbosConfig", FbosConfig>;
|
||||
// export type TaggedFirmwareConfig = Resource<"FirmwareConfig", FirmwareConfig>;
|
||||
// export type TaggedWebAppConfig = Resource<"WebAppConfig", WebAppConfig>;
|
||||
// export type TaggedSensorReading = Resource<"SensorReading", SensorReading>;
|
||||
// export type TaggedSensor = Resource<"Sensor", Sensor>;
|
||||
// export type TaggedSavedGarden = Resource<"SavedGarden", SavedGarden>;
|
||||
// export type TaggedPlantTemplate = Resource<"PlantTemplate", PlantTemplate>;
|
||||
// export type TaggedDiagnosticDump = Resource<"DiagnosticDump", DiagnosticDump>;
|
||||
|
||||
// type PointUnion = GenericPointer | PlantPointer | ToolSlotPointer;
|
||||
// export type PointerType =
|
||||
// | TaggedToolSlotPointer
|
||||
// | TaggedGenericPointer
|
||||
// | TaggedPlantPointer;
|
||||
|
||||
// export type TaggedGenericPointer = Resource<"Point", GenericPointer>;
|
||||
// export type TaggedPlantPointer = Resource<"Point", PlantPointer>;
|
||||
// export type TaggedToolSlotPointer = Resource<"Point", ToolSlotPointer>;
|
||||
|
||||
// export type TaggedPoint = Resource<"Point", PointUnion>;
|
||||
|
||||
// export type TaggedUser = Resource<"User", User>;
|
||||
// export type TaggedDevice = Resource<"Device", DeviceAccountSettings>;
|
||||
// export type TaggedWebcamFeed = Resource<"WebcamFeed", WebcamFeed>;
|
||||
// export type TaggedFarmwareInstallation =
|
||||
// Resource<"FarmwareInstallation", FarmwareInstallation>;
|
||||
|
||||
export interface DiagnosticDump {
|
||||
id: number;
|
||||
device_id: number;
|
||||
ticket_identifier: string;
|
||||
fbos_commit: string;
|
||||
fbos_version: string;
|
||||
firmware_commit: string;
|
||||
firmware_state: string;
|
||||
network_interface: string;
|
||||
fbos_dmesg_dump: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
/** Spot check to be certain a TaggedResource is what it says it is. */
|
||||
export function sanityCheck(x: object): x is TaggedResource {
|
||||
|
|
|
@ -32,7 +32,7 @@ import { destroy, save, edit } from "../../api/crud";
|
|||
import {
|
||||
fakeHardwareFlags
|
||||
} from "../../__test_support__/sequence_hardware_settings";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { move, splice } from "../step_tiles";
|
||||
import { copySequence, editCurrentSequence } from "../actions";
|
||||
import { execSequence } from "../../devices/actions";
|
||||
|
|
|
@ -5,7 +5,7 @@ import { fakeSequence } from "../../../__test_support__/fake_state/resources";
|
|||
import { MoveAbsolute, SequenceBodyItem } from "farmbot/dist";
|
||||
import { emptyState } from "../../../resources/reducer";
|
||||
import { buildResourceIndex } from "../../../__test_support__/resource_index_builder";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
import { fakeHardwareFlags } from "../../../__test_support__/sequence_hardware_settings";
|
||||
|
||||
describe("<TileMoveAbsolute/>", () => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
} from "../toolbay_slot_direction_selection";
|
||||
import { fakeToolSlot } from "../../../__test_support__/fake_state/resources";
|
||||
import { Actions } from "../../../constants";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<SlotDirectionSelect />", () => {
|
||||
const fakeProps = (): SlotDirectionSelectProps => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { mount } from "enzyme";
|
|||
import { SlotMenu, SlotMenuProps } from "../toolbay_slot_menu";
|
||||
import { fakeToolSlot } from "../../../__test_support__/fake_state/resources";
|
||||
import { Actions } from "../../../constants";
|
||||
import { SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<SlotMenu />", () => {
|
||||
const fakeProps = (): SlotMenuProps => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { TaggedToolSlotPointer } from "farmbot";
|
||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
export function emptyToolSlot(): TaggedToolSlotPointer {
|
||||
return {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as React from "react";
|
||||
import { t } from "i18next";
|
||||
import { SpecialStatus } from "../resources/tagged_resources";
|
||||
import { SpecialStatus } from "farmbot";
|
||||
|
||||
interface SaveBtnProps {
|
||||
/** Callback */
|
||||
|
|
Loading…
Reference in New Issue