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:
@@ -1,6 +1,8 @@
|
||||
import type { ReactNode } from "react";
|
||||
import "@shared/components/NavItem.css";
|
||||
|
||||
export type NavItemAccent = "blue" | "purple" | "green" | "amber" | "red";
|
||||
|
||||
export interface NavItemProps {
|
||||
/** Stable view id passed to the click handler. */
|
||||
id: string;
|
||||
@@ -8,6 +10,11 @@ export interface NavItemProps {
|
||||
icon?: ReactNode;
|
||||
/** Show the active highlight (navActive background, navActiveText colour). */
|
||||
isActive?: boolean;
|
||||
/**
|
||||
* Optional status accent: draws a left edge bar in the tone colour and tints
|
||||
* the leading icon to match. For listing live/paused/etc. entities.
|
||||
*/
|
||||
accent?: NavItemAccent;
|
||||
/** Optional trailing badge (e.g. unread count, "new"). */
|
||||
trailing?: ReactNode;
|
||||
onClick?: (id: string) => void;
|
||||
@@ -19,13 +26,14 @@ export interface NavItemProps {
|
||||
*
|
||||
* Active styling: navActive background, navActiveText colour, weight 500.
|
||||
* Hover styling: navHover background, navHoverText colour (only when not
|
||||
* already active).
|
||||
* already active). An optional `accent` adds a status edge bar + icon tint.
|
||||
*/
|
||||
export function NavItem({
|
||||
id,
|
||||
label,
|
||||
icon,
|
||||
isActive,
|
||||
accent,
|
||||
trailing,
|
||||
onClick,
|
||||
className,
|
||||
@@ -34,9 +42,15 @@ export function NavItem({
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onClick?.(id)}
|
||||
className={["sui-navitem", isActive ? "is-active" : "", className ?? ""]
|
||||
className={[
|
||||
"sui-navitem",
|
||||
isActive ? "is-active" : "",
|
||||
accent ? "sui-navitem--accent" : "",
|
||||
className ?? "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ")}
|
||||
data-accent={accent}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
>
|
||||
{icon && (
|
||||
|
||||
Reference in New Issue
Block a user