Skip to content

Commit

Permalink
Merge pull request #2456 from FarmBot/staging
Browse files Browse the repository at this point in the history
v15.9.1
  • Loading branch information
gabrielburnworth authored Jan 27, 2024
2 parents d98f412 + ef69bb7 commit a2422ea
Show file tree
Hide file tree
Showing 31 changed files with 219 additions and 145 deletions.
44 changes: 21 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GEM
activesupport
climate_control (1.2.0)
coderay (1.1.3)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
crack (0.4.5)
rexml
crass (1.0.6)
Expand Down Expand Up @@ -114,12 +114,12 @@ GEM
docile (1.4.0)
e2mmap (0.1.0)
erubi (1.12.0)
factory_bot (6.4.4)
factory_bot (6.4.5)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.2)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.2.2)
faker (3.2.3)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -148,34 +148,33 @@ GEM
faraday (~> 1.0)
globalid (1.2.1)
activesupport (>= 6.1)
google-apis-core (0.11.2)
google-apis-core (0.12.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.29.0)
google-apis-core (>= 0.11.0, < 2.a)
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-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.0)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
google-cloud-storage (1.48.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.29.0)
google-apis-iamcredentials_v1 (~> 0.18)
google-apis-storage_v1 (~> 0.33)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
googleauth (~> 1.9)
mini_mime (~> 1.0)
googleauth (1.9.1)
googleauth (1.9.2)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
Expand Down Expand Up @@ -217,26 +216,26 @@ GEM
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.5)
minitest (5.20.0)
minitest (5.21.2)
multi_json (1.15.0)
multipart-post (2.3.0)
mutations (0.9.1)
activesupport
net-imap (0.4.9)
net-imap (0.4.9.1)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.0-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
os (1.1.4)
passenger (6.0.19)
passenger (6.0.20)
rack
rake (>= 0.8.1)
pg (1.5.4)
Expand Down Expand Up @@ -307,7 +306,7 @@ GEM
railties (>= 5.2)
retriable (3.1.2)
rexml (3.2.6)
rollbar (3.4.2)
rollbar (3.5.1)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -320,7 +319,7 @@ GEM
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.1.0)
rspec-rails (6.1.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
Expand Down Expand Up @@ -378,7 +377,6 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FarmBot Web App

[![codebeat badge](https://codebeat.co/badges/7f81859b-67fe-4bdb-b56f-050bfed35e9c)](https://codebeat.co/projects/github-com-farmbot-farmbot-web-app-staging)
[![codecov](https://codecov.io/gh/FarmBot/Farmbot-Web-App/branch/main/graph/badge.svg)](https://codecov.io/gh/FarmBot/Farmbot-Web-App)
[![codecov](https://codecov.io/gh/FarmBot/Farmbot-Web-App/branch/staging/graph/badge.svg)](https://codecov.io/gh/FarmBot/Farmbot-Web-App)
[![Coverage Status](https://coveralls.io/repos/github/FarmBot/Farmbot-Web-App/badge.svg)](https://coveralls.io/github/FarmBot/Farmbot-Web-App)
[![Maintainability](https://api.codeclimate.com/v1/badges/74091163d8a02bb8988f/maintainability)](https://codeclimate.com/github/FarmBot/Farmbot-Web-App/maintainability)

Expand Down
3 changes: 2 additions & 1 deletion app/models/transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# change protocols
class Transport
OPTS = { read_timeout: 10, heartbeat: 10, log_level: "warn" }
CLOUDAMQP_ENV_KEY = ENV.fetch("WHERE_IS_CLOUDAMQP_URL", "CLOUDAMQP_URL")

def self.amqp_url
@amqp_url ||= ENV["CLOUDAMQP_URL"] ||
@amqp_url ||= ENV[CLOUDAMQP_ENV_KEY] ||
ENV["RABBITMQ_URL"] ||
"amqp://admin:#{ENV.fetch("ADMIN_PASSWORD")}@mqtt:5672"
end
Expand Down
2 changes: 1 addition & 1 deletion app/mutations/sequences/publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Publish < Mutations::Command
NOT_YOURS = "Can't publish sequences you didn't create."
OK_KINDS = %w( axis axis_addition axis_overwrite calibrate channel
channel_name coordinate emergency_lock execute execute_script
find_home identifier is_outdated label location_placeholder
find_home identifier is_outdated label location_placeholder lua
message message_type milliseconds move move_absolute
move_relative nothing number number_placeholder numeric
op package pair parameter_application parameter_declaration
Expand Down
11 changes: 11 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@ GCS_BUCKET=GOOGLE_CLOUD_STORAGE_BUCKET_NAME_FOR_IMAGE_FILES
GCS_ID=GOOGLE_CLOUD_STORAGE='interop' id
# Most self hosting users will want to delete this.
GCS_KEY=GOOGLE_CLOUD_STORAGE='interop' key
GCS_PROJECT=
GOOGLE_CLOUD_KEYFILE_JSON=
# Can be deleted unless you are a Rollbar customer.
ROLLBAR_ACCESS_TOKEN=____
ROLLBAR_CLIENT_TOKEN=____
ROLLBAR_ENV=
# Can be deleted unless you are using codecov.
CODECOV_TOKEN=
# This can be set to anything.
# Most users can just delete it.
# This is used for people writing modifications to the software, mostly.
Expand Down Expand Up @@ -128,6 +133,10 @@ EXTRA_DOMAINS=staging.farm.bot,whatever.farm.bot
# Include the protocol! (http vs. https)
# DELETE THIS LINE if you are a self-hosted user.
RABBIT_MGMT_URL=http://delete_this_line.com
# defaults to `CLOUDAMQP_URL`
WHERE_IS_CLOUDAMQP_URL=
CLOUDAMQP_URL=
RABBITMQ_URL=
# Allow only certain users on the server. If the user's email domain is not
# on the list of trusted domains, they can not use the server.
# The example below only allows users with `@farmbot.io` or `@farm.bot` emails
Expand Down Expand Up @@ -156,6 +165,8 @@ FEEDBACK_WEBHOOK_URL=http://localhost:3000/change_this
# Email address of a "publisher account" that is used to
# publish shared sequences via `rake sequences:publish <id>`
AUTHORIZED_PUBLISHER=[email protected]
# URL to send release info to.
RELEASE_WEBHOOK_URL=
# OpenAI API key. Delete this line if you don't have one.
OPENAI_API_KEY=
# OpenAI API sampling temperature. Optional. Float between 0 and 2.
Expand Down
5 changes: 1 addition & 4 deletions frontend/__test_support__/fake_state/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ import {
} from "farmbot/dist/resources/api_resources";
import { MessageType } from "../../sequences/interfaces";
import { TaggedPointGroup } from "../../resources/interfaces";
import {
BooleanConfigKey as BooleanWebAppConfigKey,
} from "farmbot/dist/resources/configs/web_app";

export const resources: Everything["resources"] = buildResourceIndex();
let idCounter = 1;
Expand Down Expand Up @@ -336,7 +333,7 @@ export function fakeWebAppConfig(): TaggedWebAppConfig {
display_map_missed_steps: false,
display_trail: false,
dynamic_map: false,
["enable_3d_electronics_box_top" as BooleanWebAppConfigKey]: true,
enable_3d_electronics_box_top: true,
encoder_figure: false,
go_button_axes: "XY",
hide_webcam_widget: false,
Expand Down
5 changes: 4 additions & 1 deletion frontend/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,9 @@ export namespace Content {
FarmBot and make changes. If the original author of the sequence
publishes a new version, you will have the option to upgrade your copy.`);

export const INCLUDES_LUA_WARNING =
trim(`This sequence includes Lua code. Review carefully before executing.`);

export const IMPORTED_SEQUENCE =
trim(`This sequence was imported from a publicly shared sequence. If
the original author publishes a new version, you may upgrade your copy.
Expand Down Expand Up @@ -1475,7 +1478,7 @@ export namespace TourContent {
lot of plants at once? Go to the next step of the tour!`);

export const GRID_AND_ROW_PLANTING =
trim(`To add a grid or row of plants, scroll to the bottom of the panel,
trim(`To add a grid or row of plants, press the + GRID button,
enter values into the grid and row planting fields and click PREVIEW.
The previewed plants will show in the map in grayscale. Make adjustments
as necessary and when you are happy with the preview, click SAVE.
Expand Down
7 changes: 7 additions & 0 deletions frontend/css/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,9 @@ hr {
box-shadow: 0 0 10px $translucent5, 0 0 5px inset rgba(255, 255, 255, 0.2) !important;
}
}
&.hard {
border-radius: 5px;
}
}

a {
Expand Down Expand Up @@ -2024,9 +2027,13 @@ ul {
font-weight: 700;
line-height: 1;
text-align: center;
user-select: none;
&.hovered {
background: $black;
}
&.unbound {
background: $placeholder_gray;
}
}
.led-label {
max-width: 7rem;
Expand Down
3 changes: 3 additions & 0 deletions frontend/css/sequences.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,9 @@
display: inline-block;
margin-left: 1rem;
}
p {
margin-left: 1rem;
}
}

.import-banner {
Expand Down
4 changes: 4 additions & 0 deletions frontend/css/static_pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
text-shadow: 0 0 25px rgba(0, 0, 0, 0.1), 0 0 25px rgba(0, 0, 0, 0.1);
}
h1 {
font-family: "Inknut Antiqua" !important;
font-weight: bold !important;
font-size: 3.4rem;
line-height: 3.6rem;
}
Expand All @@ -25,6 +27,8 @@
}
input {
margin-bottom: 1rem;
font-family: revert;
font-size: revert;
}
.all-content-wrapper {
max-width: 50rem;
Expand Down
4 changes: 4 additions & 0 deletions frontend/css/widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
>*:not(h5):not(.title-help-icon):not(.title-help) {
margin-left: 1rem;
}
border-top-left-radius: 5px;
border-top-right-radius: 5px;
.title-help{
display: inline;
.title-help-text {
Expand Down Expand Up @@ -109,6 +111,8 @@
>.row:not(:first-of-type) {
margin-top: 1rem;
}
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}

.widget-footer {
Expand Down
18 changes: 17 additions & 1 deletion frontend/farm_designer/__tests__/panel_header_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { shallow, mount, ReactWrapper } from "enzyme";
import { DesignerNavTabs } from "../panel_header";
import { buildResourceIndex } from "../../__test_support__/resource_index_builder";
import {
fakeFarmwareInstallation,
fakeFarmwareInstallation, fakeWebAppConfig,
} from "../../__test_support__/fake_state/resources";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -64,6 +64,22 @@ describe("<DesignerNavTabs />", () => {
expectActive(wrapper, "zones");
});

it("shows sensors tab", () => {
const config = fakeWebAppConfig();
config.body.hide_sensors = false;
mockState.resources = buildResourceIndex([config]);
const wrapper = mount(<DesignerNavTabs />);
expect(wrapper.html()).toContain("sensors");
});

it("doesn't show sensors tab", () => {
const config = fakeWebAppConfig();
config.body.hide_sensors = true;
mockState.resources = buildResourceIndex([config]);
const wrapper = mount(<DesignerNavTabs />);
expect(wrapper.html()).not.toContain("sensors");
});

it("renders scroll indicator", () => {
Object.defineProperty(document, "getElementsByClassName", {
value: () => [{}, { scrollWidth: 100, scrollLeft: 0, clientWidth: 75 }],
Expand Down
6 changes: 4 additions & 2 deletions frontend/farm_designer/move_to.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export const chooseLocation = (props: {
}) => {
if (props.gardenCoords) {
props.dispatch(chooseLocationAction({
x: props.gardenCoords.x, y: props.gardenCoords.y, z: 0
x: Math.max(0, props.gardenCoords.x),
y: Math.max(0, props.gardenCoords.y),
z: 0,
}));
}
};
Expand All @@ -156,7 +158,7 @@ interface GoToThisLocationButtonState {

export class GoToThisLocationButton
extends React.Component<GoToThisLocationButtonProps,
GoToThisLocationButtonState> {
GoToThisLocationButtonState> {
state: GoToThisLocationButtonState = { open: false, setAsDefault: false };

toggle = (key: keyof GoToThisLocationButtonState) => () =>
Expand Down
9 changes: 1 addition & 8 deletions frontend/farm_designer/panel_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import { DevSettings } from "../settings/dev/dev_support";
import { getWebAppConfigValue } from "../config_storage/actions";
import { store } from "../redux/store";
import { BooleanSetting } from "../session_keys";
import {
getFwHardwareValue, hasSensors,
} from "../settings/firmware/firmware_hardware_support";
import { getFbosConfig } from "../resources/getters";
import { computeEditorUrlFromState } from "../nav/compute_editor_url_from_state";
import { compact } from "lodash";
import { selectAllFarmwareInstallations } from "../resources/selectors";
Expand Down Expand Up @@ -218,10 +214,7 @@ const displayScrollIndicator = () => {

export const showSensors = () => {
const getWebAppConfigVal = getWebAppConfigValue(store.getState);
const firmwareHardware = getFwHardwareValue(getFbosConfig(
store.getState().resources.index));
return !getWebAppConfigVal(BooleanSetting.hide_sensors)
&& hasSensors(firmwareHardware);
return !getWebAppConfigVal(BooleanSetting.hide_sensors);
};

export const showFarmware = () => {
Expand Down
5 changes: 3 additions & 2 deletions frontend/front_page/__tests__/front_page_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ describe("<FrontPage />", () => {
expect(location.assign).toHaveBeenCalledWith(DEFAULT_APP_PAGE);
});

it("updates login state", () => {
it("updates state", () => {
const wrapper = mount<FrontPage>(<FrontPage />);
changeBlurableInput(wrapper, "email", 1);
wrapper.setState({ activePanel: "forgotPassword" });
changeBlurableInput(wrapper, "email", 0);
expect(wrapper.state().email).toEqual("email");
});

Expand Down
Loading

0 comments on commit a2422ea

Please sign in to comment.