Skip to content

Commit

Permalink
Merge pull request #2461 from FarmBot/staging
Browse files Browse the repository at this point in the history
v15.9.5
  • Loading branch information
gabrielburnworth authored Apr 9, 2024
2 parents cabd84a + 2d54f07 commit 49f8959
Show file tree
Hide file tree
Showing 25 changed files with 106 additions and 119 deletions.
64 changes: 32 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ GEM
ast (2.4.2)
base64 (0.2.0)
bcrypt (3.1.20)
bigdecimal (3.1.6)
bigdecimal (3.1.7)
builder (3.2.4)
bunny (2.22.0)
amq-protocol (~> 2.3, >= 2.3.1)
Expand Down Expand Up @@ -123,7 +123,7 @@ GEM
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.2.3)
faker (3.3.1)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -152,24 +152,24 @@ GEM
faraday (~> 1.0)
globalid (1.2.1)
activesupport (>= 6.1)
google-apis-core (0.13.0)
google-apis-core (0.14.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
google-apis-iamcredentials_v1 (0.18.0)
google-apis-core (>= 0.12.0, < 2.a)
google-apis-storage_v1 (0.33.0)
google-apis-core (>= 0.12.0, < 2.a)
google-cloud-core (1.6.1)
google-apis-iamcredentials_v1 (0.20.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-storage_v1 (0.37.0)
google-apis-core (>= 0.14.0, < 2.a)
google-cloud-core (1.7.0)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-errors (1.4.0)
google-cloud-storage (1.49.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
Expand All @@ -189,10 +189,10 @@ GEM
hashdiff (1.1.0)
hashie (4.1.0)
httpclient (2.8.3)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
jsonapi-renderer (0.2.2)
jwt (2.8.0)
jwt (2.8.1)
base64
kaminari (1.2.2)
activesupport (>= 4.1.0)
Expand All @@ -219,10 +219,10 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.0.4)
method_source (1.0.0)
mini_mime (1.1.5)
minitest (5.22.2)
minitest (5.22.3)
multi_json (1.15.0)
multipart-post (2.4.0)
mutations (0.9.1)
Expand All @@ -234,10 +234,10 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2-x86_64-linux)
nio4r (2.7.1)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
os (1.1.4)
Expand All @@ -247,24 +247,24 @@ GEM
passenger (6.0.20)
rack
rake (>= 0.8.1)
pg (1.5.5)
pg (1.5.6)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (5.0.4)
public_suffix (5.0.5)
rabbitmq_http_api_client (2.2.0)
addressable (~> 2.7)
faraday (~> 1.3)
faraday_middleware (~> 1.2)
hashie (~> 4.1)
multi_json (~> 1.15)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
rack-cors (2.0.1)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-test (2.1.0)
rack (>= 1.3)
Expand Down Expand Up @@ -301,7 +301,7 @@ GEM
method_source
rake (>= 12.2)
thor (~> 1.0)
rake (13.1.0)
rake (13.2.1)
rbtree (0.4.6)
redis (4.8.1)
representable (3.2.0)
Expand All @@ -328,22 +328,22 @@ GEM
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.1)
rspec-rails (6.1.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.13.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
ruby2_keywords (0.0.5)
scenic (1.7.0)
scenic (1.8.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
scout_apm (5.3.7)
scout_apm (5.3.8)
parser
secure_headers (6.5.0)
set (1.1.0)
Expand Down Expand Up @@ -371,7 +371,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
thor (1.3.0)
thor (1.3.1)
thwait (0.2.0)
e2mmap
timeout (0.4.1)
Expand All @@ -384,7 +384,7 @@ GEM
rails
warden (1.2.9)
rack (>= 2.0.9)
webmock (3.22.0)
webmock (3.23.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down Expand Up @@ -443,4 +443,4 @@ RUBY VERSION
ruby 3.1.4p223

BUNDLED WITH
2.5.3
2.5.7
2 changes: 0 additions & 2 deletions app/mutations/devices/seeders/abstract_express.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def sensors_tool_verification; end

def settings_change_firmware_config_defaults
device.firmware_config.update!(encoder_enabled_z: 0,
movement_keep_active_x: 0,
movement_keep_active_y: 0,
movement_max_spd_y: 900,
movement_min_spd_x: 300,
movement_min_spd_y: 300,
Expand Down
4 changes: 1 addition & 3 deletions app/mutations/devices/seeders/abstract_genesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def settings_device_name
end

def settings_change_firmware_config_defaults
device.firmware_config.update!(encoder_enabled_x: 1,
encoder_enabled_y: 1,
encoder_enabled_z: 1)
device.firmware_config.update!(movement_motor_current_x: 1646)
end

def tool_slots_slot_1
Expand Down
3 changes: 0 additions & 3 deletions app/mutations/devices/seeders/genesis_one_seven.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ def settings_firmware
.update!(firmware_hardware: FbosConfig::FARMDUINO_K17)
end

def settings_change_firmware_config_defaults
end

def peripherals_rotary_tool
add_peripheral(2, ToolNames::ROTARY_TOOL)
end
Expand Down
3 changes: 0 additions & 3 deletions app/mutations/devices/seeders/genesis_one_six.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ def settings_firmware
.update!(firmware_hardware: FbosConfig::FARMDUINO_K16)
end

def settings_change_firmware_config_defaults
end

def peripherals_rotary_tool
add_peripheral(2, ToolNames::ROTARY_TOOL)
end
Expand Down
3 changes: 0 additions & 3 deletions app/mutations/devices/seeders/genesis_xl_one_seven.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ def settings_firmware
.update!(firmware_hardware: FbosConfig::FARMDUINO_K17)
end

def settings_change_firmware_config_defaults
end

def settings_device_name
device.update!(name: Names::GENESIS_XL)
end
Expand Down
3 changes: 0 additions & 3 deletions app/mutations/devices/seeders/genesis_xl_one_six.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ def settings_firmware
.update!(firmware_hardware: FbosConfig::FARMDUINO_K16)
end

def settings_change_firmware_config_defaults
end

def settings_device_name
device.update!(name: Names::GENESIS_XL)
end
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20240405171128_change_motor_keep_on_defaults.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class ChangeMotorKeepOnDefaults < ActiveRecord::Migration[6.1]
def change
change_column_default(:firmware_configs, :movement_keep_active_x, from: 1, to: 0)
change_column_default(:firmware_configs, :movement_keep_active_y, from: 1, to: 0)
end
end
7 changes: 4 additions & 3 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ CREATE TABLE public.firmware_configs (
movement_invert_motor_x integer DEFAULT 0,
movement_invert_motor_y integer DEFAULT 0,
movement_invert_motor_z integer DEFAULT 0,
movement_keep_active_x integer DEFAULT 1,
movement_keep_active_y integer DEFAULT 1,
movement_keep_active_x integer DEFAULT 0,
movement_keep_active_y integer DEFAULT 0,
movement_keep_active_z integer DEFAULT 1,
movement_max_spd_x integer DEFAULT 400,
movement_max_spd_y integer DEFAULT 400,
Expand Down Expand Up @@ -3986,6 +3986,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20230808192946'),
('20240118204046'),
('20240202171922'),
('20240207234421');
('20240207234421'),
('20240405171128');


4 changes: 2 additions & 2 deletions frontend/__test_support__/fake_state/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ export function fakeFirmwareConfig(): TaggedFirmwareConfig {
device_id: idCounter++,
created_at: "",
updated_at: "",
encoder_enabled_x: 0,
encoder_enabled_y: 0,
encoder_enabled_x: 1,
encoder_enabled_y: 1,
encoder_enabled_z: 0,
encoder_invert_x: 0,
encoder_invert_y: 0,
Expand Down
3 changes: 3 additions & 0 deletions frontend/__test_support__/resource_index_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const DEFAULT_DEVICE_BODY: TaggedDevice["body"] = {
lng: undefined,
indoor: false,
rpi: "3",
max_log_age_in_days: 0,
max_sequence_count: 0,
max_sequence_length: 0,
};

export function fakeDevice(body: Partial<TaggedDevice["body"]> = {}):
Expand Down
4 changes: 2 additions & 2 deletions frontend/demo/demo_iframe.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClientSubscribeCallback, connect, IConnackPacket } from "mqtt";
import mqtt, { ClientSubscribeCallback, IConnackPacket } from "mqtt";
import React from "react";
import { uuid } from "farmbot";
import axios from "axios";
Expand Down Expand Up @@ -37,7 +37,7 @@ export class DemoIframe extends React.Component<{}, State> {
setError = (error?: Error) => this.setState({ error });

connectMqtt = (): Promise<IConnackPacket> => {
const client = connect(globalConfig.MQTT_WS, WS_CONFIG);
const client = mqtt.connect(globalConfig.MQTT_WS, WS_CONFIG);
return new Promise(resolve => {
client.on("message", this.handleMessage);
client.subscribe(MQTT_CHAN, this.setError as ClientSubscribeCallback);
Expand Down
4 changes: 1 addition & 3 deletions frontend/logs/components/logs_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { semverCompare, SemverResult, formatTime } from "../../util";
import { destroy } from "../../api/crud";
import { Position } from "@blueprintjs/core";
import { LogsFilterMenu } from "./filter_menu";
import { DeviceAccountSettings } from "farmbot/dist/resources/api_resources";

interface LogsRowProps {
tlog: TaggedLog;
Expand Down Expand Up @@ -124,8 +123,7 @@ export const LogsTable = (props: LogsTableProps) => {
</table>
<p className={"notice"}>
{t("Logs older than {{ days }} days are automatically deleted", {
days: props.device.body["max_log_age_in_days" as keyof DeviceAccountSettings
] as number || 60,
days: props.device.body.max_log_age_in_days || 60,
})}
</p>
</div>;
Expand Down
4 changes: 2 additions & 2 deletions frontend/photos/image_workspace/farmbot_picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class FarmbotColorPicker extends React.Component<FarmbotPickerProps, {}>
<div id="hue" style={this.hueCSS()}>
<Hue
{...dontTouchThis}
pointer={this.customPointer as unknown as React.ReactNode}
pointer={this.customPointer}
onChange={noop} />
{getHueBoxes(this.props.h, !!this.props.invertHue)
.map((box, i) => <div key={i} style={box} />)}
Expand All @@ -116,7 +116,7 @@ export class FarmbotColorPicker extends React.Component<FarmbotPickerProps, {}>
<div id="saturation" style={this.saturationCSS()}>
<Saturation
{...dontTouchThis}
pointer={this.customPointer as unknown as React.ReactNode}
pointer={this.customPointer}
onChange={noop} />
<div style={this.saturationboxCSS()} />
</div>
Expand Down
7 changes: 2 additions & 5 deletions frontend/sequences/__tests__/actions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { Path } from "../../internal_urls";
import {
buildResourceIndex, fakeDevice,
} from "../../__test_support__/resource_index_builder";
import { DeviceAccountSettings } from "farmbot/dist/resources/api_resources";

describe("copySequence()", () => {
it("copies sequence", () => {
Expand All @@ -65,8 +64,7 @@ describe("copySequence()", () => {
const state = fakeState();
const sequence = fakeSequence();
const device = fakeDevice();
device.body[
"max_sequence_count" as keyof DeviceAccountSettings] = 1 as never;
device.body.max_sequence_count = 1;
state.resources = buildResourceIndex([sequence, device]);
copySequence(fakeSequence())(jest.fn(), () => state);
expect(push).not.toHaveBeenCalled();
Expand Down Expand Up @@ -145,8 +143,7 @@ describe("pushStep()", () => {
it("exceeds limit", () => {
const sequence = fakeSequence({ body: [{ kind: "sync", args: {} }] });
const device = fakeDevice();
device.body[
"max_sequence_length" as keyof DeviceAccountSettings] = 1 as never;
device.body.max_sequence_length = 1;
mockState.resources = buildResourceIndex([sequence, device]);
pushStep(NEW_STEP, jest.fn(), sequence);
expect(overwrite).not.toHaveBeenCalled();
Expand Down
7 changes: 2 additions & 5 deletions frontend/sequences/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import { GetState } from "../redux/interfaces";
import { selectAllSequences } from "../resources/selectors_by_kind";
import { ResourceIndex } from "../resources/interfaces";
import { getDeviceAccountSettings } from "../resources/selectors";
import { DeviceAccountSettings } from "farmbot/dist/resources/api_resources";
import { store } from "../redux/store";

export const sequenceLengthExceeded = (sequence: TaggedSequence): boolean => {
const device = getDeviceAccountSettings(store.getState().resources.index);
const max = device.body[
"max_sequence_length" as keyof DeviceAccountSettings] as number || 30;
const max = device.body.max_sequence_length || 30;
if ((sequence.body.body || []).length >= max) {
error(t("The maximum number of steps allowed in one sequence is {{ num }}.",
{ num: max }) + " "
Expand Down Expand Up @@ -55,8 +53,7 @@ export function editCurrentSequence(dispatch: Function, seq: TaggedSequence,
export const sequenceLimitExceeded = (ri: ResourceIndex): boolean => {
const sequences = selectAllSequences(ri);
const device = getDeviceAccountSettings(ri);
const max = device.body[
"max_sequence_count" as keyof DeviceAccountSettings] as number || 75;
const max = device.body.max_sequence_count || 75;
if (sequences.length >= max) {
error(t("The maximum number of sequences allowed is {{ num }}.", { num: max }));
return true;
Expand Down
Loading

0 comments on commit 49f8959

Please sign in to comment.