Skip to content

Commit

Permalink
Merge pull request #2452 from FarmBot/staging
Browse files Browse the repository at this point in the history
v15.8.12
  • Loading branch information
gabrielburnworth authored Dec 26, 2023
2 parents 6ca328a + 837a1cc commit 2e94865
Show file tree
Hide file tree
Showing 47 changed files with 167 additions and 133 deletions.
33 changes: 17 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ GEM
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
amq-protocol (2.3.2)
bcrypt (3.1.20)
Expand Down Expand Up @@ -114,10 +114,10 @@ GEM
docile (1.4.0)
e2mmap (0.1.0)
erubi (1.12.0)
factory_bot (6.2.1)
factory_bot (6.4.2)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
factory_bot_rails (6.4.2)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.2.2)
i18n (>= 1.8.11, < 2)
Expand Down Expand Up @@ -161,11 +161,11 @@ GEM
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.29.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-env (2.1.0)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
addressable (~> 2.8)
Expand All @@ -175,13 +175,14 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
googleauth (1.9.1)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
hashdiff (1.0.1)
hashdiff (1.1.0)
hashie (4.1.0)
httpclient (2.8.3)
i18n (1.14.1)
Expand Down Expand Up @@ -221,7 +222,7 @@ GEM
multipart-post (2.3.0)
mutations (0.9.1)
activesupport
net-imap (0.4.5)
net-imap (0.4.8)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -230,7 +231,7 @@ GEM
timeout
net-smtp (0.4.0)
net-protocol
nio4r (2.6.1)
nio4r (2.7.0)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
Expand Down Expand Up @@ -306,7 +307,7 @@ GEM
railties (>= 5.2)
retriable (3.1.2)
rexml (3.2.6)
rollbar (3.4.1)
rollbar (3.4.2)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand Down Expand Up @@ -335,7 +336,7 @@ GEM
activerecord (>= 4.0.0)
railties (>= 4.0.0)
secure_headers (6.5.0)
set (1.0.3)
set (1.0.4)
signet (0.18.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
Expand Down Expand Up @@ -432,4 +433,4 @@ RUBY VERSION
ruby 3.1.4p223

BUNDLED WITH
2.4.22
2.5.0
2 changes: 1 addition & 1 deletion frontend/__test_support__/fake_html_events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DeepPartial } from "redux";
import { DeepPartial } from "../redux/interfaces";

