commit
209a88c5e4
|
@ -157,8 +157,8 @@ export function fakeDiagnosticDump(): TaggedDiagnosticDump {
|
||||||
firmware_state: string,
|
firmware_state: string,
|
||||||
network_interface: string,
|
network_interface: string,
|
||||||
fbos_dmesg_dump: string,
|
fbos_dmesg_dump: string,
|
||||||
created_at: string,
|
created_at: "2018-01-11T20:20:38.362Z",
|
||||||
updated_at: string,
|
updated_at: "2018-01-11T20:20:38.362Z",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { onLogs } from "../log_handlers";
|
||||||
|
import { Log } from "farmbot/dist/resources/api_resources";
|
||||||
|
|
||||||
|
describe("onLogs()", () => {
|
||||||
|
it("inits log", () => {
|
||||||
|
const msg = { message: "test log", type: undefined, channels: [] };
|
||||||
|
const log = onLogs(jest.fn(), jest.fn())(msg as unknown as Log);
|
||||||
|
expect(log).toEqual(expect.objectContaining({
|
||||||
|
body: expect.objectContaining({ type: "info" })
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -12,6 +12,7 @@ import { globalQueue } from "./batch_queue";
|
||||||
export const onLogs =
|
export const onLogs =
|
||||||
(_dispatch: Function, getState: GetState) => (msg: Log) => {
|
(_dispatch: Function, getState: GetState) => (msg: Log) => {
|
||||||
if (isLog(msg)) {
|
if (isLog(msg)) {
|
||||||
|
!msg.type && (msg.type = "info");
|
||||||
actOnChannelName(msg, "toast", showLogOnScreen);
|
actOnChannelName(msg, "toast", showLogOnScreen);
|
||||||
actOnChannelName(msg, "espeak", speakLogAloud(getState));
|
actOnChannelName(msg, "espeak", speakLogAloud(getState));
|
||||||
const log = initLog(msg).payload;
|
const log = initLog(msg).payload;
|
||||||
|
|
|
@ -77,16 +77,6 @@ export class FarmbotOsSettings
|
||||||
const { bot, sourceFbosConfig, botToMqttStatus } = this.props;
|
const { bot, sourceFbosConfig, botToMqttStatus } = this.props;
|
||||||
const { sync_status } = bot.hardware.informational_settings;
|
const { sync_status } = bot.hardware.informational_settings;
|
||||||
const botOnline = isBotOnline(sync_status, botToMqttStatus);
|
const botOnline = isBotOnline(sync_status, botToMqttStatus);
|
||||||
const bootRow = <Row>
|
|
||||||
<Col xs={ColWidth.label}>
|
|
||||||
<label>
|
|
||||||
{t("BOOT SEQUENCE")}
|
|
||||||
</label>
|
|
||||||
</Col>
|
|
||||||
<Col xs={7}>
|
|
||||||
<BootSequenceSelector />
|
|
||||||
</Col>
|
|
||||||
</Row>;
|
|
||||||
return <Widget className="device-widget">
|
return <Widget className="device-widget">
|
||||||
<form onSubmit={(e) => e.preventDefault()}>
|
<form onSubmit={(e) => e.preventDefault()}>
|
||||||
<WidgetHeader title="Device">
|
<WidgetHeader title="Device">
|
||||||
|
@ -160,7 +150,8 @@ export class FarmbotOsSettings
|
||||||
shouldDisplay={this.props.shouldDisplay}
|
shouldDisplay={this.props.shouldDisplay}
|
||||||
timeSettings={this.props.timeSettings}
|
timeSettings={this.props.timeSettings}
|
||||||
sourceFbosConfig={sourceFbosConfig} />
|
sourceFbosConfig={sourceFbosConfig} />
|
||||||
{this.props.shouldDisplay(Feature.boot_sequence) && bootRow}
|
{this.props.shouldDisplay(Feature.boot_sequence) &&
|
||||||
|
<BootSequenceSelector />}
|
||||||
<PowerAndReset
|
<PowerAndReset
|
||||||
controlPanelState={this.props.bot.controlPanelState}
|
controlPanelState={this.props.bot.controlPanelState}
|
||||||
dispatch={this.props.dispatch}
|
dispatch={this.props.dispatch}
|
||||||
|
|
|
@ -2,11 +2,13 @@ import * as React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Everything } from "../../../interfaces";
|
import { Everything } from "../../../interfaces";
|
||||||
import { getFbosConfig } from "../../../resources/getters";
|
import { getFbosConfig } from "../../../resources/getters";
|
||||||
import { FBSelect, DropDownItem } from "../../../ui";
|
import { FBSelect, DropDownItem, Row, Col } from "../../../ui";
|
||||||
import { edit, save } from "../../../api/crud";
|
import { edit, save } from "../../../api/crud";
|
||||||
import { TaggedFbosConfig, TaggedSequence } from "farmbot";
|
import { TaggedFbosConfig, TaggedSequence } from "farmbot";
|
||||||
import { selectAllSequences, findSequenceById } from "../../../resources/selectors";
|
import { selectAllSequences, findSequenceById } from "../../../resources/selectors";
|
||||||
import { betterCompact } from "../../../util";
|
import { betterCompact } from "../../../util";
|
||||||
|
import { ColWidth } from "../farmbot_os_settings";
|
||||||
|
import { t } from "../../../i18next_wrapper";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
list: DropDownItem[];
|
list: DropDownItem[];
|
||||||
|
@ -53,13 +55,20 @@ export class RawBootSequenceSelector extends React.Component<Props, {}> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div>
|
return <Row>
|
||||||
|
<Col xs={ColWidth.label}>
|
||||||
|
<label>
|
||||||
|
{t("BOOT SEQUENCE")}
|
||||||
|
</label>
|
||||||
|
</Col>
|
||||||
|
<Col xs={7}>
|
||||||
<FBSelect
|
<FBSelect
|
||||||
allowEmpty={true}
|
allowEmpty={true}
|
||||||
list={this.props.list}
|
list={this.props.list}
|
||||||
selectedItem={this.props.selectedItem}
|
selectedItem={this.props.selectedItem}
|
||||||
onChange={this.onChange} />
|
onChange={this.onChange} />
|
||||||
</div>;
|
</Col>
|
||||||
|
</Row>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,19 +94,22 @@ export function DesignerNavTabs(props: { hidden?: boolean }) {
|
||||||
panel={Panel.Groups}
|
panel={Panel.Groups}
|
||||||
linkTo={"/app/designer/groups"}
|
linkTo={"/app/designer/groups"}
|
||||||
title={t("Groups")} />
|
title={t("Groups")} />
|
||||||
|
{DevSettings.futureFeaturesEnabled() &&
|
||||||
<NavTab
|
<NavTab
|
||||||
panel={Panel.SavedGardens}
|
panel={Panel.SavedGardens}
|
||||||
linkTo={"/app/designer/saved_gardens"}
|
linkTo={"/app/designer/saved_gardens"}
|
||||||
title={t("Gardens")} />
|
title={t("Gardens")} />}
|
||||||
<NavTab
|
<NavTab
|
||||||
panel={Panel.FarmEvents}
|
panel={Panel.FarmEvents}
|
||||||
linkTo={"/app/designer/events"}
|
linkTo={"/app/designer/events"}
|
||||||
title={t("Events")} />
|
title={t("Events")} />
|
||||||
{DevSettings.futureFeaturesEnabled() && <NavTab
|
{DevSettings.futureFeaturesEnabled() &&
|
||||||
|
<NavTab
|
||||||
panel={Panel.Points}
|
panel={Panel.Points}
|
||||||
linkTo={"/app/designer/points"}
|
linkTo={"/app/designer/points"}
|
||||||
title={t("Points")} />}
|
title={t("Points")} />}
|
||||||
{DevSettings.futureFeaturesEnabled() && <NavTab
|
{DevSettings.futureFeaturesEnabled() &&
|
||||||
|
<NavTab
|
||||||
panel={Panel.Tools}
|
panel={Panel.Tools}
|
||||||
linkTo={"/app/designer/tools"}
|
linkTo={"/app/designer/tools"}
|
||||||
title={t("Tools")} />}
|
title={t("Tools")} />}
|
||||||
|
|
|
@ -46,7 +46,7 @@ export class RawEditPoint extends React.Component<EditPointProps, {}> {
|
||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
Object.entries(body.meta).map(([k, v]) => {
|
Object.entries(body.meta).map(([k, v]) => {
|
||||||
return <li>{k}: {v}</li>;
|
return <li key={k}>{k}: {v}</li>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -4,12 +4,12 @@ mockGroup.body.point_ids = [1, 2, 3];
|
||||||
jest.mock("../group_detail", () => ({ fetchGroupFromUrl: () => mockGroup }));
|
jest.mock("../group_detail", () => ({ fetchGroupFromUrl: () => mockGroup }));
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { mount } from "enzyme";
|
|
||||||
import { GroupOrder, GroupOrderProps } from "../group_order_visual";
|
import { GroupOrder, GroupOrderProps } from "../group_order_visual";
|
||||||
import {
|
import {
|
||||||
fakeMapTransformProps
|
fakeMapTransformProps
|
||||||
} from "../../../__test_support__/map_transform_props";
|
} from "../../../__test_support__/map_transform_props";
|
||||||
import { fakePlant } from "../../../__test_support__/fake_state/resources";
|
import { fakePlant } from "../../../__test_support__/fake_state/resources";
|
||||||
|
import { svgMount } from "../../../__test_support__/svg_mount";
|
||||||
|
|
||||||
describe("<GroupOrder />", () => {
|
describe("<GroupOrder />", () => {
|
||||||
const fakeProps = (): GroupOrderProps => {
|
const fakeProps = (): GroupOrderProps => {
|
||||||
|
@ -30,7 +30,7 @@ describe("<GroupOrder />", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
it("renders group order", () => {
|
it("renders group order", () => {
|
||||||
const wrapper = mount(<GroupOrder {...fakeProps()} />);
|
const wrapper = svgMount(<GroupOrder {...fakeProps()} />);
|
||||||
expect(wrapper.find("line").length).toEqual(3);
|
expect(wrapper.find("line").length).toEqual(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,6 @@ describe("AdditionalMenu", () => {
|
||||||
close={jest.fn()} />);
|
close={jest.fn()} />);
|
||||||
const text = wrapper.text();
|
const text = wrapper.text();
|
||||||
expect(text).toContain("Account Settings");
|
expect(text).toContain("Account Settings");
|
||||||
expect(text).toContain("Documentation");
|
|
||||||
expect(text).toContain("Logout");
|
expect(text).toContain("Logout");
|
||||||
expect(text).toContain("VERSION");
|
expect(text).toContain("VERSION");
|
||||||
});
|
});
|
||||||
|
@ -33,7 +32,7 @@ describe("AdditionalMenu", () => {
|
||||||
const wrapper = shallow(<AdditionalMenu
|
const wrapper = shallow(<AdditionalMenu
|
||||||
logout={logout}
|
logout={logout}
|
||||||
close={jest.fn()} />);
|
close={jest.fn()} />);
|
||||||
wrapper.find("a").at(1).simulate("click");
|
wrapper.find("a").at(0).simulate("click");
|
||||||
expect(logout).toHaveBeenCalled();
|
expect(logout).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
|
let mockPath = "/app/designer/plants";
|
||||||
|
jest.mock("../../history", () => ({
|
||||||
|
getPathArray: jest.fn(() => mockPath.split("/")),
|
||||||
|
}));
|
||||||
|
|
||||||
|
let mockDev = false;
|
||||||
|
jest.mock("../../account/dev/dev_support", () => ({
|
||||||
|
DevSettings: { futureFeaturesEnabled: () => mockDev }
|
||||||
|
}));
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { shallow, mount } from "enzyme";
|
import { shallow, mount } from "enzyme";
|
||||||
import { NavLinks } from "../nav_links";
|
import { NavLinks } from "../nav_links";
|
||||||
|
|
||||||
describe("NavLinks", () => {
|
describe("<NavLinks />", () => {
|
||||||
it("toggles the mobile nav menu", () => {
|
it("toggles the mobile nav menu", () => {
|
||||||
const close = jest.fn();
|
const close = jest.fn();
|
||||||
const wrapper = shallow(<NavLinks close={(x) => () => close(x)}
|
const wrapper = shallow(<NavLinks close={(x) => () => close(x)}
|
||||||
|
@ -16,4 +26,16 @@ describe("NavLinks", () => {
|
||||||
const wrapper = mount(<NavLinks close={jest.fn()} alertCount={1} />);
|
const wrapper = mount(<NavLinks close={jest.fn()} alertCount={1} />);
|
||||||
expect(wrapper.text()).toContain("1");
|
expect(wrapper.text()).toContain("1");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("shows links", () => {
|
||||||
|
mockDev = true;
|
||||||
|
const wrapper = mount(<NavLinks close={jest.fn()} alertCount={1} />);
|
||||||
|
expect(wrapper.text().toLowerCase()).not.toContain("tools");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows active link", () => {
|
||||||
|
mockPath = "/app/designer";
|
||||||
|
const wrapper = shallow(<NavLinks close={jest.fn()} alertCount={1} />);
|
||||||
|
expect(wrapper.find("Link").first().hasClass("active")).toBeTruthy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { AccountMenuProps } from "./interfaces";
|
import { AccountMenuProps } from "./interfaces";
|
||||||
import { docLink } from "../ui/doc_link";
|
|
||||||
import { Link } from "../link";
|
import { Link } from "../link";
|
||||||
import { shortRevision } from "../util";
|
import { shortRevision } from "../util";
|
||||||
import { t } from "../i18next_wrapper";
|
import { t } from "../i18next_wrapper";
|
||||||
|
@ -23,12 +22,6 @@ export const AdditionalMenu = (props: AccountMenuProps) => {
|
||||||
<i className="fa fa-question-circle"></i>
|
<i className="fa fa-question-circle"></i>
|
||||||
{t("Help")}
|
{t("Help")}
|
||||||
</Link>
|
</Link>
|
||||||
<div>
|
|
||||||
<a href={docLink("the-farmbot-web-app")}
|
|
||||||
target="_blank">
|
|
||||||
<i className="fa fa-file-text-o"></i>{t("Documentation")}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<a onClick={props.logout}>
|
<a onClick={props.logout}>
|
||||||
<i className="fa fa-sign-out"></i>
|
<i className="fa fa-sign-out"></i>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
import { Link } from "../link";
|
import { Link } from "../link";
|
||||||
import { t } from "../i18next_wrapper";
|
import { t } from "../i18next_wrapper";
|
||||||
import { betterCompact } from "../util";
|
import { betterCompact } from "../util";
|
||||||
|
import { DevSettings } from "../account/dev/dev_support";
|
||||||
/** Uses a slug and a child path to compute the `href` of a navbar link. */
|
/** Uses a slug and a child path to compute the `href` of a navbar link. */
|
||||||
export type LinkComputeFn = (slug: string, childPath: string) => string;
|
export type LinkComputeFn = (slug: string, childPath: string) => string;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ export const getLinks = (): NavLinkParams[] => betterCompact([
|
||||||
name: "Regimens", icon: "calendar-check-o", slug: "regimens",
|
name: "Regimens", icon: "calendar-check-o", slug: "regimens",
|
||||||
computeHref: computeEditorUrlFromState("Regimen")
|
computeHref: computeEditorUrlFromState("Regimen")
|
||||||
},
|
},
|
||||||
|
DevSettings.futureFeaturesEnabled() ? undefined :
|
||||||
{ name: "Tools", icon: "wrench", slug: "tools" },
|
{ name: "Tools", icon: "wrench", slug: "tools" },
|
||||||
{
|
{
|
||||||
name: "Farmware", icon: "crosshairs", slug: "farmware",
|
name: "Farmware", icon: "crosshairs", slug: "farmware",
|
||||||
|
|
|
@ -39,7 +39,6 @@ describe("<LocalsList/>", () => {
|
||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
shouldDisplay: jest.fn(),
|
shouldDisplay: jest.fn(),
|
||||||
allowedVariableNodes: AllowedVariableNodes.parameter,
|
allowedVariableNodes: AllowedVariableNodes.parameter,
|
||||||
customFilterRule: undefined
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@ import {
|
||||||
|
|
||||||
describe("locationFormList()", () => {
|
describe("locationFormList()", () => {
|
||||||
it("returns dropdown list", () => {
|
it("returns dropdown list", () => {
|
||||||
const items = locationFormList(fakeResourceIndex(), []);
|
const pg = fakePointGroup();
|
||||||
|
pg.body.id = 1;
|
||||||
|
const items = locationFormList(fakeResourceIndex([pg]), [], true);
|
||||||
const coordinate = items[0];
|
const coordinate = items[0];
|
||||||
expect(coordinate).toEqual({
|
expect(coordinate).toEqual({
|
||||||
headingId: "Coordinate",
|
headingId: "Coordinate",
|
||||||
|
@ -54,6 +56,19 @@ describe("locationFormList()", () => {
|
||||||
label: "Point 1 (10, 20, 30)",
|
label: "Point 1 (10, 20, 30)",
|
||||||
value: "2"
|
value: "2"
|
||||||
});
|
});
|
||||||
|
const groupHeading = items[8];
|
||||||
|
expect(groupHeading).toEqual({
|
||||||
|
headingId: "PointGroup",
|
||||||
|
label: "Groups",
|
||||||
|
value: 0,
|
||||||
|
heading: true,
|
||||||
|
});
|
||||||
|
const group = items[9];
|
||||||
|
expect(group).toEqual({
|
||||||
|
headingId: "PointGroup",
|
||||||
|
label: "Fake",
|
||||||
|
value: "1"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -34,18 +34,19 @@ describe("<LocationForm/>", () => {
|
||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
shouldDisplay: jest.fn(),
|
shouldDisplay: jest.fn(),
|
||||||
allowedVariableNodes: AllowedVariableNodes.parameter,
|
allowedVariableNodes: AllowedVariableNodes.parameter,
|
||||||
customFilterRule: undefined
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders correct UI components", () => {
|
it("renders correct UI components", () => {
|
||||||
const p = fakeProps();
|
const p = fakeProps();
|
||||||
|
p.shouldDisplay = () => true;
|
||||||
const el = shallow(<LocationForm {...p} />);
|
const el = shallow(<LocationForm {...p} />);
|
||||||
const selects = el.find(FBSelect);
|
const selects = el.find(FBSelect);
|
||||||
const inputs = el.find(BlurableInput);
|
const inputs = el.find(BlurableInput);
|
||||||
|
|
||||||
expect(selects.length).toBe(1);
|
expect(selects.length).toBe(1);
|
||||||
const select = selects.first().props();
|
const select = selects.first().props();
|
||||||
const choices = locationFormList(p.resources, [PARENT("")]);
|
const choices = locationFormList(
|
||||||
|
p.resources, [PARENT("Externally defined")], true);
|
||||||
const actualLabels = select.list.map(x => x.label).sort();
|
const actualLabels = select.list.map(x => x.label).sort();
|
||||||
const expectedLabels = choices.map(x => x.label).sort();
|
const expectedLabels = choices.map(x => x.label).sort();
|
||||||
const diff = difference(actualLabels, expectedLabels);
|
const diff = difference(actualLabels, expectedLabels);
|
||||||
|
|
|
@ -35,6 +35,7 @@ export const DefaultValueForm = (props: DefaultValueFormProps) => {
|
||||||
shouldDisplay={() => true}
|
shouldDisplay={() => true}
|
||||||
allowedVariableNodes={AllowedVariableNodes.variable}
|
allowedVariableNodes={AllowedVariableNodes.variable}
|
||||||
hideTypeLabel={true}
|
hideTypeLabel={true}
|
||||||
|
hideGroups={true}
|
||||||
onChange={change(props.onChange, props.variableNode)}
|
onChange={change(props.onChange, props.variableNode)}
|
||||||
customFilterRule={NO_GROUPS} />
|
customFilterRule={NO_GROUPS} />
|
||||||
</div>;
|
</div>;
|
||||||
|
|
|
@ -60,6 +60,7 @@ export const LocalsList = (props: LocalsListProps) => {
|
||||||
collapsed={props.collapsed}
|
collapsed={props.collapsed}
|
||||||
toggleVarShow={props.toggleVarShow}
|
toggleVarShow={props.toggleVarShow}
|
||||||
onChange={props.onChange}
|
onChange={props.onChange}
|
||||||
|
hideGroups={props.hideGroups}
|
||||||
customFilterRule={props.customFilterRule} />)}
|
customFilterRule={props.customFilterRule} />)}
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,6 +54,8 @@ interface CommonProps {
|
||||||
collapsible?: boolean;
|
collapsible?: boolean;
|
||||||
collapsed?: boolean;
|
collapsed?: boolean;
|
||||||
toggleVarShow?: () => void;
|
toggleVarShow?: () => void;
|
||||||
|
/** Don't show groups in dropdown. */
|
||||||
|
hideGroups?: boolean;
|
||||||
/** Optional filter to allow removal of arbitrary dropdown items.
|
/** Optional filter to allow removal of arbitrary dropdown items.
|
||||||
* Return `false` to omit an item from display. */
|
* Return `false` to omit an item from display. */
|
||||||
customFilterRule?: (ddi: DropDownItem) => boolean;
|
customFilterRule?: (ddi: DropDownItem) => boolean;
|
||||||
|
|
|
@ -45,7 +45,7 @@ const maybeUseStepData = ({ resources, bodyVariables, variable, uuid }: {
|
||||||
export const LocationForm =
|
export const LocationForm =
|
||||||
(props: LocationFormProps) => {
|
(props: LocationFormProps) => {
|
||||||
const { sequenceUuid, resources, bodyVariables, variable,
|
const { sequenceUuid, resources, bodyVariables, variable,
|
||||||
allowedVariableNodes } = props;
|
allowedVariableNodes, hideGroups } = props;
|
||||||
const { celeryNode, dropdown, vector } = maybeUseStepData({
|
const { celeryNode, dropdown, vector } = maybeUseStepData({
|
||||||
resources, bodyVariables, variable, uuid: sequenceUuid
|
resources, bodyVariables, variable, uuid: sequenceUuid
|
||||||
});
|
});
|
||||||
|
@ -55,7 +55,8 @@ export const LocationForm =
|
||||||
const variableListItems = displayVariables ? [PARENT(determineVarDDILabel({
|
const variableListItems = displayVariables ? [PARENT(determineVarDDILabel({
|
||||||
label: "parent", resources, uuid: sequenceUuid, forceExternal: headerForm
|
label: "parent", resources, uuid: sequenceUuid, forceExternal: headerForm
|
||||||
}))] : [];
|
}))] : [];
|
||||||
const unfiltered = locationFormList(resources, variableListItems);
|
const displayGroups = props.shouldDisplay(Feature.groups) && !hideGroups;
|
||||||
|
const unfiltered = locationFormList(resources, variableListItems, displayGroups);
|
||||||
const list = props.customFilterRule ?
|
const list = props.customFilterRule ?
|
||||||
unfiltered.filter(props.customFilterRule) : unfiltered;
|
unfiltered.filter(props.customFilterRule) : unfiltered;
|
||||||
/** Variable name. */
|
/** Variable name. */
|
||||||
|
|
|
@ -66,7 +66,7 @@ export const groups2Ddi = (groups: TaggedPointGroup[]): DropDownItem[] => {
|
||||||
|
|
||||||
/** Location selection menu items. */
|
/** Location selection menu items. */
|
||||||
export function locationFormList(resources: ResourceIndex,
|
export function locationFormList(resources: ResourceIndex,
|
||||||
additionalItems: DropDownItem[]): DropDownItem[] {
|
additionalItems: DropDownItem[], displayGroups?: boolean): DropDownItem[] {
|
||||||
const points = selectAllActivePoints(resources)
|
const points = selectAllActivePoints(resources)
|
||||||
.filter(x => x.body.pointer_type !== "ToolSlot");
|
.filter(x => x.body.pointer_type !== "ToolSlot");
|
||||||
const plantDDI = points2ddi(points, "Plant");
|
const plantDDI = points2ddi(points, "Plant");
|
||||||
|
@ -80,8 +80,8 @@ export function locationFormList(resources: ResourceIndex,
|
||||||
.concat(plantDDI)
|
.concat(plantDDI)
|
||||||
.concat(heading("GenericPointer"))
|
.concat(heading("GenericPointer"))
|
||||||
.concat(genericPointerDDI)
|
.concat(genericPointerDDI)
|
||||||
.concat(heading("PointGroup"))
|
.concat(displayGroups ? heading("PointGroup") : [])
|
||||||
.concat(groups2Ddi(selectAllPointGroups(resources)));
|
.concat(displayGroups ? groups2Ddi(selectAllPointGroups(resources)) : []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create drop down item with label; i.e., "Point/Plant (1, 2, 3)" */
|
/** Create drop down item with label; i.e., "Point/Plant (1, 2, 3)" */
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { ResourceIndex } from "../../resources/interfaces";
|
||||||
import { TaggedResource } from "farmbot";
|
import { TaggedResource } from "farmbot";
|
||||||
import { newTaggedResource } from "../../sync/actions";
|
import { newTaggedResource } from "../../sync/actions";
|
||||||
|
|
||||||
export function fakeResourceIndex(): ResourceIndex {
|
export function fakeResourceIndex(extra: TaggedResource[] = []): ResourceIndex {
|
||||||
const fakeResources: TaggedResource[] = [
|
const fakeResources: TaggedResource[] = [
|
||||||
...newTaggedResource("Point", {
|
...newTaggedResource("Point", {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
@ -56,7 +56,8 @@ export function fakeResourceIndex(): ResourceIndex {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "Generic Tool",
|
"name": "Generic Tool",
|
||||||
"status": "active"
|
"status": "active"
|
||||||
})
|
}),
|
||||||
|
...extra,
|
||||||
];
|
];
|
||||||
return buildResourceIndex(fakeResources).index;
|
return buildResourceIndex(fakeResources).index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,7 @@ const SequenceHeader = (props: SequenceHeaderProps) => {
|
||||||
collapsed={props.variablesCollapsed}
|
collapsed={props.variablesCollapsed}
|
||||||
toggleVarShow={props.toggleVarShow}
|
toggleVarShow={props.toggleVarShow}
|
||||||
shouldDisplay={props.shouldDisplay}
|
shouldDisplay={props.shouldDisplay}
|
||||||
|
hideGroups={true}
|
||||||
customFilterRule={NO_GROUPS} />
|
customFilterRule={NO_GROUPS} />
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,6 +95,7 @@ export class TileMoveAbsolute extends React.Component<StepParams, MoveAbsState>
|
||||||
this.updateLocation(x)}
|
this.updateLocation(x)}
|
||||||
shouldDisplay={this.props.shouldDisplay || (() => false)}
|
shouldDisplay={this.props.shouldDisplay || (() => false)}
|
||||||
hideHeader={true}
|
hideHeader={true}
|
||||||
|
hideGroups={true}
|
||||||
locationDropdownKey={JSON.stringify(this.props.currentSequence)}
|
locationDropdownKey={JSON.stringify(this.props.currentSequence)}
|
||||||
allowedVariableNodes={AllowedVariableNodes.identifier}
|
allowedVariableNodes={AllowedVariableNodes.identifier}
|
||||||
width={3}
|
width={3}
|
||||||
|
|
Loading…
Reference in New Issue