From 7c90a181dee9ae0b02e22859a7142fd56c901655 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Thu, 26 Sep 2024 15:38:55 -0700 Subject: [PATCH 1/5] add promo loading view --- app/views/dashboard/promo.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/dashboard/promo.html.erb b/app/views/dashboard/promo.html.erb index 5722dd921..1701cf51d 100644 --- a/app/views/dashboard/promo.html.erb +++ b/app/views/dashboard/promo.html.erb @@ -5,5 +5,7 @@ } body { margin: 0; + background-image: url("/placeholder_farmbot.jpg"); } +

Loading...

From 7ca839cb1ed3eeb6fef8cc1c71fc8099afac97e7 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Thu, 26 Sep 2024 15:39:36 -0700 Subject: [PATCH 2/5] show distance indicator labels on all sides --- .../three_d_garden/distance_indicator.tsx | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/frontend/three_d_garden/distance_indicator.tsx b/frontend/three_d_garden/distance_indicator.tsx index 93f2bf728..bcaee4784 100644 --- a/frontend/three_d_garden/distance_indicator.tsx +++ b/frontend/three_d_garden/distance_indicator.tsx @@ -4,6 +4,27 @@ import { ASSETS } from "./constants"; import { Arrow } from "./arrow"; import { Group, MeshPhongMaterial } from "./components"; +enum BoxDimension { + width = 300, + height = 100, + depth = 75, +} + +const depthOffset = BoxDimension.depth / 2 + 0.5; +const heightOffset = BoxDimension.height / 2 + 0.5; + +interface Label { + position: [number, number, number]; + rotation: [number, number, number]; +} + +const LABELS: Label[] = [ + { position: [0, 0, depthOffset], rotation: [0 * Math.PI / 2, 0, 0] }, + { position: [0, -heightOffset, 0], rotation: [1 * Math.PI / 2, 0, 0] }, + { position: [0, 0, -depthOffset], rotation: [2 * Math.PI / 2, 0, 0] }, + { position: [0, heightOffset, 0], rotation: [3 * Math.PI / 2, 0, 0] }, +]; + export interface DistanceIndicatorProps { start: Record<"x" | "y" | "z", number>; end: Record<"x" | "y" | "z", number>; @@ -28,20 +49,22 @@ export const DistanceIndicator = (props: DistanceIndicatorProps) => { - - {distance.toFixed(0)}mm - + {LABELS.map(({ position, rotation }) => + + {distance.toFixed(0)}mm + )} ; }; From 6cc6fdfa8b64bb259a6c9062418b6f114e18c032 Mon Sep 17 00:00:00 2001 From: Rory Aronson Date: Thu, 26 Sep 2024 18:08:09 -0700 Subject: [PATCH 3/5] improve local setup instructions --- example.env | 2 + local_setup_instructions.sh | 80 ++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/example.env b/example.env index f7f1ef46c..a42c94a50 100644 --- a/example.env +++ b/example.env @@ -13,6 +13,7 @@ # If your server is on a domain (eg=my-own-farmbot.com), put it here. # DONT USE `localhost`, `127.0.0.1`, or `0.0.0.0`. # Use a real IP address or domain name. +# For a local install, find your IP with `hostname -I` on Linux or `ipconfig getifaddr en0` on Mac. API_HOST= # 3000 for local development. 443 is using SSL. @@ -51,6 +52,7 @@ NO_EMAILS=TRUE # If you wish to opt out of https, delete this line. # NOTE: By not using SSL, passwords will be transmitted without encryption, # making it very easy for attackers to see them. +# Comment out or delete for local installs. FORCE_SSL=TRUE diff --git a/local_setup_instructions.sh b/local_setup_instructions.sh index a4d2c9380..f523dc8a2 100644 --- a/local_setup_instructions.sh +++ b/local_setup_instructions.sh @@ -1,18 +1,15 @@ -# How to install FarmBot Web API on a local machine +# How to install the FarmBot Web App on a local machine # IMPORTANT NOTE: Resources are limited and FarmBot Inc cannot provide # longterm support to self-hosted users. If you have never administered a -# Ruby on Rails application, we highly advise stopping now. This presents an -# extremely high risk of data loss. Free hosting is provided at +# Ruby on Rails/Javascript application, we highly advise stopping now. This +# presents an extremely high risk of data loss. Free hosting is provided at # https://my.farm.bot and eliminates the risks and troubles of self-hosting. -# -# You are highly encouraged to use the my.farm.bot servers. Self-hosted -# documentation is provided with the assumption that you have experience with -# Ruby/Javascript development. -# -# Self-hosting a FarmBot server is not a simple task. +# Self-hosting a FarmBot server is not a simple task! -# Linux (Debian/Ubuntu): Install docker and docker compose +# Install docker and docker compose +# ================================= +# Linux (Debian/Ubuntu): sudo apt update sudo apt install ca-certificates curl gnupg -y source /etc/os-release @@ -23,37 +20,41 @@ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker. sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y -# Mac: Install docker and docker compose +# Mac: # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install Docker Desktop from https://www.docker.com/products/docker-desktop/ # Open the Docker Desktop app # Install docker-compose brew install docker-compose -# From here on out, all commands are the same for both Linux and Mac, but `sudo` is not required for Mac. + +##################################################################### +# From here on out, all commands are the same for both Linux and Mac, +# but `sudo` is not required for Mac. +##################################################################### # Verify docker installation +# ========================== sudo docker run hello-world sudo docker compose version -# Install FarmBot Web App +# Clone the FarmBot Web App repository +# ==================================== # ⚠ SKIP THIS STEP IF UPGRADING! git clone https://github.com/FarmBot/Farmbot-Web-App --depth=5 --branch=main - +# Change directory to the project cd Farmbot-Web-App -cp example.env .env # ⚠ SKIP THIS STEP IF UPGRADING! - -# == This is a very important step!!! == -# +# Set your ENVs +# ============= +# ⚠ SKIP THIS IF UPGRADING! +cp example.env .env # Open `.env` in a text editor and change all the values. -# -# == Nothing will work if you skip this step!!! == - -nano .env # ⚠ SKIP THIS STEP IF UPGRADING! -# ^ This is the most important step -# READ NOTE ABOVE. Very important! +# ⚠ SKIP THIS STEP IF UPGRADING! +nano .env +# Install project dependencies +# ============================ # Install the correct version of bundler for the project sudo docker compose run web gem install bundler # Install application specific Ruby dependencies @@ -63,32 +64,37 @@ sudo docker compose run web npm install # Create a database in PostgreSQL sudo docker compose run web bundle exec rails db:create db:migrate # Generate a set of *.pem files for data encryption -sudo docker compose run web rake keys:generate # ⚠ SKIP THIS STEP IF UPGRADING! -# Run the server! ٩(^‿^)۶ +# ⚠ SKIP THIS STEP IF UPGRADING! +sudo docker compose run web rake keys:generate + +# Run the server! 🌱 +# ================== # Note: You won't be able to log in until you see a message similar to this: # "✨ Built in 44.92s" # You will just get an empty screen otherwise. # This only happens during initialization and may take a long time on slow machines. sudo docker compose up # If you get an MQTT authentication error, it could be a config file issue. -# Verify that you've used your computer's real IP address (`hostname -I`) +# Verify that you've used your computer's real IP address +# (`hostname -I` on Linux or `ipconfig getifaddr en0` on Mac) # for the values of `API_HOST` and `MQTT_HOST` in the `.env` file, and then: # Stop the server with `Ctrl + C` and sudo docker compose down # Start the server again with sudo docker compose up - # At this point, setup is complete. -# Content should be visible at http://YOUR_HOST:3000/. +# Content should be visible at http://API_HOST:3000/. + +# Verify installation (optional) +# ============================== +# You can optionally verify installation by running unit tests. +# Create the database for the app to use +sudo docker compose run -e RAILS_ENV=test web bundle exec rails db:setup +# Run the tests in the "test" RAILS_ENV +sudo docker compose run -e RAILS_ENV=test web rspec spec +# Run user-interface unit tests (requires a large amount of RAM) +sudo docker compose run web npm run test -# --- You can optionally verify installation by running unit tests. --- - # Create the database for the app to use - sudo docker compose run -e RAILS_ENV=test web bundle exec rails db:setup - # Run the tests in the "test" RAILS_ENV - sudo docker compose run -e RAILS_ENV=test web rspec spec - # Run user-interface unit tests (requires a large amount of RAM) - sudo docker compose run web npm run test -# --- end of optional tests --- # === BEGIN OPTIONAL UPGRADES to later versions of the FarmBot Web App === # Shut down the server From f21dc4d515e09cf72af950223f57709ccc50032a Mon Sep 17 00:00:00 2001 From: Rory Aronson Date: Thu, 26 Sep 2024 18:08:58 -0700 Subject: [PATCH 4/5] make zoom beacons and settings bar hideable --- frontend/css/farm_designer/farm_designer.scss | 1 + frontend/three_d_garden/config.ts | 21 +++++++++++++------ frontend/three_d_garden/config_overlays.tsx | 4 +++- frontend/three_d_garden/garden.tsx | 2 +- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/frontend/css/farm_designer/farm_designer.scss b/frontend/css/farm_designer/farm_designer.scss index 9e994c6be..8b9208389 100644 --- a/frontend/css/farm_designer/farm_designer.scss +++ b/frontend/css/farm_designer/farm_designer.scss @@ -1268,6 +1268,7 @@ padding: 1rem; overflow-x: scroll; background: linear-gradient(0deg, $translucent5, transparent); + scrollbar-width: none; @media screen and (max-width: 768px) { justify-content: left; diff --git a/frontend/three_d_garden/config.ts b/frontend/three_d_garden/config.ts index be985fd7d..9c5cbf73f 100644 --- a/frontend/three_d_garden/config.ts +++ b/frontend/three_d_garden/config.ts @@ -54,6 +54,8 @@ export interface Config { xyDimensions: boolean; zDimension: boolean; promoInfo: boolean; + settingsBar: boolean; + zoomBeacons: boolean; solar: boolean; utilitiesPost: boolean; packaging: boolean; @@ -123,6 +125,8 @@ export const INITIAL: Config = { xyDimensions: false, zDimension: false, promoInfo: true, + settingsBar: true, + zoomBeacons: true, solar: false, utilitiesPost: true, packaging: false, @@ -152,9 +156,9 @@ export const BOOLEAN_KEYS = [ "legsFlush", "labels", "labelsOnHover", "ground", "grid", "axes", "trail", "tracks", "clouds", "perspective", "bot", "laser", "cableCarriers", "viewCube", "stats", "config", "zoom", "pan", "bounds", "threeAxes", - "xyDimensions", "zDimension", "promoInfo", "solar", "utilitiesPost", - "packaging", "lab", "people", "lowDetail", "eventDebug", "cableDebug", - "zoomBeaconDebug", "animate", + "xyDimensions", "zDimension", "promoInfo", "settingsBar", "zoomBeacons", + "solar", "utilitiesPost", "packaging", "lab", "people", "lowDetail", + "eventDebug", "cableDebug", "zoomBeaconDebug", "animate", ]; export const PRESETS: Record = { @@ -259,6 +263,8 @@ export const PRESETS: Record = { xyDimensions: false, zDimension: false, promoInfo: false, + settingsBar: false, + zoomBeacons: false, solar: false, utilitiesPost: false, packaging: false, @@ -308,6 +314,8 @@ export const PRESETS: Record = { xyDimensions: true, zDimension: true, promoInfo: true, + settingsBar: true, + zoomBeacons: true, solar: true, utilitiesPost: true, packaging: true, @@ -335,9 +343,10 @@ const OTHER_CONFIG_KEYS: (keyof Config)[] = [ "bedBrightness", "soilBrightness", "plants", "labels", "ground", "grid", "axes", "trail", "clouds", "sunInclination", "sunAzimuth", "perspective", "bot", "laser", "tool", "cableCarriers", "viewCube", "stats", "config", "zoom", "bounds", - "threeAxes", "xyDimensions", "zDimension", "labelsOnHover", "promoInfo", "pan", - "solar", "utilitiesPost", "packaging", "lab", "people", "scene", "lowDetail", - "eventDebug", "cableDebug", "zoomBeaconDebug", "animate", + "threeAxes", "xyDimensions", "zDimension", "labelsOnHover", "promoInfo", + "settingsBar", "zoomBeacons", "pan", "solar", "utilitiesPost", "packaging", "lab", + "people", "scene", "lowDetail", "eventDebug", "cableDebug", "zoomBeaconDebug", + "animate", ]; export const modifyConfig = (config: Config, update: Partial) => { diff --git a/frontend/three_d_garden/config_overlays.tsx b/frontend/three_d_garden/config_overlays.tsx index 2b63c4799..fc77f64f6 100644 --- a/frontend/three_d_garden/config_overlays.tsx +++ b/frontend/three_d_garden/config_overlays.tsx @@ -64,7 +64,7 @@ export const PublicOverlay = (props: OverlayProps) => { }; return
- {!props.activeFocus && + {config.settingsBar && !props.activeFocus &&
{ onChange={e => setParamAdd(e.target.checked)} />
+ + diff --git a/frontend/three_d_garden/garden.tsx b/frontend/three_d_garden/garden.tsx index 49bde5170..35fc62c08 100644 --- a/frontend/three_d_garden/garden.tsx +++ b/frontend/three_d_garden/garden.tsx @@ -176,7 +176,7 @@ export const GardenModel = (props: GardenModelProps) => { ? e => console.log(e.intersections.map(x => x.object.name)) : undefined}> {config.stats && } - {props.showBeacons && } From 57a71cd549560a8ac38740a0930750f3ea8611c2 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Fri, 27 Sep 2024 09:36:50 -0700 Subject: [PATCH 5/5] use new config flag for beacons --- frontend/farm_designer/three_d_garden_map.tsx | 1 + frontend/promo/promo.tsx | 1 - frontend/three_d_garden/__tests__/garden_test.tsx | 1 - frontend/three_d_garden/garden.tsx | 3 +-- frontend/three_d_garden/index.tsx | 2 +- 5 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/farm_designer/three_d_garden_map.tsx b/frontend/farm_designer/three_d_garden_map.tsx index 10429c388..f254a446b 100644 --- a/frontend/farm_designer/three_d_garden_map.tsx +++ b/frontend/farm_designer/three_d_garden_map.tsx @@ -17,6 +17,7 @@ export const ThreeDGardenMap = (props: ThreeDGardenMapProps) => { config.botSizeY = gridSize.y; config.bedWidthOuter = gridSize.y + 160; config.bedLengthOuter = gridSize.x + 160; + config.zoomBeacons = false; return ; }; diff --git a/frontend/promo/promo.tsx b/frontend/promo/promo.tsx index a214c993c..626a7c198 100644 --- a/frontend/promo/promo.tsx +++ b/frontend/promo/promo.tsx @@ -18,7 +18,6 @@ export const Promo = () => { config, setConfig, toolTip, setToolTip, activeFocus, setActiveFocus, - showBeacons: true, }; React.useEffect(() => { diff --git a/frontend/three_d_garden/__tests__/garden_test.tsx b/frontend/three_d_garden/__tests__/garden_test.tsx index 7b50ce3df..49e108e54 100644 --- a/frontend/three_d_garden/__tests__/garden_test.tsx +++ b/frontend/three_d_garden/__tests__/garden_test.tsx @@ -14,7 +14,6 @@ describe("", () => { config: clone(INITIAL), activeFocus: "", setActiveFocus: jest.fn(), - showBeacons: true, }); it("renders", () => { diff --git a/frontend/three_d_garden/garden.tsx b/frontend/three_d_garden/garden.tsx index 35fc62c08..50448554a 100644 --- a/frontend/three_d_garden/garden.tsx +++ b/frontend/three_d_garden/garden.tsx @@ -29,7 +29,6 @@ export interface GardenModelProps { config: Config; activeFocus: string; setActiveFocus(focus: string): void; - showBeacons: boolean; } interface Plant { @@ -176,7 +175,7 @@ export const GardenModel = (props: GardenModelProps) => { ? e => console.log(e.intersections.map(x => x.object.name)) : undefined}> {config.stats && } - {props.showBeacons && config.zoomBeacons && } diff --git a/frontend/three_d_garden/index.tsx b/frontend/three_d_garden/index.tsx index c810f812b..7cd7f8ec0 100644 --- a/frontend/three_d_garden/index.tsx +++ b/frontend/three_d_garden/index.tsx @@ -12,7 +12,7 @@ export const ThreeDGarden = (props: ThreeDGardenProps) => { return
-