diff --git a/frontend/farm_designer/__tests__/move_to_test.tsx b/frontend/farm_designer/__tests__/move_to_test.tsx
index ac15b57af..fd184a51a 100644
--- a/frontend/farm_designer/__tests__/move_to_test.tsx
+++ b/frontend/farm_designer/__tests__/move_to_test.tsx
@@ -33,7 +33,7 @@ describe("", () => {
it("moves to location: bot's current z value", () => {
const wrapper = mount();
wrapper.find("button").simulate("click");
- expect(mockDevice.moveAbsolute).toHaveBeenCalledWith({ x: 1, y: 2, z: 30 });
+ expect(mockDevice.moveAbsolute).toHaveBeenCalledWith({ x: 1, y: 2, z: 3 });
});
it("goes back", () => {
diff --git a/frontend/farm_designer/move_to.tsx b/frontend/farm_designer/move_to.tsx
index e99601f5e..03d8330b7 100644
--- a/frontend/farm_designer/move_to.tsx
+++ b/frontend/farm_designer/move_to.tsx
@@ -43,7 +43,7 @@ interface MoveToFormState {
}
export class MoveToForm extends React.Component {
- state = { z: undefined };
+ state = { z: this.props.chosenLocation.z };
get vector(): { x: number, y: number, z: number } {
const { chosenLocation } = this.props;
diff --git a/frontend/farm_designer/plants/__tests__/plant_panel_test.tsx b/frontend/farm_designer/plants/__tests__/plant_panel_test.tsx
index 05ce15000..e3d6ca952 100644
--- a/frontend/farm_designer/plants/__tests__/plant_panel_test.tsx
+++ b/frontend/farm_designer/plants/__tests__/plant_panel_test.tsx
@@ -18,6 +18,7 @@ describe("", () => {
const info: FormattedPlantInfo = {
x: 12,
y: 34,
+ z: 0,
id: undefined,
name: "tomato",
uuid: "Plant.0.0",
@@ -91,7 +92,7 @@ describe("", () => {
expect(history.push).toHaveBeenCalledWith("/app/designer/move_to");
expect(innerDispatch).toHaveBeenLastCalledWith({
type: Actions.CHOOSE_LOCATION,
- payload: { x: 12, y: 34, z: undefined }
+ payload: { x: 12, y: 34, z: 0 }
});
});
});
@@ -119,7 +120,7 @@ describe("", () => {
describe("", () => {
const fakeProps = (): EditPlantLocationProps => ({
uuid: "Plant.0.0",
- xyLocation: { x: 1, y: 2 },
+ plantLocation: { x: 1, y: 2, z: 0 },
updatePlant: jest.fn(),
});
diff --git a/frontend/farm_designer/plants/map_state_to_props.tsx b/frontend/farm_designer/plants/map_state_to_props.tsx
index 8a72184fa..55202d634 100644
--- a/frontend/farm_designer/plants/map_state_to_props.tsx
+++ b/frontend/farm_designer/plants/map_state_to_props.tsx
@@ -40,6 +40,7 @@ export function mapStateToProps(props: Everything): EditPlantInfoProps {
export interface FormattedPlantInfo {
x: number;
y: number;
+ z: number;
id: number | undefined;
name: string;
uuid: string;
@@ -72,6 +73,7 @@ export function formatPlantInfo(plant: TaggedPlant): FormattedPlantInfo {
daysOld: plantAge(plant),
x: plant.body.x,
y: plant.body.y,
+ z: plant.body.z,
uuid: plant.uuid,
plantedAt: plantDate(plant),
plantStatus: get(plant, "body.plant_stage", "planned"),
diff --git a/frontend/farm_designer/plants/plant_panel.tsx b/frontend/farm_designer/plants/plant_panel.tsx
index 0a0af236e..c60ef2dc8 100644
--- a/frontend/farm_designer/plants/plant_panel.tsx
+++ b/frontend/farm_designer/plants/plant_panel.tsx
@@ -4,7 +4,7 @@ import { round } from "../map/util";
import { history } from "../../history";
import { BlurableInput, Row, Col } from "../../ui";
import { PlantOptions } from "../interfaces";
-import { PlantStage } from "farmbot";
+import { PlantStage, Xyz } from "farmbot";
import { Moment } from "moment";
import moment from "moment";
import { Actions } from "../../constants";
@@ -51,19 +51,19 @@ export const EditDatePlanted = (props: EditDatePlantedProps) => {
};
export interface EditPlantLocationProps extends EditPlantProperty {
- xyLocation: Record<"x" | "y", number>;
+ plantLocation: Record;
}
export const EditPlantLocation = (props: EditPlantLocationProps) => {
- const { xyLocation, updatePlant, uuid } = props;
+ const { plantLocation, updatePlant, uuid } = props;
return
- {["x", "y"].map((axis: "x" | "y") =>
-
+ {["x", "y", "z"].map((axis: Xyz) =>
+
updatePlant(uuid, {
[axis]: round(parseIntInput(e.currentTarget.value))
})} />
@@ -71,11 +71,11 @@ export const EditPlantLocation = (props: EditPlantLocationProps) => {
;
};
-const chooseLocation = (to: Record<"x" | "y", number | undefined>) =>
+const chooseLocation = (to: Record) =>
(dispatch: Function): Promise => {
dispatch({
type: Actions.CHOOSE_LOCATION,
- payload: { x: to.x, y: to.y, z: undefined }
+ payload: { x: to.x, y: to.y, z: to.z }
});
return Promise.resolve();
};
@@ -83,6 +83,7 @@ const chooseLocation = (to: Record<"x" | "y", number | undefined>) =>
interface MoveToPlantProps {
x: number;
y: number;
+ z: number;
dispatch: Function;
}
@@ -90,8 +91,9 @@ const MoveToPlant = (props: MoveToPlantProps) =>
;
@@ -141,7 +143,7 @@ export function PlantPanel(props: PlantPanelProps) {
info, onDestroy, updatePlant, dispatch, inSavedGarden, timeSettings
} = props;
const { slug, plantedAt, daysOld, uuid, plantStatus } = info;
- const { x, y } = info;
+ const { x, y, z } = info;
const destroy = () => onDestroy(uuid);
return