Issue FarmBot#1379 Updates to Execute sequence step.
parent
427cbab172
commit
cfc7baf587
|
@ -25,7 +25,7 @@ describe("<SequenceSelectBox />", () => {
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
const wrapper = mount(<SequenceSelectBox {...fakeProps()} />);
|
const wrapper = mount(<SequenceSelectBox {...fakeProps()} />);
|
||||||
expect(wrapper.text()).toEqual("None");
|
expect(wrapper.text()).toEqual("Select a sequence");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns list: none selected", () => {
|
it("returns list: none selected", () => {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { isNumber } from "lodash";
|
||||||
import { ResourceIndex } from "../resources/interfaces";
|
import { ResourceIndex } from "../resources/interfaces";
|
||||||
import { selectAllSequences, findSequenceById } from "../resources/selectors";
|
import { selectAllSequences, findSequenceById } from "../resources/selectors";
|
||||||
import { FBSelect, DropDownItem } from "../ui/index";
|
import { FBSelect, DropDownItem } from "../ui/index";
|
||||||
|
import { t } from "../i18next_wrapper";
|
||||||
|
|
||||||
export interface SequenceSelectBoxProps {
|
export interface SequenceSelectBoxProps {
|
||||||
onChange(selection: DropDownItem): void;
|
onChange(selection: DropDownItem): void;
|
||||||
|
@ -40,5 +41,6 @@ export function SequenceSelectBox(props: SequenceSelectBoxProps) {
|
||||||
return <FBSelect
|
return <FBSelect
|
||||||
onChange={props.onChange}
|
onChange={props.onChange}
|
||||||
selectedItem={selectedSequence()}
|
selectedItem={selectedSequence()}
|
||||||
list={sequenceDropDownList()} />;
|
list={sequenceDropDownList()}
|
||||||
|
customNullLabel={t("Select a sequence")} />;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ describe("renderCeleryNode()", () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
node: { kind: "execute", args: { sequence_id: 0 } } as Execute,
|
node: { kind: "execute", args: { sequence_id: 0 } } as Execute,
|
||||||
expected: "Sequence"
|
expected: "Select a sequence"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
node: {
|
node: {
|
||||||
|
|
|
@ -43,12 +43,9 @@ describe("<ExecuteBlock/>", () => {
|
||||||
it("renders inputs", () => {
|
it("renders inputs", () => {
|
||||||
const block = mount(<ExecuteBlock {...fakeProps()} />);
|
const block = mount(<ExecuteBlock {...fakeProps()} />);
|
||||||
const inputs = block.find("input");
|
const inputs = block.find("input");
|
||||||
const labels = block.find("label");
|
|
||||||
expect(inputs.length).toEqual(1);
|
expect(inputs.length).toEqual(1);
|
||||||
expect(labels.length).toEqual(1);
|
|
||||||
expect(inputs.first().props().placeholder).toEqual("Execute Sequence");
|
expect(inputs.first().props().placeholder).toEqual("Execute Sequence");
|
||||||
expect(labels.at(0).text()).toEqual("Sequence");
|
expect(block.text()).toContain("Select a sequence");
|
||||||
expect(block.text()).toContain("None");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders inputs when sequence has a variable", () => {
|
it("renders inputs when sequence has a variable", () => {
|
||||||
|
@ -56,12 +53,9 @@ describe("<ExecuteBlock/>", () => {
|
||||||
p.shouldDisplay = () => true;
|
p.shouldDisplay = () => true;
|
||||||
const block = mount(<ExecuteBlock {...p} />);
|
const block = mount(<ExecuteBlock {...p} />);
|
||||||
const inputs = block.find("input");
|
const inputs = block.find("input");
|
||||||
const labels = block.find("label");
|
|
||||||
expect(inputs.length).toEqual(1);
|
expect(inputs.length).toEqual(1);
|
||||||
expect(labels.length).toEqual(1);
|
|
||||||
expect(inputs.first().props().placeholder).toEqual("Execute Sequence");
|
expect(inputs.first().props().placeholder).toEqual("Execute Sequence");
|
||||||
expect(labels.at(0).text()).toEqual("Sequence");
|
expect(block.text()).toContain("Select a sequence");
|
||||||
expect(block.text()).toContain("None");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import {
|
||||||
} from "../locals_list/variable_support";
|
} from "../locals_list/variable_support";
|
||||||
import { AllowedVariableNodes } from "../locals_list/locals_list_support";
|
import { AllowedVariableNodes } from "../locals_list/locals_list_support";
|
||||||
import { isNumber } from "lodash";
|
import { isNumber } from "lodash";
|
||||||
import { t } from "../../i18next_wrapper";
|
|
||||||
|
|
||||||
/** Replaces the execute step body with a new array of variables. */
|
/** Replaces the execute step body with a new array of variables. */
|
||||||
const assignVariable = (props: ExecBlockParams) =>
|
const assignVariable = (props: ExecBlockParams) =>
|
||||||
|
@ -102,8 +101,7 @@ export class RefactoredExecuteBlock
|
||||||
confirmStepDeletion={this.props.confirmStepDeletion} />
|
confirmStepDeletion={this.props.confirmStepDeletion} />
|
||||||
<StepContent className={className}>
|
<StepContent className={className}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs={12}>
|
<Col xs={6}>
|
||||||
<label>{t("Sequence")}</label>
|
|
||||||
<SequenceSelectBox
|
<SequenceSelectBox
|
||||||
onChange={this.changeSelection}
|
onChange={this.changeSelection}
|
||||||
resources={resources}
|
resources={resources}
|
||||||
|
@ -112,7 +110,7 @@ export class RefactoredExecuteBlock
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
{!!calledSequenceVariableData &&
|
{!!calledSequenceVariableData &&
|
||||||
<Col xs={12}>
|
<Col xs={6}>
|
||||||
<LocalsList
|
<LocalsList
|
||||||
bodyVariables={currentStep.body}
|
bodyVariables={currentStep.body}
|
||||||
variableData={calledSequenceVariableData}
|
variableData={calledSequenceVariableData}
|
||||||
|
|
Loading…
Reference in New Issue