Fix seeds.rb, upgrade fbjs, (almost) working dropdown

pull/719/head
Rick Carlino 2018-03-14 15:14:59 -05:00
parent fa92fe0e14
commit 2c54043cc2
5 changed files with 21 additions and 11 deletions

View File

@ -1,4 +1,7 @@
unless Rails.env == "production"
PinBinding.destroy_all
User.destroy_all
Device.destroy_all
ToolSlot.destroy_all
Tool.destroy_all
Point.destroy_all

View File

@ -53,7 +53,7 @@
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.1.0",
"extract-text-webpack-plugin": "^3.0.1",
"farmbot": "5.4.0-rc10",
"farmbot": "5.4.0-rc11",
"farmbot-toastr": "^1.0.3",
"fastclick": "^1.0.6",
"file-loader": "^1.1.5",

View File

@ -20,7 +20,8 @@ import { ShouldDisplay, Feature } from "../../devices/interfaces";
export enum PinGroupName {
Sensor = "Sensor",
Peripheral = "Peripheral",
Pin = "Pin"
Pin = "Pin",
Position = "Position"
}
export const PERIPHERAL_HEADING: DropDownItem =

View File

@ -1,7 +1,7 @@
import { TaggedSequence } from "../../../resources/tagged_resources";
import { If } from "farmbot";
import { ResourceIndex } from "../../../resources/interfaces";
import { defensiveClone, fancyDebug } from "../../../util";
import { defensiveClone, fancyDebug, bail } from "../../../util";
import { DropDownItem } from "../../../ui";
import { overwrite } from "../../../api/crud";
import { isString } from "lodash";
@ -17,7 +17,7 @@ interface LhsUpdateProps {
export const updateLhs =
(props: LhsUpdateProps) => {
const { currentStep, currentSequence, dispatch, index } = props;
const { currentStep, currentSequence, dispatch, index, resources } = props;
return (e: DropDownItem) => {
fancyDebug(e);
const stepCopy = defensiveClone(currentStep);
@ -27,14 +27,20 @@ export const updateLhs =
if (isString(val)) {
switch (e.headingId) {
case PinGroupName.Peripheral:
throw new Error("Implement peripherals");
case PinGroupName.Sensor:
throw new Error("Implement sensors");
case PinGroupName.Pin:
const resource = resources.references[e.value];
if (!resource) { return bail("NO"); }
stepCopy.args.lhs = {
kind: "named_pin",
args: { pin_type: resource.kind, pin_id: resource.body.id || 0 }
};
break;
case PinGroupName.Position: // "x", "y", "z"
case PinGroupName.Pin: // "pin0", "pin2"
stepCopy.args.lhs = val;
break;
default:
throw new Error("Unhandled heading ID: " + e.headingId);
throw new Error(`Unhandled LHS item: ${e.headingId} ${e.value}`);
}
}
seqCopy.body[index] = stepCopy;

View File

@ -2258,9 +2258,9 @@ farmbot-toastr@^1.0.0, farmbot-toastr@^1.0.3:
farmbot-toastr "^1.0.0"
typescript "^2.3.4"
farmbot@5.4.0-rc10:
version "5.4.0-rc10"
resolved "https://registry.yarnpkg.com/farmbot/-/farmbot-5.4.0-rc10.tgz#16677e408cd093953922996db63e8d6b09b15313"
farmbot@5.4.0-rc11:
version "5.4.0-rc11"
resolved "https://registry.yarnpkg.com/farmbot/-/farmbot-5.4.0-rc11.tgz#3214d390bca9db361f5d4c672f49873caa2d512d"
dependencies:
mqtt "2.15.0"
typescript "^2.4.2"