type DomEvent = React.SyntheticEvent<HTMLInputElement>;
export const inputEvent = (value: string, name?: string): DomEvent => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/api/__tests__/crud_data_tracking_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { destroy, saveAll, initSave, initSaveGetId } from "../crud";
import { buildResourceIndex } from "../../__test_support__/resource_index_builder";
import { createStore, applyMiddleware } from "redux";
import { resourceReducer } from "../../resources/reducer";
import thunk from "redux-thunk";
import { thunk } from "redux-thunk";
import { ReduxAction } from "../../redux/interfaces";
import { maybeStartTracking } from "../maybe_start_tracking";
import { API } from "../api";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jest.mock("../../../device", () => {

import { fetchNewDevice } from "../../../device";
import { connectDevice } from "../../connect_device";
import { DeepPartial } from "redux";
import { DeepPartial } from "../../../redux/interfaces";
import { AuthState } from "../../../auth/interfaces";
import { fakeState } from "../../../__test_support__/fake_state";

Expand Down
3 changes: 1 addition & 2 deletions frontend/connectivity/__tests__/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ import {
networkUptimeThrottleStats,
} from "../index";
import { networkUp, networkDown } from "../actions";
import { GetState } from "../../redux/interfaces";
import { GetState, DeepPartial } from "../../redux/interfaces";
import { autoSync, routeMqttData } from "../auto_sync";
import { handleInbound } from "../auto_sync_handle_inbound";
import { store } from "../../redux/store";
import { DeepPartial } from "redux";
import { Everything } from "../../interfaces";
import { Actions } from "../../constants";

Expand Down
2 changes: 1 addition & 1 deletion frontend/connectivity/__tests__/ping_mqtt_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { Farmbot } from "farmbot";
import { FarmBotInternalConfig } from "farmbot/dist/config";
import { pingNO } from "../index";
import { DeepPartial } from "redux";
import { DeepPartial } from "../../redux/interfaces";

const state: Partial<FarmBotInternalConfig> = {
LAST_PING_IN: 123,
Expand Down
4 changes: 2 additions & 2 deletions frontend/css/farm_designer/farm_designer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,11 @@
.garden-map-legend {
position: fixed;
top: 110px;
right: -140px;
right: -155px;
z-index: 3;
transition: all 0.4s ease;
&.active {
transform: translateX(-150px);
transform: translateX(-165px);
}
.content {
display: flex;
Expand Down
8 changes: 5 additions & 3 deletions frontend/css/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ a {
.sensor-selection,
.sensor-history-time-selection,
.sensor-history-location-selection {
margin-bottom: 1rem;
margin-bottom: 1rem !important;
}
.row {
margin-bottom: 0 !important;
Expand All @@ -775,7 +775,9 @@ a {
.add-sensor-reading-menu {
width: 300px;
.green {
margin-bottom: 1rem;
position: absolute;
bottom: 1rem;
right: 1rem;
}
.reading-location,
.add-reading-value-form {
Expand Down Expand Up @@ -1782,7 +1784,7 @@ ul {
width: 2rem;
height: 2rem;
text-align: center;
line-height: 1.7rem;
line-height: 1.3rem;
margin-left: 5px;
}
.markdown {
Expand Down
2 changes: 1 addition & 1 deletion frontend/devices/__tests__/actions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { buildResourceIndex } from "../../__test_support__/resource_index_builde
import axios from "axios";
import { success, error, warning, info } from "../../toast/toast";
import { edit, save } from "../../api/crud";
import { DeepPartial } from "redux";
import { DeepPartial } from "../../redux/interfaces";
import { Farmbot } from "farmbot";
import { goToFbosSettings } from "../../settings/maybe_highlight";

Expand Down
2 changes: 1 addition & 1 deletion frontend/farm_designer/__tests__/index_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe("<FarmDesigner />", () => {

it("renders saved garden indicator", () => {
const p = fakeProps();
p.designer.openedSavedGarden = "SavedGardenUuid";
p.designer.openedSavedGarden = 1;
const wrapper = mount(<FarmDesigner {...p} />);
expect(wrapper.text().toLowerCase()).toContain("viewing saved garden");
});
Expand Down
6 changes: 3 additions & 3 deletions frontend/farm_designer/__tests__/reducer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ describe("designer reducer", () => {
});

it("sets opened saved garden", () => {
const payload = "savedGardenUuid";
const action: ReduxAction<string | undefined> = {
const payload = 1;
const action: ReduxAction<number | undefined> = {
type: Actions.CHOOSE_SAVED_GARDEN,
payload
payload,
};
const newState = designer(oldState(), action);
expect(newState.openedSavedGarden).toEqual(payload);
Expand Down
4 changes: 2 additions & 2 deletions frontend/farm_designer/__tests__/state_to_props_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ describe("getPlants()", () => {

it("returns plant templates", () => {
const resources = fakeResources();
const savedGardenUuid = Object.keys(resources.index.byKind["SavedGarden"])[0];
resources.consumers.farm_designer.openedSavedGarden = savedGardenUuid;
const savedGardenId = 1;
resources.consumers.farm_designer.openedSavedGarden = savedGardenId;
expect(getPlants(resources).length).toEqual(1);
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/farm_designer/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export interface DesignerState {
chosenLocation: BotPosition;
drawnPoint: DrawnPointPayl | undefined;
drawnWeed: DrawnWeedPayl | undefined;
openedSavedGarden: string | undefined;
openedSavedGarden: number | undefined;
tryGroupSortType: ExtendedPointGroupSortType | undefined;
editGroupAreaInMap: boolean;
visualizedSequence: UUID | undefined;
Expand Down Expand Up @@ -311,7 +311,7 @@ export type PlantOptions = Partial<PlantPointer>;
export interface EditPlantInfoProps {
dispatch: Function;
findPlant(stringyID: string | undefined): TaggedPlant | undefined;
openedSavedGarden: string | undefined;
openedSavedGarden: number | undefined;
timeSettings: TimeSettings;
getConfigValue: GetWebAppConfigValue;
soilHeightPoints: TaggedGenericPointer[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("newPlantKindAndBody()", () => {
y: 0,
slug: "mint",
cropName: "Mint",
openedSavedGarden: "SavedGarden.1.1",
openedSavedGarden: 1,
depth: 0,
designer: fakeDesignerState(),
};
Expand Down
11 changes: 4 additions & 7 deletions frontend/farm_designer/map/layers/plants/plant_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import {
AxisNumberProperty, TaggedPlant, MapTransformProps,
} from "../../interfaces";
import { Plant, DEFAULT_PLANT_RADIUS } from "../../../plant";
import { unpackUUID } from "../../../../util";
import { isNumber, isString } from "lodash";
import { isNumber } from "lodash";
import {
DesignerState, GardenMapState, MovePointsProps,
} from "../../../interfaces";
Expand All @@ -25,7 +24,7 @@ export interface NewPlantKindAndBodyProps {
y: number;
slug: string;
cropName: string;
openedSavedGarden: string | undefined;
openedSavedGarden: number | undefined;
depth: number;
designer: DesignerState;
}
Expand All @@ -35,9 +34,7 @@ export const newPlantKindAndBody = (props: NewPlantKindAndBodyProps): {
kind: TaggedPlant["kind"],
body: TaggedPlant["body"],
} => {
const savedGardenId = isString(props.openedSavedGarden)
? unpackUUID(props.openedSavedGarden).remoteId
: undefined;
const savedGardenId = props.openedSavedGarden || undefined;
return isNumber(savedGardenId)
? {
kind: "PlantTemplate",
Expand Down Expand Up @@ -75,7 +72,7 @@ export interface CreatePlantProps {
gardenCoords: AxisNumberProperty;
gridSize: AxisNumberProperty | undefined;
dispatch: Function;
openedSavedGarden: string | undefined;
openedSavedGarden: number | undefined;
depth: number;
designer: DesignerState;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/farm_designer/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const designer = generateReducer<DesignerState>(initialState)
push(Path.location({ x: payload.x, y: payload.y }));
return s;
})
.add<string | undefined>(Actions.CHOOSE_SAVED_GARDEN, (s, { payload }) => {
.add<number | undefined>(Actions.CHOOSE_SAVED_GARDEN, (s, { payload }) => {
s.openedSavedGarden = payload;
return s;
})
Expand Down
8 changes: 4 additions & 4 deletions frontend/farm_designer/state_to_props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import {
selectAllFarmwareEnvs,
selectAllCurves,
} from "../resources/selectors";
import { validFwConfig, unpackUUID, validFbosConfig } from "../util";
import { validFwConfig, validFbosConfig } from "../util";
import { validBotLocationData } from "../util/location";
import { getWebAppConfigValue } from "../config_storage/actions";
import { FarmDesignerProps, CameraCalibrationData } from "./interfaces";
import { TaggedPlant, BotSize } from "./map/interfaces";
import { RestResources } from "../resources/interfaces";
import { isString, uniq, chain } from "lodash";
import { isFinite, uniq, chain } from "lodash";
import { BooleanSetting } from "../session_keys";
import { getEnv } from "../farmware/state_to_props";
import { getFirmwareConfig, getFbosConfig } from "../resources/getters";
Expand All @@ -50,9 +50,9 @@ export const getPlants = (resources: RestResources) => {
const onlyPlants = selectAllPlantPointers(resources.index);
const plantTemplates = selectAllPlantTemplates(resources.index);
const { openedSavedGarden } = resources.consumers.farm_designer;
return isString(openedSavedGarden)
return isFinite(openedSavedGarden)
? plantTemplates.filter(x =>
x.body.saved_garden_id === unpackUUID(openedSavedGarden).remoteId)
x.body.saved_garden_id === openedSavedGarden)
: onlyPlants;
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/folders/__tests__/actions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
sequenceEditMaybeSave,
} from "../actions";
import { store } from "../../redux/store";
import { DeepPartial } from "redux";
import { DeepPartial } from "../../redux/interfaces";
import { Everything } from "../../interfaces";
import { buildResourceIndex } from "../../__test_support__/resource_index_builder";
import { newTaggedResource } from "../../sync/actions";
Expand Down
2 changes: 1 addition & 1 deletion frontend/folders/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Color, SpecialStatus, TaggedSequence } from "farmbot";
import { store } from "../redux/store";
import { initSave, destroy, edit, save, init } from "../api/crud";
import { Folder } from "farmbot/dist/resources/api_resources";
import { DeepPartial } from "redux";
import { DeepPartial } from "../redux/interfaces";
import { findFolderById } from "../resources/selectors_by_id";
import { Actions } from "../constants";
import { t } from "../i18next_wrapper";
Expand Down
2 changes: 1 addition & 1 deletion frontend/plants/__tests__/map_state_to_props_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("mapStateToProps()", () => {
template.body.id = 10;
state.resources = buildResourceIndex([template]);
const uuid = Object.keys(state.resources.index.all)[0];
state.resources.consumers.farm_designer.openedSavedGarden = "uuid";
state.resources.consumers.farm_designer.openedSavedGarden = 1;
const result = mapStateToProps(state);
expect(result.findPlant("10")).toEqual(
expect.objectContaining({ uuid }));
Expand Down
2 changes: 1 addition & 1 deletion frontend/plants/__tests__/plant_info_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("<PlantInfo />", () => {
it("gets template id", () => {
mockPath = Path.mock(Path.plantTemplates(2));
const p = fakeProps();
p.openedSavedGarden = "uuid";
p.openedSavedGarden = 1;
const wrapper = mount<PlantInfo>(<PlantInfo {...p} />);
expect(wrapper.instance().stringyID).toEqual("2");
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/plants/__tests__/plant_inventory_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("<PlantInventory />", () => {
window.confirm = () => true;
const p = fakeProps();
p.plantsPanelState.plants = true;
p.openedSavedGarden = "fake";
p.openedSavedGarden = 1;
const wrapper = mount(<Plants {...p} />);
const plantsSection = wrapper.find(PanelSection).at(2);
expect(plantsSection.text().toLowerCase()).not.toContain("delete all");
Expand Down
4 changes: 2 additions & 2 deletions frontend/plants/__tests__/select_plants_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("<SelectPlants />", () => {
getConfigValue: () => true,
plants: [plant1, plant2],
dispatch: jest.fn(x => x),
gardenOpen: undefined,
gardenOpenId: undefined,
allPoints: [],
toolTransformProps: fakeToolTransformProps(),
isActive: () => false,
Expand Down Expand Up @@ -377,7 +377,7 @@ describe("<SelectPlants />", () => {

it("doesn't create group", () => {
const p = fakeProps();
p.gardenOpen = "uuid";
p.gardenOpenId = 1;
const wrapper = mount(<SelectPlants {...p} />);
wrapper.find(".dark-blue").simulate("click");
expect(createGroup).not.toHaveBeenCalled();
Expand Down
Loading

0 comments on commit 2e94865

Please sign in to comment.