Automation list
The automations of a workspace: trigger, state, last run, runs of the last days, owner.
import { AutomationList, RunBars } from "@forgeron/ui";| Automation | State | Runs · 14 d |
|---|---|---|
| Won deal → invoice | Active | |
| Carrier rates | Paused |
import { Clock01Icon, TrophyIcon } from "@forgeron/icons";
import { AutomationList } from "@forgeron/ui";
// Fewer columns for a narrow place: a side panel, a dashboard tile.
export default function Default() {
return (
<div style={{ width: 440 }}>
<AutomationList
columns={["state", "runs"]}
onOpen={() => {}}
automations={[
{
id: "won",
name: "Won deal → invoice",
meta: "Sales · v4",
trigger: { label: "CRM · Deal moved to Won", icon: TrophyIcon },
state: "active",
runs: [3, 5, 2, 0, 0, 4, 6, 3, 5, 7, 2, 0, 0, 4],
},
{
id: "rates",
name: "Carrier rates",
meta: "Operations · v7",
trigger: { label: "Weekdays at 09:15", icon: Clock01Icon },
state: "paused",
runs: [1, 1, 1, 0, 0, 1, 2, 1, 1, 1, 0, 0, 1, 2],
errors: [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1],
},
]}
/>
</div>
);
}| Automation | Trigger | State | Last run | Runs · 14 d | Owner |
|---|---|---|---|---|---|
| Won deal → invoice | CRM · Deal moved to Won | Active | 4 min ago612 ms | Camille Roy | |
| Carrier rates | Weekdays at 09:15 | Active | 1 h ago1.8 s | Hugo Bernard | |
| Partner sync | Webhook POST | Draft | Never | Léa Martin |
import { ApiIcon, Clock01Icon, TrophyIcon } from "@forgeron/icons";
import { AutomationList } from "@forgeron/ui";
export default function Full() {
return (
<div style={{ width: "100%", maxWidth: 980 }}>
<AutomationList
onOpen={() => {}}
automations={[
{
id: "won",
name: "Won deal → invoice",
meta: "Sales · 6 steps · v4",
trigger: { label: "CRM · Deal moved to Won", icon: TrophyIcon },
state: "active",
lastRun: { status: "success", ago: "4 min ago", durationMs: 612 },
runs: [3, 5, 2, 0, 0, 4, 6, 3, 5, 7, 2, 0, 0, 4],
owner: "Camille Roy",
},
{
id: "rates",
name: "Carrier rates",
meta: "Operations · 4 steps · v7",
trigger: { label: "Weekdays at 09:15", icon: Clock01Icon },
state: "active",
lastRun: { status: "error", ago: "1 h ago", durationMs: 1840 },
runs: [1, 1, 1, 0, 0, 1, 2, 1, 1, 1, 0, 0, 1, 2],
errors: [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1],
owner: "Hugo Bernard",
},
{
id: "partner",
name: "Partner sync",
meta: "Operations · 3 steps",
trigger: { label: "Webhook POST", icon: ApiIcon },
state: "draft",
owner: "Léa Martin",
},
]}
/>
</div>
);
}| Automation | Trigger | State | Last run | Runs · 14 d | Owner | Actions |
|---|---|---|---|---|---|---|
| Triage new tickets | Helpdesk · Ticket created | Active | just now140 ms | Nadia Petit | ||
| Month-end report | Monthly on the 1st at 06:00 | Paused | 17 days ago1 min 15 s | Tom Garnier |
import { Clock01Icon, MoreHorizontalIcon, Ticket01Icon } from "@forgeron/icons";
import { AutomationList, IconButton, RunBars, Switch, type AutomationSummary } from "@forgeron/ui";
import { useState } from "react";
const start: AutomationSummary[] = [
{
id: "triage",
name: "Triage new tickets",
meta: "Support · 5 steps · v2",
trigger: { label: "Helpdesk · Ticket created", icon: Ticket01Icon },
state: "active",
lastRun: { status: "success", ago: "just now", durationMs: 140 },
runs: [12, 9, 14, 3, 2, 11, 16, 13, 10, 15, 4, 1, 12, 14],
errors: [0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0],
owner: "Nadia Petit",
},
{
id: "report",
name: "Month-end report",
meta: "Finance · 4 steps · v1",
trigger: { label: "Monthly on the 1st at 06:00", icon: Clock01Icon },
state: "paused",
lastRun: { status: "success", ago: "17 days ago", durationMs: 75_400 },
runs: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
owner: "Tom Garnier",
},
];
// The end of each row is the screen's: here the active switch and a menu. RunBars also stands alone.
export default function WithActions() {
const [rows, setRows] = useState(start);
return (
<div style={{ display: "grid", gap: 16, width: "100%", maxWidth: 980 }}>
<AutomationList
automations={rows}
onOpen={() => {}}
renderActions={(a) => (
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Switch
label={<span className="fg-sr">Active</span>}
checked={a.state === "active"}
onChange={(e) =>
setRows(
rows.map((r) =>
r.id === a.id ? { ...r, state: e.target.checked ? "active" : "paused" } : r,
),
)
}
/>
<IconButton icon={MoreHorizontalIcon} label={`Actions of ${a.name}`} size="sm" />
</span>
)}
/>
<RunBars
values={[12, 9, 14, 3, 2, 11, 16]}
errors={[0, 1, 0, 0, 0, 0, 2]}
width={140}
height={32}
label="Runs, last 7 days"
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
automations | { id, name, meta?, trigger: { label, icon }, state, lastRun?, runs?, errors?, owner? }[] | — | state is active, paused or draft; lastRun is { status, ago, durationMs? }; runs and errors are per day, oldest first. |
onOpen | (automation) => void | — | A row opens on click and Enter. |
columns | ("trigger" | "state" | "last" | "runs" | "owner")[] | all | The columns after the name, in order; fewer for a narrow place. |
renderActions | (automation) => ReactNode | — | The end of a row: a menu, a switch. Clicks there do not open the row. |
runsLabel | string | "Runs · 14 d" | Header of the bars. |
empty | ReactNode | — | Shown when there is no automation. |
className | string | — | Extra classes. |