mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 11:23:10 +02:00
feat(policies): backend-driven policy enforcement (frontend) (#6598)
## Summary Adds the **Policies** feature (proprietary, behind the `POLICIES_ENABLED` flag): backend-driven enforcement that runs a fixed tool pipeline on documents, docked in the right tool sidebar alongside Tools. ## Highlights - **Policy catalog** — 5 categories; **Security** is wired (redact PII + sanitize), the others are marked "Coming soon". - **Backend as source of truth** — policies persist via the Policies engine (`/api/v1/policies`), one policy per category, with a local cache + offline fallback. - **Auto-run** — enabled policies run on every uploaded file: dispatch → poll → import outputs into the workspace. - **Security redact config** — PII preset dropdown + custom word/regex entry + advanced options; tool params map to the backend endpoint fields. - **Activity feed** with retry on failures; **file badges** showing which policies ran on a file (sidebar + files page), tinted to the policy colour. - Reuses the **Watched Folders** engine for each policy's backing folder; policy-owned folders are filtered out of the Watched Folders UI. ## Notes - Gated by `POLICIES_ENABLED` (true in proprietary, false in core) — unreachable in the open-source build. - Frontend-only diff; depends on the backend Policies engine and the merged Watched Folders feature.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import type { ReactNode } from "react";
|
||||
import "@shared/components/ListRow.css";
|
||||
import type { StatusTone } from "@shared/components/StatusBadge";
|
||||
|
||||
export interface ListRowProps {
|
||||
/** Leading visual (icon/avatar), shown in a tone-tinted square. */
|
||||
leading?: ReactNode;
|
||||
/** Tint for the leading square. Defaults to neutral. */
|
||||
leadingTone?: StatusTone;
|
||||
/** Primary line. */
|
||||
title: ReactNode;
|
||||
/** Secondary line. */
|
||||
description?: ReactNode;
|
||||
/** Tertiary line (e.g. timestamp). */
|
||||
meta?: ReactNode;
|
||||
/** Right-aligned content (badge, chevron, action). */
|
||||
trailing?: ReactNode;
|
||||
/** Makes the whole row a button. */
|
||||
onClick?: () => void;
|
||||
/** Draw a top hairline — set on every row after the first inside a list. */
|
||||
divider?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single list row: a tone-tinted leading glyph + a title/description/meta
|
||||
* stack + an optional trailing slot. Compose a divided list by wrapping rows in
|
||||
* a {@code Card padding="none"} and setting {@code divider} on all but the first.
|
||||
*/
|
||||
export function ListRow({
|
||||
leading,
|
||||
leadingTone = "neutral",
|
||||
title,
|
||||
description,
|
||||
meta,
|
||||
trailing,
|
||||
onClick,
|
||||
divider,
|
||||
className,
|
||||
}: ListRowProps) {
|
||||
const classes = [
|
||||
"sui-listrow",
|
||||
divider ? "sui-listrow--divider" : "",
|
||||
onClick ? "sui-listrow--interactive" : "",
|
||||
className ?? "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
|
||||
const content = (
|
||||
<>
|
||||
{leading && (
|
||||
<span
|
||||
className="sui-listrow__leading"
|
||||
data-tone={leadingTone}
|
||||
aria-hidden
|
||||
>
|
||||
{leading}
|
||||
</span>
|
||||
)}
|
||||
<span className="sui-listrow__text">
|
||||
<span className="sui-listrow__title">{title}</span>
|
||||
{description && (
|
||||
<span className="sui-listrow__desc">{description}</span>
|
||||
)}
|
||||
{meta && <span className="sui-listrow__meta">{meta}</span>}
|
||||
</span>
|
||||
{trailing && <span className="sui-listrow__trailing">{trailing}</span>}
|
||||
</>
|
||||
);
|
||||
|
||||
return onClick ? (
|
||||
<button type="button" className={classes} onClick={onClick}>
|
||||
{content}
|
||||
</button>
|
||||
) : (
|
||||
<div className={classes}>{content}</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user