Merge branch 'master' of https://git.heroku.com/farmbot-staging into staging

hmm
Rick Carlino 2020-03-17 14:44:54 -05:00
commit be38ad830a
4 changed files with 140 additions and 115 deletions

View File

@ -251,7 +251,9 @@ module CeleryScriptSettingsBag
# outside of the API. If `package` _was_ declared as a native enum (rather # outside of the API. If `package` _was_ declared as a native enum (rather
# than a string), it would cause false type errors in FE/FBJS. # than a string), it would cause false type errors in FE/FBJS.
blk: ->(node) do blk: ->(node) do
unless node.parent.kind.to_s == "flash_firmware"
manual_enum(ALLOWED_PACKAGES, node, BAD_PACKAGE) manual_enum(ALLOWED_PACKAGES, node, BAD_PACKAGE)
end
end, end,
}, },
axis: { axis: {
@ -529,7 +531,7 @@ module CeleryScriptSettingsBag
resource_id = n.args.fetch(:point_group_id).value resource_id = n.args.fetch(:point_group_id).value
check_resource_type(n, "PointGroup", resource_id, Device.current) check_resource_type(n, "PointGroup", resource_id, Device.current)
end, end,
} },
}.map { |(name, list)| Corpus.node(name, **list) } }.map { |(name, list)| Corpus.node(name, **list) }
HASH = Corpus.as_json HASH = Corpus.as_json

View File

@ -95,6 +95,11 @@ export function StepButtonCluster(props: StepButtonProps) {
color="brown"> color="brown">
{t("REBOOT")} {t("REBOOT")}
</StepButton>, </StepButton>,
<StepButton {...commonStepProps}
step={{ kind: "flash_firmware", args: { package: "arduino_firmware" } }}
color="brown">
{t("REFLASH FIRMWARE")}
</StepButton>,
<StepButton {...commonStepProps} <StepButton {...commonStepProps}
step={{ kind: "emergency_lock", args: {} }} step={{ kind: "emergency_lock", args: {} }}
color="red"> color="red">

View File

@ -5,11 +5,6 @@ import { StepWrapper, StepHeader, StepContent } from "../step_ui/index";
import { t } from "../../i18next_wrapper"; import { t } from "../../i18next_wrapper";
import { ALLOWED_PACKAGES, SequenceBodyItem, Reboot } from "farmbot"; import { ALLOWED_PACKAGES, SequenceBodyItem, Reboot } from "farmbot";
import { editStep } from "../../api/crud"; import { editStep } from "../../api/crud";
// import { StepRadio } from "../step_ui/step_radio";
// const PACKAGE_CHOICES = (): Record<ALLOWED_PACKAGES, string> => ({
// "arduino_firmware": t("Just the Arduino"),
// "farmbot_os": t("Entire system")
// });
function assertReboot(x: SequenceBodyItem): asserts x is Reboot { function assertReboot(x: SequenceBodyItem): asserts x is Reboot {
if (x.kind !== "reboot") { if (x.kind !== "reboot") {

View File

@ -257,4 +257,27 @@ describe CeleryScript::Corpus do
expect(check.error.message).to eq("Can't find PointGroup with id of -1") expect(check.error.message).to eq("Can't find PointGroup with id of -1")
end end
end end
it "validates the `package` for flash_firmware" do
ok1 = CeleryScript::AstNode.new(**{
args: {
version: 20180209,
locals: {
kind: "scope_declaration",
args: {},
},
},
kind: "sequence",
body: [
{
kind: "flash_firmware",
args: {
package: "arduino_firmware",
},
},
],
})
check1 = CeleryScript::Checker.new(ok1, corpus, device)
expect(check1.valid?).to be_truthy
end
end end