2019-01-13 17:16:22 -07:00
|
|
|
import { ResourceColor } from "../interfaces";
|
2017-06-29 12:54:02 -06:00
|
|
|
import {
|
|
|
|
Sequence as CeleryScriptSequence,
|
|
|
|
SequenceBodyItem,
|
2017-07-07 08:52:55 -06:00
|
|
|
LegalArgString,
|
2018-01-23 17:15:53 -07:00
|
|
|
SyncStatus,
|
2018-01-24 17:33:16 -07:00
|
|
|
ALLOWED_CHANNEL_NAMES,
|
2018-05-18 16:34:12 -06:00
|
|
|
Xyz,
|
2019-02-26 20:12:02 -07:00
|
|
|
FarmwareConfig,
|
2019-02-27 19:29:38 -07:00
|
|
|
ALLOWED_MESSAGE_TYPES,
|
|
|
|
Vector3,
|
2017-06-29 12:54:02 -06:00
|
|
|
} from "farmbot";
|
|
|
|
import { StepMoveDataXfer, StepSpliceDataXfer } from "../draggable/interfaces";
|
2018-08-01 07:33:39 -06:00
|
|
|
import { TaggedSequence } from "farmbot";
|
2018-12-20 20:18:10 -07:00
|
|
|
import { ResourceIndex, VariableNameSet, UUID } from "../resources/interfaces";
|
2018-03-08 18:02:50 -07:00
|
|
|
import { ShouldDisplay } from "../devices/interfaces";
|
2019-04-12 20:50:10 -06:00
|
|
|
import { GetWebAppConfigValue } from "../config_storage/actions";
|
2019-12-12 15:56:57 -07:00
|
|
|
import { Folders } from "../folders/component";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
2018-01-24 17:33:16 -07:00
|
|
|
export interface HardwareFlags {
|
|
|
|
findHomeEnabled: Record<Xyz, boolean>;
|
|
|
|
stopAtHome: Record<Xyz, boolean>;
|
|
|
|
stopAtMax: Record<Xyz, boolean>;
|
|
|
|
negativeOnly: Record<Xyz, boolean>;
|
|
|
|
axisLength: Record<Xyz, number>;
|
|
|
|
}
|
|
|
|
|
2019-02-27 19:29:38 -07:00
|
|
|
export interface CheckConflictCaseProps {
|
|
|
|
axis: Xyz;
|
|
|
|
target: number;
|
|
|
|
hardwareFlags: HardwareFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MoveAbsoluteWarningProps {
|
|
|
|
vector: Vector3 | undefined;
|
|
|
|
offset: Vector3;
|
|
|
|
hardwareFlags: HardwareFlags | undefined;
|
|
|
|
}
|
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
export interface Props {
|
|
|
|
dispatch: Function;
|
|
|
|
sequences: TaggedSequence[];
|
|
|
|
sequence: TaggedSequence | undefined;
|
|
|
|
resources: ResourceIndex;
|
2017-07-07 08:52:55 -06:00
|
|
|
syncStatus: SyncStatus;
|
2018-01-24 17:33:16 -07:00
|
|
|
hardwareFlags: HardwareFlags;
|
2019-12-27 11:37:54 -07:00
|
|
|
farmwareData: FarmwareData;
|
2018-03-07 20:42:34 -07:00
|
|
|
shouldDisplay: ShouldDisplay;
|
2019-04-12 20:50:10 -06:00
|
|
|
getWebAppConfigValue: GetWebAppConfigValue;
|
2019-01-12 05:25:02 -07:00
|
|
|
menuOpen: boolean;
|
2019-04-09 19:45:59 -06:00
|
|
|
stepIndex: number | undefined;
|
2019-12-12 15:56:57 -07:00
|
|
|
folderData: Folders["props"];
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SequenceEditorMiddleProps {
|
|
|
|
dispatch: Function;
|
|
|
|
sequence: TaggedSequence | undefined;
|
|
|
|
resources: ResourceIndex;
|
2017-07-07 08:52:55 -06:00
|
|
|
syncStatus: SyncStatus;
|
2018-01-24 17:33:16 -07:00
|
|
|
hardwareFlags: HardwareFlags;
|
2019-12-27 11:37:54 -07:00
|
|
|
farmwareData: FarmwareData;
|
2018-03-07 20:42:34 -07:00
|
|
|
shouldDisplay: ShouldDisplay;
|
2019-04-12 20:50:10 -06:00
|
|
|
getWebAppConfigValue: GetWebAppConfigValue;
|
2019-01-12 05:25:02 -07:00
|
|
|
menuOpen: boolean;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActiveMiddleProps extends SequenceEditorMiddleProps {
|
|
|
|
sequence: TaggedSequence;
|
|
|
|
}
|
|
|
|
|
2018-11-12 14:06:52 -07:00
|
|
|
export interface SequenceHeaderProps {
|
|
|
|
dispatch: Function;
|
|
|
|
sequence: TaggedSequence;
|
|
|
|
syncStatus: SyncStatus;
|
|
|
|
resources: ResourceIndex;
|
|
|
|
shouldDisplay: ShouldDisplay;
|
2019-01-12 05:25:02 -07:00
|
|
|
menuOpen: boolean;
|
2019-04-09 19:32:18 -06:00
|
|
|
variablesCollapsed: boolean;
|
|
|
|
toggleVarShow: () => void;
|
2019-04-12 20:50:10 -06:00
|
|
|
getWebAppConfigValue: GetWebAppConfigValue;
|
2018-11-12 14:06:52 -07:00
|
|
|
}
|
|
|
|
|
2018-01-24 11:19:26 -07:00
|
|
|
export type ChannelName = ALLOWED_CHANNEL_NAMES;
|
2017-06-29 12:54:02 -06:00
|
|
|
|
2018-07-13 14:56:01 -06:00
|
|
|
export const INT_NUMERIC_FIELDS = ["milliseconds", "pin_mode", "pin_number",
|
|
|
|
"pin_value", "rhs", "sequence_id", "speed"];
|
|
|
|
|
|
|
|
export const FLOAT_NUMERIC_FIELDS = ["x", "y", "z"];
|
|
|
|
|
|
|
|
export const NUMERIC_FIELDS = INT_NUMERIC_FIELDS.concat(FLOAT_NUMERIC_FIELDS);
|
2017-06-29 12:54:02 -06:00
|
|
|
|
2019-02-26 20:12:02 -07:00
|
|
|
export enum MessageType {
|
|
|
|
success = "success",
|
|
|
|
busy = "busy",
|
|
|
|
warn = "warn",
|
|
|
|
error = "error",
|
|
|
|
info = "info",
|
|
|
|
fun = "fun",
|
2019-08-23 15:19:22 -06:00
|
|
|
debug = "debug",
|
|
|
|
assertion = "assertion",
|
2019-02-26 20:12:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export const MESSAGE_TYPES = Object.keys(MessageType);
|
|
|
|
|
|
|
|
// tslint:disable-next-line:no-any
|
|
|
|
export const isMessageType = (x: any): x is ALLOWED_MESSAGE_TYPES =>
|
|
|
|
MESSAGE_TYPES.includes(x);
|
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
export interface Sequence extends CeleryScriptSequence {
|
|
|
|
id?: number;
|
2019-01-13 17:16:22 -07:00
|
|
|
color: ResourceColor;
|
2017-06-29 12:54:02 -06:00
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SequenceReducerState {
|
|
|
|
current: string | undefined;
|
2019-01-12 05:25:02 -07:00
|
|
|
menuOpen: boolean;
|
2019-04-09 19:45:59 -06:00
|
|
|
stepIndex: number | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SequencesListProps {
|
|
|
|
sequences: TaggedSequence[];
|
2018-12-20 20:18:10 -07:00
|
|
|
resourceUsage: Record<UUID, boolean | undefined>;
|
2017-07-06 15:43:19 -06:00
|
|
|
sequence: TaggedSequence | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
dispatch: Function;
|
2018-12-20 20:18:10 -07:00
|
|
|
sequenceMetas: Record<UUID, VariableNameSet | undefined>;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SequencesListState {
|
|
|
|
searchTerm: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MoveAbsState {
|
2019-04-09 22:00:03 -06:00
|
|
|
more: boolean;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface StepButtonParams {
|
|
|
|
current: TaggedSequence | undefined;
|
|
|
|
step: SequenceBodyItem;
|
|
|
|
dispatch: Function;
|
2018-03-19 06:57:49 -06:00
|
|
|
children?: React.ReactNode;
|
2017-06-29 12:54:02 -06:00
|
|
|
color: "blue"
|
|
|
|
| "green"
|
|
|
|
| "orange"
|
|
|
|
| "yellow"
|
|
|
|
| "brown"
|
|
|
|
| "red"
|
|
|
|
| "purple"
|
|
|
|
| "pink"
|
|
|
|
| "gray";
|
2019-04-09 19:45:59 -06:00
|
|
|
index?: number | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface CopyParams {
|
|
|
|
dispatch: Function;
|
|
|
|
step: SequenceBodyItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RemoveParams {
|
|
|
|
index: number;
|
|
|
|
dispatch: Function;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface StepInputProps {
|
|
|
|
step: SequenceBodyItem;
|
|
|
|
sequence: TaggedSequence;
|
|
|
|
field: LegalArgString;
|
|
|
|
dispatch: Function;
|
|
|
|
type_?: "text" | "hidden" | undefined;
|
|
|
|
index: number;
|
2019-02-26 20:12:02 -07:00
|
|
|
fieldOverride?: boolean;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface StepTitleBarProps {
|
|
|
|
step: SequenceBodyItem;
|
|
|
|
index: number;
|
|
|
|
dispatch: Function;
|
2017-08-01 13:21:23 -06:00
|
|
|
sequence: TaggedSequence;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SelectSequence {
|
|
|
|
type: "SELECT_SEQUENCE";
|
|
|
|
payload: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type DataXferObj = StepMoveDataXfer | StepSpliceDataXfer;
|
|
|
|
|
|
|
|
export type dispatcher = (a: Function | { type: string }) => DataXferObj;
|
|
|
|
|
2018-05-18 16:34:12 -06:00
|
|
|
export type FarmwareConfigs = { [x: string]: FarmwareConfig[] };
|
|
|
|
|
2019-12-27 11:37:54 -07:00
|
|
|
export interface FarmwareData {
|
2018-02-14 22:07:36 -07:00
|
|
|
farmwareNames: string[];
|
|
|
|
firstPartyFarmwareNames: string[];
|
|
|
|
showFirstPartyFarmware: boolean;
|
2018-05-18 16:34:12 -06:00
|
|
|
farmwareConfigs: FarmwareConfigs;
|
2019-12-27 11:37:54 -07:00
|
|
|
cameraDisabled: boolean;
|
2018-02-14 22:07:36 -07:00
|
|
|
}
|
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
export interface StepParams {
|
|
|
|
currentSequence: TaggedSequence;
|
|
|
|
currentStep: SequenceBodyItem;
|
|
|
|
dispatch: Function;
|
|
|
|
index: number;
|
|
|
|
resources: ResourceIndex;
|
2018-01-24 17:33:16 -07:00
|
|
|
hardwareFlags?: HardwareFlags;
|
2019-12-27 11:37:54 -07:00
|
|
|
farmwareData?: FarmwareData;
|
2018-03-07 20:42:34 -07:00
|
|
|
shouldDisplay?: ShouldDisplay;
|
2018-08-30 19:25:58 -06:00
|
|
|
confirmStepDeletion: boolean;
|
2019-04-11 21:17:18 -06:00
|
|
|
showPins?: boolean;
|
2019-06-05 14:49:24 -06:00
|
|
|
expandStepOptions?: boolean;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|