From 4a7a683ba786bcf7106f9d3730d40390525a10aa Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Fri, 8 May 2020 13:27:15 -0700 Subject: [PATCH] dep updates (fe) --- frontend/__test_support__/fake_state/resources.ts | 2 +- .../__test_support__/resource_index_builder.ts | 2 +- .../pin_bindings/list_and_label_support.tsx | 1 - .../__tests__/state_to_props_test.tsx | 10 +--------- .../tool_slots/__tests__/tool_slot_layer_test.tsx | 1 - .../farm_designer/plants/edit_plant_status.tsx | 14 +++++--------- .../points/__tests__/create_points_test.tsx | 2 ++ .../points/__tests__/point_inventory_test.tsx | 3 +-- frontend/farm_designer/points/create_points.tsx | 1 + frontend/farm_designer/points/point_inventory.tsx | 2 +- frontend/farm_designer/state_to_props.ts | 2 +- .../tools/__tests__/add_tool_slot_test.tsx | 4 ++-- frontend/farm_designer/tools/add_tool_slot.tsx | 2 +- frontend/resources/__tests__/selectors_test.ts | 1 - frontend/resources/selectors_by_kind.ts | 2 +- frontend/sequences/locals_list/test_helpers.ts | 1 - .../step_tiles/tile_mark_as/field_warning.tsx | 4 ++-- jest.config.js | 7 ------- package.json | 6 +++--- 19 files changed, 23 insertions(+), 44 deletions(-) diff --git a/frontend/__test_support__/fake_state/resources.ts b/frontend/__test_support__/fake_state/resources.ts index a98fb1b46..c7ca1b4d4 100644 --- a/frontend/__test_support__/fake_state/resources.ts +++ b/frontend/__test_support__/fake_state/resources.ts @@ -134,7 +134,6 @@ export function fakeToolSlot(): TaggedToolSlotPointer { x: 0, y: 0, z: 0, - radius: 25, pointer_type: "ToolSlot", meta: {}, tool_id: undefined, @@ -181,6 +180,7 @@ export function fakeWeed(): TaggedWeedPointer { y: 400, z: 0, radius: 100, + plant_stage: "planned", meta: { created_by: "plant-detection", color: "red" } }); } diff --git a/frontend/__test_support__/resource_index_builder.ts b/frontend/__test_support__/resource_index_builder.ts index a7a81beb7..f5a409b44 100644 --- a/frontend/__test_support__/resource_index_builder.ts +++ b/frontend/__test_support__/resource_index_builder.ts @@ -265,7 +265,6 @@ const tr11: TaggedPoint = { "pointer_type": "ToolSlot", "pullout_direction": 0, "gantry_mounted": false, - "radius": 25, "x": 10, "y": 10, "z": 10, @@ -329,6 +328,7 @@ const tr16: TaggedPoint = { }, name: "untitled", pointer_type: "Weed", + plant_stage: "planned", radius: 10, x: 490, y: 421, diff --git a/frontend/devices/pin_bindings/list_and_label_support.tsx b/frontend/devices/pin_bindings/list_and_label_support.tsx index dfe80982a..1aea02d82 100644 --- a/frontend/devices/pin_bindings/list_and_label_support.tsx +++ b/frontend/devices/pin_bindings/list_and_label_support.tsx @@ -32,7 +32,6 @@ export const specialActionLabelLookup: { [x: string]: string } = { export const specialActionList: DropDownItem[] = Object.values(PinBindingSpecialAction) - .filter(action => action != PinBindingSpecialAction.dump_info) .map((action: PinBindingSpecialAction) => ({ label: specialActionLabelLookup[action], value: action })); diff --git a/frontend/farm_designer/__tests__/state_to_props_test.tsx b/frontend/farm_designer/__tests__/state_to_props_test.tsx index aea704001..d2c633990 100644 --- a/frontend/farm_designer/__tests__/state_to_props_test.tsx +++ b/frontend/farm_designer/__tests__/state_to_props_test.tsx @@ -18,8 +18,6 @@ import { generateUuid } from "../../resources/util"; import { DevSettings } from "../../account/dev/dev_support"; describe("mapStateToProps()", () => { - const DISCARDED_AT = "2018-01-01T00:00:00.000Z"; - it("hovered plantUUID is undefined", () => { const state = fakeState(); state.resources.consumers.farm_designer.hoveredPlant = { @@ -55,11 +53,8 @@ describe("mapStateToProps()", () => { const webAppConfig = fakeWebAppConfig(); (webAppConfig.body as WebAppConfig).show_historic_points = true; const point1 = fakePoint(); - point1.body.discarded_at = undefined; const point2 = fakePoint(); - point2.body.discarded_at = DISCARDED_AT; const point3 = fakePoint(); - point3.body.discarded_at = DISCARDED_AT; state.resources = buildResourceIndex([ webAppConfig, point1, point2, point3, fakeDevice(), ]); @@ -71,15 +66,12 @@ describe("mapStateToProps()", () => { const webAppConfig = fakeWebAppConfig(); (webAppConfig.body as WebAppConfig).show_historic_points = false; const point1 = fakePoint(); - point1.body.discarded_at = undefined; const point2 = fakePoint(); - point2.body.discarded_at = DISCARDED_AT; const point3 = fakePoint(); - point3.body.discarded_at = DISCARDED_AT; state.resources = buildResourceIndex([ webAppConfig, point1, point2, point3, fakeDevice(), ]); - expect(mapStateToProps(state).genericPoints.length).toEqual(1); + expect(mapStateToProps(state).genericPoints.length).toEqual(3); }); it("returns sensor readings", () => { diff --git a/frontend/farm_designer/map/layers/tool_slots/__tests__/tool_slot_layer_test.tsx b/frontend/farm_designer/map/layers/tool_slots/__tests__/tool_slot_layer_test.tsx index b7a04a8c1..f8f2eabbd 100644 --- a/frontend/farm_designer/map/layers/tool_slots/__tests__/tool_slot_layer_test.tsx +++ b/frontend/farm_designer/map/layers/tool_slots/__tests__/tool_slot_layer_test.tsx @@ -22,7 +22,6 @@ describe("", () => { pointer_type: "ToolSlot", tool_id: undefined, name: "Name", - radius: 50, x: 1, y: 2, z: 3, diff --git a/frontend/farm_designer/plants/edit_plant_status.tsx b/frontend/farm_designer/plants/edit_plant_status.tsx index 5f3cd4001..8e580b807 100644 --- a/frontend/farm_designer/plants/edit_plant_status.tsx +++ b/frontend/farm_designer/plants/edit_plant_status.tsx @@ -7,7 +7,6 @@ import { t } from "../../i18next_wrapper"; import { UUID } from "../../resources/interfaces"; import { edit, save } from "../../api/crud"; import { EditPlantStatusProps } from "./plant_panel"; -import { PlantPointer } from "farmbot/dist/resources/api_resources"; export const PLANT_STAGE_DDI_LOOKUP = (): { [x: string]: DropDownItem } => ({ planned: { label: t("Planned"), value: "planned" }, @@ -77,8 +76,9 @@ export const PlantStatusBulkUpdate = (props: PlantStatusBulkUpdateProps) => const points = props.allPoints.filter(point => props.selected.includes(point.uuid) && point.kind === "Point" - && ["Plant", "Weed"].includes(point.body.pointer_type) - && (point.body as unknown as PlantPointer).plant_stage != plant_stage); + && (point.body.pointer_type == "Plant" + || point.body.pointer_type == "Weed") + && point.body.plant_stage != plant_stage); points.length > 0 && confirm( t("Change status to '{{ status }}' for {{ num }} items?", { status: plant_stage, num: points.length })) @@ -98,10 +98,6 @@ export interface EditWeedStatusProps { export const EditWeedStatus = (props: EditWeedStatusProps) => WEED_STATUSES.includes("" + ddi.value))} - selectedItem={WEED_STAGE_DDI_LOOKUP()[( - props.weed.body as unknown as PlantPointer).plant_stage]} + selectedItem={WEED_STAGE_DDI_LOOKUP()[props.weed.body.plant_stage]} onChange={ddi => - props.updateWeed({ - ["plant_stage" as keyof TaggedWeedPointer["body"]]: - ddi.value as PlantStage - })} />; + props.updateWeed({ plant_stage: ddi.value as PlantStage })} />; diff --git a/frontend/farm_designer/points/__tests__/create_points_test.tsx b/frontend/farm_designer/points/__tests__/create_points_test.tsx index e900fa27e..16cece047 100644 --- a/frontend/farm_designer/points/__tests__/create_points_test.tsx +++ b/frontend/farm_designer/points/__tests__/create_points_test.tsx @@ -133,6 +133,7 @@ describe("", () => { meta: { color: "green", created_by: "farm-designer", type: "point" }, name: "Created Point", pointer_type: "GenericPointer", + plant_stage: "planned", radius: 30, x: 10, y: 20, z: 0, }); }); @@ -146,6 +147,7 @@ describe("", () => { meta: { color: "red", created_by: "farm-designer", type: "weed" }, name: "Created Weed", pointer_type: "Weed", + plant_stage: "planned", radius: 30, x: 10, y: 20, z: 0, }); }); diff --git a/frontend/farm_designer/points/__tests__/point_inventory_test.tsx b/frontend/farm_designer/points/__tests__/point_inventory_test.tsx index e828b770f..5b746e1fd 100644 --- a/frontend/farm_designer/points/__tests__/point_inventory_test.tsx +++ b/frontend/farm_designer/points/__tests__/point_inventory_test.tsx @@ -69,9 +69,8 @@ describe("mapStateToProps()", () => { const state = fakeState(); const point = fakePoint(); const discarded = fakePoint(); - discarded.body.discarded_at = "2016-05-22T05:00:00.000Z"; state.resources = buildResourceIndex([point, discarded]); const props = mapStateToProps(state); - expect(props.genericPoints).toEqual([point]); + expect(props.genericPoints).toEqual([point, discarded]); }); }); diff --git a/frontend/farm_designer/points/create_points.tsx b/frontend/farm_designer/points/create_points.tsx index e5196e4be..a09bec55b 100644 --- a/frontend/farm_designer/points/create_points.tsx +++ b/frontend/farm_designer/points/create_points.tsx @@ -183,6 +183,7 @@ export class RawCreatePoints x: this.attr("cx"), y: this.attr("cy"), z: 0, + plant_stage: "planned", radius: this.attr("r"), }; this.props.dispatch(initSave("Point", body)); diff --git a/frontend/farm_designer/points/point_inventory.tsx b/frontend/farm_designer/points/point_inventory.tsx index 524eb75ad..3792996ac 100644 --- a/frontend/farm_designer/points/point_inventory.tsx +++ b/frontend/farm_designer/points/point_inventory.tsx @@ -29,7 +29,7 @@ export function mapStateToProps(props: Everything): PointsProps { const { hoveredPoint } = props.resources.consumers.farm_designer; return { genericPoints: selectAllGenericPointers(props.resources.index) - .filter(x => !x.body.discarded_at), + .filter(x => x), dispatch: props.dispatch, hoveredPoint, }; diff --git a/frontend/farm_designer/state_to_props.ts b/frontend/farm_designer/state_to_props.ts index a7e7932d7..cdc7df152 100644 --- a/frontend/farm_designer/state_to_props.ts +++ b/frontend/farm_designer/state_to_props.ts @@ -57,7 +57,7 @@ export function mapStateToProps(props: Everything): Props { const allGenericPoints = selectAllGenericPointers(props.resources.index); const genericPoints = getConfigValue(BooleanSetting.show_historic_points) ? allGenericPoints - : allGenericPoints.filter(x => !x.body.discarded_at); + : allGenericPoints.filter(x => x); const weeds = selectAllWeedPointers(props.resources.index); const fwConfig = validFwConfig(getFirmwareConfig(props.resources.index)); diff --git a/frontend/farm_designer/tools/__tests__/add_tool_slot_test.tsx b/frontend/farm_designer/tools/__tests__/add_tool_slot_test.tsx index 3dce7fff3..937a0c94d 100644 --- a/frontend/farm_designer/tools/__tests__/add_tool_slot_test.tsx +++ b/frontend/farm_designer/tools/__tests__/add_tool_slot_test.tsx @@ -43,7 +43,7 @@ describe("", () => { "direction", "gantry-mounted", ].map(string => expect(wrapper.text().toLowerCase()).toContain(string)); expect(init).toHaveBeenCalledWith("Point", { - pointer_type: "ToolSlot", name: "Slot", radius: 0, meta: {}, + pointer_type: "ToolSlot", name: "Slot", meta: {}, x: 0, y: 0, z: 0, tool_id: undefined, pullout_direction: ToolPulloutDirection.NONE, gantry_mounted: false, @@ -119,7 +119,7 @@ describe("", () => { const wrapper = mount(); expect(wrapper.text().toLowerCase()).not.toContain("tool"); expect(init).toHaveBeenCalledWith("Point", { - pointer_type: "ToolSlot", name: "Slot", radius: 0, meta: {}, + pointer_type: "ToolSlot", name: "Slot", meta: {}, x: 0, y: 0, z: 0, tool_id: undefined, pullout_direction: ToolPulloutDirection.NONE, gantry_mounted: true, diff --git a/frontend/farm_designer/tools/add_tool_slot.tsx b/frontend/farm_designer/tools/add_tool_slot.tsx index dd069a2c2..9e31a4300 100644 --- a/frontend/farm_designer/tools/add_tool_slot.tsx +++ b/frontend/farm_designer/tools/add_tool_slot.tsx @@ -21,7 +21,7 @@ export class RawAddToolSlot componentDidMount() { const action = init("Point", { - pointer_type: "ToolSlot", name: t("Slot"), radius: 0, meta: {}, + pointer_type: "ToolSlot", name: t("Slot"), meta: {}, x: 0, y: 0, z: 0, tool_id: undefined, pullout_direction: ToolPulloutDirection.NONE, gantry_mounted: !hasUTM(this.props.firmwareHardware) ? true : false, diff --git a/frontend/resources/__tests__/selectors_test.ts b/frontend/resources/__tests__/selectors_test.ts index 9018d5529..f2497250f 100644 --- a/frontend/resources/__tests__/selectors_test.ts +++ b/frontend/resources/__tests__/selectors_test.ts @@ -28,7 +28,6 @@ const fakeSlot: TaggedToolSlotPointer = arrayUnwrap(newTaggedResource("Point", { tool_id: TOOL_ID, pointer_type: "ToolSlot", - radius: 0, x: 0, y: 0, z: 0, diff --git a/frontend/resources/selectors_by_kind.ts b/frontend/resources/selectors_by_kind.ts index 0932ea3c1..b93539849 100644 --- a/frontend/resources/selectors_by_kind.ts +++ b/frontend/resources/selectors_by_kind.ts @@ -79,7 +79,7 @@ export const selectAllPoints = export const selectAllPointGroups = (i: ResourceIndex) => findAll(i, "PointGroup"); export const selectAllActivePoints = (input: ResourceIndex) => - selectAllPoints(input).filter(x => !x.body.discarded_at); + selectAllPoints(input).filter(x => x); export const selectAllFarmwareEnvs = (i: ResourceIndex) => findAll(i, "FarmwareEnv"); diff --git a/frontend/sequences/locals_list/test_helpers.ts b/frontend/sequences/locals_list/test_helpers.ts index add4ae492..d57b0ff7e 100644 --- a/frontend/sequences/locals_list/test_helpers.ts +++ b/frontend/sequences/locals_list/test_helpers.ts @@ -32,7 +32,6 @@ export function fakeResourceIndex(extra: TaggedResource[] = []): ResourceIndex { "meta": {}, "name": "ToolSlot 1", "pointer_type": "ToolSlot", - "radius": 100, "x": 100, "y": 200, "z": 300, diff --git a/frontend/sequences/step_tiles/tile_mark_as/field_warning.tsx b/frontend/sequences/step_tiles/tile_mark_as/field_warning.tsx index 1ea9bc166..911c82f65 100644 --- a/frontend/sequences/step_tiles/tile_mark_as/field_warning.tsx +++ b/frontend/sequences/step_tiles/tile_mark_as/field_warning.tsx @@ -59,8 +59,8 @@ const TOOL_SLOT_FIELDS: ToolSlotFields = (BASE_FIELDS as ToolSlotFields) .concat(["tool_id", "pullout_direction", "gantry_mounted"]); const GENERIC_POINTER_FIELDS: GenericPointerFields = (BASE_FIELDS as GenericPointerFields).concat(["radius"]); -const WEED_FIELDS: WeedFields = (BASE_FIELDS as PlantFields) - .concat(["plant_stage", "radius"]) as WeedFields; +const WEED_FIELDS: WeedFields = (BASE_FIELDS as WeedFields) + .concat(["plant_stage", "radius"]); const POINT_FIELDS: PointFields = (BASE_FIELDS as PointFields) .concat(PLANT_FIELDS) .concat(TOOL_SLOT_FIELDS) diff --git a/jest.config.js b/jest.config.js index d7734e224..a14f005a3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,13 +2,6 @@ module.exports = { "clearMocks": true, "logHeapUsage": true, "globals": { - "ts-jest": { - "diagnostics": { - "ignoreCodes": [ - 151001 - ] - } - }, "globalConfig": { "NODE_ENV": "development", "TOS_URL": "https://farm.bot/tos/", diff --git a/package.json b/package.json index de510f06e..928f6fc72 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "coveralls": "3.1.0", "enzyme": "3.11.0", "enzyme-adapter-react-16": "1.15.2", - "farmbot": "10.0.0-rc1", + "farmbot": "10.0.0-rc2", "i18next": "19.4.4", "install": "0.13.0", "lodash": "4.17.15", @@ -53,7 +53,7 @@ "markdown-it-emoji": "1.4.0", "moment": "2.25.3", "moxios": "0.4.0", - "mqtt": "4.0.0", + "mqtt": "4.0.1", "npm": "6.14.5", "parcel-bundler": "1.12.4", "promise-timeout": "1.3.0", @@ -83,7 +83,7 @@ "jest-junit": "10.0.0", "jest-skipped-reporter": "0.0.5", "jshint": "2.11.0", - "madge": "3.8.0", + "madge": "3.9.0", "sass": "1.26.5" } }