Blocks / Audit log

Audit log

Who did what to which thing, by day. Refusals say so; detail folds open.

import { AuditLog } from "@forgeron/ui";
/01 → Default

Today · Nov 18

  1. Camille Roydeployedinvoices-sync 1.4
  2. crm-importreadcrm.leadsDenied

Yesterday · Nov 17

  1. Hugo Bernardinvitedlea@roy.fr
import { PackageIcon } from "@forgeron/icons";
import { AuditLog } from "@forgeron/ui";

export default function Default() {
  return (
    <div style={{ width: 400 }}>
      <AuditLog
        today="2026-11-18"
        events={[
          {
            id: "e3",
            at: "2026-11-18 09:42",
            actor: "Camille Roy",
            action: "deployed",
            target: "invoices-sync 1.4",
          },
          {
            id: "e2",
            at: "2026-11-18 09:15",
            actor: "crm-import",
            actorIcon: PackageIcon,
            action: "read",
            target: "crm.leads",
            outcome: "denied",
          },
          {
            id: "e1",
            at: "2026-11-17 17:03",
            actor: "Hugo Bernard",
            action: "invited",
            target: "lea@roy.fr",
          },
        ]}
      />
    </div>
  );
}
/02 → With detail

Today · Nov 18

  1. Camille Roygave the team Sales access tocrm-import
  2. Permission crm.leads.read is not granted to crm-import. Asked by Hugo Bernard.

Yesterday · Nov 17

  1. Léa Martinchanged the secretODOO_API_KEY

Nov 12

  1. Camille Royinstalledcrm-import 0.9
import { PackageIcon, ServerStack01Icon } from "@forgeron/icons";
import { AuditLog } from "@forgeron/ui";

// A row with detail is a button: it folds open under itself.
export default function WithDetail() {
  return (
    <div style={{ width: "100%" }}>
      <AuditLog
        today="2026-11-18"
        defaultExpanded={["e5"]}
        events={[
          {
            id: "e6",
            at: "2026-11-18 10:02",
            actor: "Camille Roy",
            action: "gave the team Sales access to",
            target: "crm-import",
          },
          {
            id: "e5",
            at: "2026-11-18 09:15",
            actor: "crm-import",
            actorIcon: PackageIcon,
            action: "read",
            target: "crm.leads",
            outcome: "denied",
            detail:
              "Permission crm.leads.read is not granted to crm-import. Asked by Hugo Bernard.",
          },
          {
            id: "e4",
            at: "2026-11-18 03:00",
            actor: "Scheduler",
            actorIcon: ServerStack01Icon,
            action: "ran",
            target: "carrier-rates nightly",
            outcome: "failed",
            detail: "Upstream answered 503 three times; next try at 04:00.",
          },
          {
            id: "e3",
            at: "2026-11-17 17:03",
            actor: "Hugo Bernard",
            action: "rolled back",
            target: "invoices-sync 1.3",
            detail: "From 1.4.0 to 1.3.2 on Production. Reason: invoices arrive twice.",
          },
          {
            id: "e2",
            at: "2026-11-17 16:40",
            actor: "Léa Martin",
            action: "changed the secret",
            target: "ODOO_API_KEY",
          },
          {
            id: "e1",
            at: "2026-11-12 11:20",
            actor: "Camille Roy",
            action: "installed",
            target: "crm-import 0.9",
          },
        ]}
      />
    </div>
  );
}
/03 → Empty
No event matches these filters
import { AuditLog } from "@forgeron/ui";

export default function Empty() {
  return (
    <div style={{ width: "100%", maxWidth: 520 }}>
      <AuditLog events={[]} empty="No event matches these filters" />
    </div>
  );
}
API → Props
PropTypeDefaultDescription
events{ id, at, actor, actorIcon?, action, target?, outcome?, detail? }[]—Newest first. at: YYYY-MM-DD HH:MM. outcome: ok, denied or failed.
todaystring—YYYY-MM-DD: its day and the one before read Today and Yesterday.
defaultExpandedstring[]—Rows open at first.
labelstring"Audit log"Its name.
emptyReactNode"Nothing happened yet"Shown when there is no event.
classNamestring—Extra classes.