Step inspector
The panel of a step: parameters with references, settings (errors, retries, timeout), its test.
import { StepInspector, StepFields, StepSettings } from "@forgeron/ui";import { Message01Icon, TrophyIcon } from "@forgeron/icons";
import { StepInspector, variablesFromSample } from "@forgeron/ui";
export default function Default() {
return (
<div style={{ width: 340 }}>
<StepInspector
icon={Message01Icon}
title="Tell #sales"
subtitle="Chat · postMessage()"
fields={[
{
key: "channel",
label: "Channel",
type: "select",
required: true,
options: [
{ value: "sales", label: "#sales" },
{ value: "ops", label: "#lyon-depot" },
],
},
{ key: "text", label: "Message", type: "text", required: true, typeLabel: "string" },
]}
defaultValues={{ channel: "sales", text: "Won {{ deal.name }}" }}
variables={[
variablesFromSample(
"deal",
"Deal moved to Won",
{ name: "Transalp", amount: 9600 },
TrophyIcon,
),
]}
/>
</div>
);
}import { Mail01Icon, TrophyIcon } from "@forgeron/icons";
import {
DEFAULT_STEP_SETTINGS,
StepInspector,
variablesFromSample,
type StepSettingsValue,
type StepValues,
} from "@forgeron/ui";
import { useState } from "react";
const deal = {
id: 4182,
name: "Transalp",
amount: 9600,
contact: { email: "compta@transalp.example" },
};
// The panel a node editor opens on a step: parameters, settings, a test with its input and output.
export default function WithSettingsAndATest() {
const [title, setTitle] = useState("Thank the client");
const [values, setValues] = useState<StepValues>({
credential: "mail-relay",
to: "{{ deal.contact.email }}",
subject: "Thank you, {{ deal.name }}",
body: "We start on Monday.",
copyOwner: true,
});
const [settings, setSettings] = useState<StepSettingsValue>({
...DEFAULT_STEP_SETTINGS,
retry: true,
output: "mail",
});
return (
<div style={{ width: "100%", maxWidth: 420, height: 640 }}>
<StepInspector
icon={Mail01Icon}
title={title}
onTitleChange={setTitle}
subtitle="Mail relay · send()"
fields={[
{
key: "credential",
label: "Account",
type: "credential",
typeLabel: `Credential<"mail">`,
options: [
{ value: "mail-relay", label: "Mail relay (SMTP)" },
{ value: "mail-backup", label: "Backup relay", missing: true },
],
},
{ key: "to", label: "To", type: "text", required: true, typeLabel: "string" },
{ key: "subject", label: "Subject", type: "text", typeLabel: "string" },
{ key: "body", label: "Body", type: "long", typeLabel: "string" },
{ key: "copyOwner", label: "Copy the deal owner", type: "boolean" },
]}
values={values}
onValuesChange={setValues}
variables={[variablesFromSample("deal", "Deal moved to Won", deal, TrophyIcon)]}
sample={{ deal }}
settings={settings}
onSettingsChange={setSettings}
test={{
status: "success",
durationMs: 284,
items: 1,
at: "10:42:07",
input: { deal },
output: { messageId: "<4182.1731836527@relay>", accepted: ["compta@transalp.example"] },
}}
onTest={() => {}}
onDuplicate={() => {}}
onDelete={() => {}}
onClose={() => {}}
/>
</div>
);
}Runs
Cronat
Weekdays at 08:00Europe/Paris
0 8 * * 1-5Timezone
Given to the first step.
import { StepFields } from "@forgeron/ui";
// StepFields alone, in any panel: here the fields of a Schedule trigger.
export default function TriggerWithASchedule() {
return (
<div style={{ width: "100%", maxWidth: 480 }}>
<StepFields
timezone="Europe/Paris"
fields={[
{ key: "cron", label: "Runs", type: "schedule", typeLabel: "Cron" },
{
key: "tz",
label: "Timezone",
type: "select",
options: ["Europe/Paris", "UTC", "Europe/London"].map((t) => ({ value: t, label: t })),
},
{
key: "payload",
label: "Payload",
type: "json",
typeLabel: "Json",
hint: "Given to the first step.",
},
]}
defaultValues={{
cron: "0 8 * * 1-5",
tz: "Europe/Paris",
payload: '{ "report": "daily" }',
}}
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
icon / title / subtitle | … | — | The step, at the top. |
onTitleChange | (title) => void | — | Makes the name editable. |
fields | { key, label, type, required?, options?, hint?, typeLabel?, expression? }[] | — | type: text, long, number, select, boolean, schedule, json, credential. Text takes {{ references }}. |
values / onValuesChange | Record<string, unknown> | — | The parameters. |
variables | { id, label, icon?, fields: { path, hint? }[] }[] | — | The outputs of the previous steps, nearest first. variablesFromSample(id, label, sample) builds one from a test output. |
sample | unknown | — | Test data: text fields show what they resolve to. |
settings / onSettingsChange | { onError, retry, attempts, timeout, disabled, output?, notes? } | — | The Settings tab; without it there is none. |
tabs | { id, label, content }[] | — | More tabs: the code, the docs. |
test / onTest | { status, durationMs?, items?, at?, input?, output?, error? } | — | The last test of the step, with Input and Output. |
onDuplicate / onDelete / onClose | () => void | — | Footer and header. |
readOnly | boolean | — | Shows without editing: a run, a published version. |
className | string | — | Extra classes. |