#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Portal policies: SUI setup forms fixes and improvements (#6927)
Reece Browne51d3d27fd34f
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.tomlindex 11193c3ed3..af5ed16169 100644--- a/frontend/editor/public/locales/en-US/translation.toml+++ b/frontend/editor/public/locales/en-US/translation.toml@@ -7404,7 +7404,7 @@ subtitle = "Standing automations that enforce a tool pipeline on every document.title = "Policies"[portal.policies.card]-comingSoon = "Coming soon"+comingSoon = "Upgrade to Enterprise"notSetUp = "Not set up"[portal.policies.categories.compliance]@@ -7566,14 +7566,29 @@ continue = "Continue"enablePolicy = "Enable policy"saveChanges = "Save changes"-[portal.policies.wizard.docTypes]-allDescription = "Set up an Ingestion (classification) policy to narrow this to specific document types."-allTitle = "All document types"-clear = "Clear"-heading = "Document types"-narrow = "Narrow"-selected_one = "{{count}} selected"-selected_other = "{{count}} selected"+[portal.policies.wizard.capability.compress]+desc = "Compresses the document to a smaller file size."+label = "Reduce file size"++[portal.policies.wizard.capability.flatten]+desc = "Merges form fields and annotations into the page so they can't be edited."+label = "Flatten the document"++[portal.policies.wizard.capability.ocr]+desc = "Runs OCR so scanned pages become selectable, searchable text."+label = "Make text searchable"++[portal.policies.wizard.capability.redact]+desc = "Finds and blacks out sensitive details — like Social Security and card numbers — so they can't be read."+label = "Redact sensitive information"++[portal.policies.wizard.capability.sanitize]+desc = "Removes hidden JavaScript so nothing can run automatically when the document is opened."+label = "Strip active content"++[portal.policies.wizard.capability.watermark]+desc = "Stamps a visible mark (e.g. “Confidential”) across every page."+label = "Apply a watermark"[portal.policies.wizard.errors]noTools = "Enable at least one tool in the workflow first."@@ -7594,11 +7609,6 @@ label = "Output as"newFile = "New file"newVersion = "New version"-[portal.policies.wizard.output.retries]-delayLabel = "Retry delay (min)"-heading = "Retries"-maxLabel = "Max retries"-[portal.policies.wizard.output.runOn]export = "Export"helper = "When the policy fires: on upload, or before export."@@ -7609,22 +7619,20 @@ upload = "Upload"heading = "Settings"[portal.policies.wizard.sources]-emptyDescription = "Connect a source on the Sources page first, then attach it to a policy here."-emptyTitle = "No sources available"heading = "Sources"loading = "Loading sources…"[portal.policies.wizard.tabs]ariaLabel = "Setup steps"settings = "Settings"-workflow = "Workflow"+workflow = "Actions"[portal.policies.wizard.title]edit = "Edit {{category}} policy"setUp = "Set up {{category}} policy"[portal.policies.wizard.workflow]-description = "The sequence of tools this policy runs on each document. Each tool is a Stirling endpoint; toggle the ones this policy should enforce."+description = "Choose what this policy does to every document it processes."[portal.policySummary]activeSummary = "{{active}} / {{total}} active"@@ -7633,7 +7641,7 @@ subtitle = "Standing automations every document passes through, regardless of whtitle = "What runs on your PDFs"[portal.policySummary.action]-comingSoon = "Coming soon"+comingSoon = "Upgrade to Enterprise"configure = "Configure"setUp = "Set up"diff --git a/frontend/editor/src/core/components/tools/addWatermark/AddWatermarkSingleStepSettings.tsx b/frontend/editor/src/core/components/tools/addWatermark/AddWatermarkSingleStepSettings.tsxindex b78ab666ba..1d7859f7e4 100644--- a/frontend/editor/src/core/components/tools/addWatermark/AddWatermarkSingleStepSettings.tsx+++ b/frontend/editor/src/core/components/tools/addWatermark/AddWatermarkSingleStepSettings.tsx@@ -23,6 +23,8 @@ interface AddWatermarkSingleStepSettingsProps {disabled?: boolean;/** When false, hide the "Flatten PDF pages to images" option (e.g. in policies). */showFlatten?: boolean;+ /** When true, lock to text watermarks: hide the type selector and image option (e.g. in policies). */+ textOnly?: boolean;}const AddWatermarkSingleStepSettings = ({@@ -30,20 +32,24 @@ const AddWatermarkSingleStepSettings = ({onParameterChange,disabled = false,showFlatten = true,+ textOnly = false,}: AddWatermarkSingleStepSettingsProps) => {+ const isText = textOnly || parameters.watermarkType === "text";+ const isImage = !textOnly && parameters.watermarkType === "image";return (<Stack gap="lg">- {/* Watermark Type Selection */}- <WatermarkTypeSettings- watermarkType={parameters.watermarkType}- onWatermarkTypeChange={(type) =>- onParameterChange("watermarkType", type)- }- disabled={disabled}- />+ {/* Watermark type selection — hidden when locked to text. */}+ {!textOnly && (+ <WatermarkTypeSettings+ watermarkType={parameters.watermarkType}+ onWatermarkTypeChange={(type) =>+ onParameterChange("watermarkType", type)+ }+ disabled={disabled}+ />+ )}- {/* Conditional settings based on watermark type */}- {parameters.watermarkType === "text" && (+ {isText && (<><WatermarkWordingparameters={parameters}@@ -58,7 +64,7 @@ const AddWatermarkSingleStepSettings = ({</>)}- {parameters.watermarkType === "image" && (+ {isImage && (<WatermarkImageFileparameters={parameters}onParameterChange={onParameterChange}@@ -67,7 +73,7 @@ const AddWatermarkSingleStepSettings = ({)}{/* Formatting settings for both text and image */}- {parameters.watermarkType && (+ {(textOnly || parameters.watermarkType) && (<WatermarkFormattingparameters={parameters}onParameterChange={onParameterChange}diff --git a/frontend/editor/src/portal/PortalApp.tsx b/frontend/editor/src/portal/PortalApp.tsxindex d1acc012ed..1aa7da3535 100644--- a/frontend/editor/src/portal/PortalApp.tsx+++ b/frontend/editor/src/portal/PortalApp.tsx@@ -3,6 +3,7 @@ import { PortalAuthBoundary } from "@portal/auth/PortalAuthBoundary";import { ThemeProvider, useTheme } from "@portal/contexts/ThemeContext";import { SuiProvider } from "@portal/theme/SuiProvider";import { PortalProviders } from "@portal/PortalProviders";+import { ToolRegistryProvider } from "@app/contexts/ToolRegistryProvider";// Reset + typography, scoped to .portal-scope below.import "@portal/theme/base.css";@@ -32,9 +33,13 @@ export function PortalApp() {<ThemedSuiProvider>{/* Scopes base.css to the portal so it doesn't restyle the host editor. */}<div className="portal-scope">- <PortalAuthBoundary>- <PortalProviders />- </PortalAuthBoundary>+ {/* Tool registry is read by portal views (e.g. the policy setup+ wizard); mount it above the per-flavor provider split. */}+ <ToolRegistryProvider>+ <PortalAuthBoundary>+ <PortalProviders />+ </PortalAuthBoundary>+ </ToolRegistryProvider></div></ThemedSuiProvider></ThemeProvider>diff --git a/frontend/editor/src/portal/components/policies/PolicySetupWizard.stories.tsx b/frontend/editor/src/portal/components/policies/PolicySetupWizard.stories.tsxindex 275a8c9d15..01aaad2fc6 100644--- a/frontend/editor/src/portal/components/policies/PolicySetupWizard.stories.tsx+++ b/frontend/editor/src/portal/components/policies/PolicySetupWizard.stories.tsx@@ -1,4 +1,5 @@import type { Meta, StoryObj } from "@storybook/react-vite";+import { ToolRegistryProvider } from "@app/contexts/ToolRegistryProvider";import {POLICY_CATEGORIES,POLICY_CONFIG,@@ -12,6 +13,15 @@ const meta: Meta<typeof PolicySetupWizard> = {title: "Portal/Policies/PolicySetupWizard",component: PolicySetupWizard,parameters: { layout: "fullscreen" },+ // The wizard reads the tool registry (for capability fallback names/icons),+ // so stories must supply the provider the app mounts in PortalApp.+ decorators: [+ (Story) => (+ <ToolRegistryProvider>+ <Story />+ </ToolRegistryProvider>+ ),+ ],args: {onClose: () => {},onSubmit: async () => {},diff --git a/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx b/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsxindex 97be4925bc..e87d25dc9e 100644--- a/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx+++ b/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx@@ -4,7 +4,6 @@ import {Banner,Button,Card,- Chip,FormField,Input,Modal,@@ -12,18 +11,23 @@ import {Tabs,ToggleSwitch,} from "@app/ui";+import { SettingsRow } from "@app/ui/SettingsRow";import {- POLICY_DOC_TYPES,+ TOOL_ENDPOINTS,humanizeEndpoint,type CatalogueEntry,type PipelineStep,type PolicySetupResult,} from "@portal/api/policies";+import type { ToolRegistryEntry } from "@app/data/toolsTaxonomy";import { fetchSources } from "@portal/api/sources";import { useAsync } from "@portal/hooks/useAsync";import { PolicyFieldRow } from "@portal/components/policies/PolicyFieldRow";import { policyIcon } from "@portal/components/policies/policyIcons";import { sourceTypeMeta } from "@portal/components/sources/sourceTypes";+import { useToolRegistry } from "@app/contexts/ToolRegistryContext";+import { PolicyRedactConfig } from "@app/components/policies/PolicyRedactConfig";+import { PolicyWatermarkConfig } from "@app/components/policies/PolicyWatermarkConfig";import "@portal/views/Policies.css";interface PolicySetupWizardProps {@@ -65,6 +69,58 @@ function resolveFieldValues(// the portal and can drive this via registry metadata or a defaultEnabled flag.const DISABLED_BY_DEFAULT = new Set(["/api/v1/security/add-watermark"]);+/**+ * Policy-facing framing for each capability a policy can include. Labels and+ * descriptions describe what the policy DOES to a document — deliberately not+ * naming the underlying tool — so the setup reads as the policy's own settings+ * rather than an assembled chain of tools. Endpoints with no entry fall back to+ * the humanised endpoint name with no description.+ */+const CAPABILITY_META: Record<+ string,+ { labelKey: string; labelEn: string; descKey: string; descEn: string }+> = {+ [TOOL_ENDPOINTS.redact]: {+ labelKey: "portal.policies.wizard.capability.redact.label",+ labelEn: "Redact sensitive information",+ descKey: "portal.policies.wizard.capability.redact.desc",+ descEn:+ "Finds and blacks out sensitive details — like Social Security and card numbers — so they can't be read.",+ },+ [TOOL_ENDPOINTS.sanitize]: {+ labelKey: "portal.policies.wizard.capability.sanitize.label",+ labelEn: "Strip active content",+ descKey: "portal.policies.wizard.capability.sanitize.desc",+ descEn:+ "Removes hidden JavaScript so nothing can run automatically when the document is opened.",+ },+ [TOOL_ENDPOINTS.watermark]: {+ labelKey: "portal.policies.wizard.capability.watermark.label",+ labelEn: "Apply a watermark",+ descKey: "portal.policies.wizard.capability.watermark.desc",+ descEn: "Stamps a visible mark (e.g. “Confidential”) across every page.",+ },+ [TOOL_ENDPOINTS.ocr]: {+ labelKey: "portal.policies.wizard.capability.ocr.label",+ labelEn: "Make text searchable",+ descKey: "portal.policies.wizard.capability.ocr.desc",+ descEn: "Runs OCR so scanned pages become selectable, searchable text.",+ },+ [TOOL_ENDPOINTS.flatten]: {+ labelKey: "portal.policies.wizard.capability.flatten.label",+ labelEn: "Flatten the document",+ descKey: "portal.policies.wizard.capability.flatten.desc",+ descEn:+ "Merges form fields and annotations into the page so they can't be edited.",+ },+ [TOOL_ENDPOINTS.compress]: {+ labelKey: "portal.policies.wizard.capability.compress.label",+ labelEn: "Reduce file size",+ descKey: "portal.policies.wizard.capability.compress.desc",+ descEn: "Compresses the document to a smaller file size.",+ },+};+function seedTools(entry: CatalogueEntry): ToolState[] {const savedSteps = entry.policy?.steps ?? [];const savedByOp = new Map(savedSteps.map((s) => [s.operation, s]));@@ -117,6 +173,19 @@ function PolicySetupWizardBody({onSubmit: (entry: CatalogueEntry, result: PolicySetupResult) => Promise<void>;}) {const { t } = useTranslation();+ const { allTools: toolRegistry } = useToolRegistry();++ // Portal tool operations are endpoint paths (/api/v1/…), not short registry IDs.+ // Build a reverse map so we can look up icons and display names by endpoint.+ const registryByEndpoint = useMemo(() => {+ const map = new Map<string, ToolRegistryEntry>();+ for (const entry of Object.values(toolRegistry)) {+ const ep = (entry as ToolRegistryEntry).operationConfig?.endpoint;+ if (typeof ep === "string") map.set(ep, entry as ToolRegistryEntry);+ }+ return map;+ }, [toolRegistry]);+const { category, config, policy } = entry;const isEdit = policy != null;@@ -146,12 +215,9 @@ function PolicySetupWizardBody({};return [editorSource, ...backendSources];}, [sourcesAsync.data, t]);- const [scopeNarrow, setScopeNarrow] = useState(- (policy?.state.scopeTypes.length ?? 0) > 0,- );- const [scopeTypes, setScopeTypes] = useState<string[]>(- policy?.state.scopeTypes ?? [],- );+ // Document-type scoping has no UI; preserve any saved scope on edit and+ // default new policies to all document types.+ const [scopeTypes] = useState<string[]>(policy?.state.scopeTypes ?? []);// TODO: replace with user-picker backed by GET /api/v1/user/users (UserSummary[]).// Store username (which is the email in Spring Security) as reviewerEmail.// See UserSelector.tsx in the editor for the grouping/display pattern.@@ -166,10 +232,10 @@ function PolicySetupWizardBody({const [runOn, setRunOn] = useState<"upload" | "export">(policy?.state.runOn ?? "upload",);- const [maxRetries, setMaxRetries] = useState(policy?.state.maxRetries ?? 3);- const [retryDelayMinutes, setRetryDelayMinutes] = useState(- policy?.state.retryDelayMinutes ?? 5,- );+ // Policies run once; retry config has no UI. Preserve any saved values on+ // edit and default new policies to no retries (run once).+ const [maxRetries] = useState(policy?.state.maxRetries ?? 0);+ const [retryDelayMinutes] = useState(policy?.state.retryDelayMinutes ?? 0);const [submitting, setSubmitting] = useState(false);const [error, setError] = useState<string | null>(null);@@ -188,12 +254,6 @@ function PolicySetupWizardBody({);}- function toggleScopeType(dt: string) {- setScopeTypes((prev) =>- prev.includes(dt) ? prev.filter((d) => d !== dt) : [...prev, dt],- );- }-async function submit() {if (submitting) return;if (enabledTools.length === 0) {@@ -211,7 +271,7 @@ function PolicySetupWizardBody({await onSubmit(entry, {fieldValues,sources,- scopeTypes: scopeNarrow ? scopeTypes : [],+ scopeTypes,reviewerEmail,outputMode,outputName: outputName.trim(),@@ -227,8 +287,6 @@ function PolicySetupWizardBody({}}- const docTypesEnabled = category.providesClassification === true;-return (<Modalopen@@ -304,26 +362,70 @@ function PolicySetupWizardBody({{step === "workflow" && (<div className="portal-policies__wizard-section"><p className="portal-policies__wizard-desc">- {t("portal.policies.wizard.workflow.description")}+ {t(+ "portal.policies.wizard.workflow.description",+ "Choose what this policy does to every document it processes.",+ )}</p>- {tools.map((tl) => (- <Card key={tl.operation} padding="tight">- <div className="portal-policies__tool-head">- <span className="portal-policies__tool-name">- {humanizeEndpoint(tl.operation, t)}- </span>- <span style={{ flex: 1 }} />- <ToggleSwitch- size="sm"- checked={tl.enabled}- onChange={(checked) =>- patchTool(tl.operation, { enabled: checked })- }- label=""- />- </div>- </Card>- ))}+ <Card padding="none">+ <div className="portal-policies__capabilities">+ {tools.map((tl) => {+ const meta = CAPABILITY_META[tl.operation];+ const label = meta+ ? t(meta.labelKey, meta.labelEn)+ : (registryByEndpoint.get(tl.operation)?.name ??+ humanizeEndpoint(tl.operation, t));+ const description = meta+ ? t(meta.descKey, meta.descEn)+ : undefined;+ const hasConfig =+ tl.operation === TOOL_ENDPOINTS.redact ||+ tl.operation === TOOL_ENDPOINTS.watermark;+ return (+ <div+ key={tl.operation}+ className="portal-policies__capability"+ data-on={tl.enabled || undefined}+ >+ <SettingsRow+ label={label}+ description={description}+ control={+ <ToggleSwitch+ size="sm"+ checked={tl.enabled}+ onChange={(checked) =>+ patchTool(tl.operation, { enabled: checked })+ }+ label=""+ />+ }+ />+ {tl.enabled && hasConfig && (+ <div className="portal-policies__capability-config">+ {tl.operation === TOOL_ENDPOINTS.redact && (+ <PolicyRedactConfig+ parameters={tl.parameters}+ onChange={(parameters) =>+ patchTool(tl.operation, { parameters })+ }+ />+ )}+ {tl.operation === TOOL_ENDPOINTS.watermark && (+ <PolicyWatermarkConfig+ parameters={tl.parameters}+ onChange={(parameters) =>+ patchTool(tl.operation, { parameters })+ }+ />+ )}+ </div>+ )}+ </div>+ );+ })}+ </div>+ </Card></div>)}@@ -352,25 +454,23 @@ function PolicySetupWizardBody({<h3 className="portal-policies__wizard-heading">{t("portal.policies.wizard.sources.heading")}</h3>- <div className="portal-policies__sources">- {sourcesAsync.loading && !sourcesAsync.data ? (- <p className="portal-policies__sources-loading">- {t("portal.policies.wizard.sources.loading")}- </p>- ) : availableSources.length === 1 ? (- <Banner- tone="neutral"- title={t("portal.policies.wizard.sources.emptyTitle")}- description={t(- "portal.policies.wizard.sources.emptyDescription",- )}- />- ) : (- availableSources.map((src) => (+ {sourcesAsync.loading && !sourcesAsync.data ? (+ <p className="portal-policies__sources-loading">+ {t("portal.policies.wizard.sources.loading")}+ </p>+ ) : (+ // The editor is always an available source (unconditionally prepended+ // to availableSources), so the list is never empty — no "no sources"+ // state exists.+ <div className="portal-policies__sources">+ {availableSources.map((src) => (+ // A selectable multi-line tile (icon + name + type + check).+ // Uses the shared Button (raw <button> is lint-banned); the tile+ // CSS overrides the Button's fixed height for the two-line layout.<Buttonkey={src.id}- type="button"variant="quiet"+ justify="start"className={"portal-policies__source" +(sources.includes(src.id)@@ -391,55 +491,8 @@ function PolicySetupWizardBody({</span></span></Button>- ))- )}- </div>-- <h3 className="portal-policies__wizard-heading">- {t("portal.policies.wizard.docTypes.heading")}- </h3>- {!docTypesEnabled ? (- <Banner- tone="neutral"- title={t("portal.policies.wizard.docTypes.allTitle")}- description={t("portal.policies.wizard.docTypes.allDescription")}- />- ) : (- <Card padding="tight">- <div className="portal-policies__doctypes-head">- <span>- {scopeTypes.length === 0- ? t("portal.policies.wizard.docTypes.allTitle")- : t("portal.policies.wizard.docTypes.selected", {- count: scopeTypes.length,- })}- </span>- <Button- type="button"- variant="quiet"- className="portal-policies__link"- onClick={() => setScopeNarrow((v) => !v)}- >- {scopeNarrow- ? t("portal.policies.wizard.docTypes.clear")- : t("portal.policies.wizard.docTypes.narrow")}- </Button>- </div>- {scopeNarrow && (- <div className="portal-policies__doctypes">- {POLICY_DOC_TYPES.map((dt) => (- <Chip- key={dt}- accent={scopeTypes.includes(dt) ? "default" : "neutral"}- size="sm"- onClick={() => toggleScopeType(dt)}- >- {t(`policies.docType.${dt}`, dt)}- </Chip>- ))}- </div>- )}- </Card>+ ))}+ </div>)}<h3 className="portal-policies__wizard-heading">@@ -560,33 +613,6 @@ function PolicySetupWizardBody({</>)}{/* TODO: reviewer user-picker goes here */}- <h4 className="portal-policies__wizard-subheading">- {t("portal.policies.wizard.output.retries.heading")}- </h4>- <FormField- label={t("portal.policies.wizard.output.retries.maxLabel")}- >- <Input- inputSize="sm"- type="number"- value={String(maxRetries)}- onChange={(e) =>- setMaxRetries(Math.max(0, Number(e.target.value) || 0))- }- />- </FormField>- <FormField- label={t("portal.policies.wizard.output.retries.delayLabel")}- >- <Input- inputSize="sm"- type="number"- value={String(retryDelayMinutes)}- onChange={(e) =>- setRetryDelayMinutes(Math.max(0, Number(e.target.value) || 0))- }- />- </FormField></div></div>)}diff --git a/frontend/editor/src/portal/views/Policies.css b/frontend/editor/src/portal/views/Policies.cssindex 6bad9365c5..75adbc6a85 100644--- a/frontend/editor/src/portal/views/Policies.css+++ b/frontend/editor/src/portal/views/Policies.css@@ -225,13 +225,6 @@font-weight: 600;}-.portal-policies__wizard-subheading {- margin: 0.875rem 0 0;- font-size: 0.75rem;- font-weight: 600;- color: var(--color-text-3);-}-.portal-policies__fields {display: flex;flex-direction: column;@@ -248,17 +241,28 @@gap: 0.375rem;}-/* Workflow step — tool rows */-.portal-policies__tool-head {+/* Workflow step — policy capability settings list.+ * Rows read as the policy's own settings (label + plain description + toggle),+ * not a chain of distinct tools. Config reveals inline beneath an enabled row. */+.portal-policies__capabilities {display: flex;- align-items: center;- gap: 0.625rem;+ flex-direction: column;}-.portal-policies__tool-name {- font-size: 0.8125rem;- font-weight: 600;- color: var(--color-text-1);+.portal-policies__capability {+ padding: 0.75rem 0.875rem;+}++.portal-policies__capability + .portal-policies__capability {+ border-top: 1px solid var(--color-border);+}++/* An enabled row with config gets a faint tint so the revealed settings read as+ * belonging to it. */+.portal-policies__capability[data-on] .portal-policies__capability-config {+ border-top: 1px dashed var(--color-border);+ padding-top: 0.75rem;+ margin-top: 0.75rem;}/* Sources picker */@@ -284,11 +288,32 @@border: 1.5px solid var(--color-border);border-radius: var(--radius-md);cursor: pointer;+ /* Shared Button pins a fixed control height and natural width; this tile is a+ full-width, two-line card, so fill the grid cell and grow to fit content. */+ width: 100%;+ height: auto;+ font-weight: inherit;transition:border-color var(--motion-fast),background var(--motion-fast);}+/* The shared Button wraps children in an inner/label node. Let the inner grow+ (so the ::after check sits at the far right) and the label carry the+ icon + two-line-text row. */+.portal-policies__source .mantine-Button-inner {+ flex: 1;+ min-width: 0;+}++.portal-policies__source .mantine-Button-label {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ width: 100%;+ white-space: normal;+}+.portal-policies__source::after {content: "";display: flex;@@ -353,22 +378,6 @@line-height: 1.4;}-/* Doc-type scope */-.portal-policies__doctypes-head {- display: flex;- align-items: center;- justify-content: space-between;- font-size: 0.8125rem;- color: var(--color-text-2);-}--.portal-policies__doctypes {- display: flex;- flex-wrap: wrap;- gap: 0.375rem;- margin-top: 0.625rem;-}-.portal-policies__link {border: none;background: none;diff --git a/frontend/editor/src/proprietary/components/policies/Policies.css b/frontend/editor/src/proprietary/components/policies/Policies.cssindex 9c4683f0ac..feb698a644 100644--- a/frontend/editor/src/proprietary/components/policies/Policies.css+++ b/frontend/editor/src/proprietary/components/policies/Policies.css@@ -90,24 +90,8 @@outline: 2px solid var(--color-blue);outline-offset: -2px;}-/* Policy icons are colourless at rest; hovering or focusing the row reveals the- category colour (blue/purple/green/amber/red — see ROW_ACCENT). The accent- class sets --ib-base; we neutralise --ib-accent here and restore it on hover. */-.pol-row .sui-iconbadge {- --ib-accent: var(--color-text-3);- transition:- color var(--motion-fast),- background var(--motion-fast);-}-.pol-row:hover .sui-iconbadge,-.pol-row:focus-visible .sui-iconbadge {- --ib-accent: var(--ib-base);-}-/* Processing indicator: a spinning ring around the category icon while the- policy has runs in flight. The ring carries the category accent; the badge- also shows its colour (not the neutral rest tint) so an active policy reads- clearly even before hover. */+ policy has runs in flight. */.pol-row-icon {position: relative;display: inline-flex;diff --git a/frontend/editor/src/proprietary/components/policies/PolicyPiiField.tsx b/frontend/editor/src/proprietary/components/policies/PolicyPiiField.tsxindex d9fef2361d..59fe76c021 100644--- a/frontend/editor/src/proprietary/components/policies/PolicyPiiField.tsx+++ b/frontend/editor/src/proprietary/components/policies/PolicyPiiField.tsx@@ -1,4 +1,4 @@-import { MultiSelect } from "@mantine/core";+import { MultiSelect } from "@app/ui/MultiSelect";import { useTranslation } from "react-i18next";import { PII_PRESETS } from "@app/data/policyDefinitions";@@ -49,8 +49,8 @@ export function PolicyPiiField({return (<MultiSelect- size="sm"- label={t("policies.pii.fieldLabel", "PII to redact")}+ inputSize="sm"+ aria-label={t("policies.pii.fieldLabel", "PII to redact")}placeholder={t("policies.pii.placeholder", "Select PII types")}data={PII_PRESETS.map((p) => ({value: p.value,@@ -62,7 +62,6 @@ export function PolicyPiiField({onChange={handleChange}disabled={disabled}clearable- checkIconPosition="right"/>);}diff --git a/frontend/editor/src/proprietary/components/policies/PolicyWatermarkConfig.tsx b/frontend/editor/src/proprietary/components/policies/PolicyWatermarkConfig.tsxindex 692508a92e..8697c9d030 100644--- a/frontend/editor/src/proprietary/components/policies/PolicyWatermarkConfig.tsx+++ b/frontend/editor/src/proprietary/components/policies/PolicyWatermarkConfig.tsx@@ -9,10 +9,10 @@ interface PolicyWatermarkConfigProps {}/**- * Watermark configuration for a policy: the full watermark settings minus the- * "Flatten PDF pages to images" toggle (hidden), with flatten forced on so the- * watermark is baked into the page and can't be stripped out. Normalised once- * on mount.+ * Watermark configuration for a policy: text watermarks only (the type selector+ * and image option are hidden), minus the "Flatten PDF pages to images" toggle+ * (hidden), with flatten forced on so the watermark is baked into the page and+ * can't be stripped out. Normalised once on mount.*/export function PolicyWatermarkConfig({parameters,@@ -20,9 +20,11 @@ export function PolicyWatermarkConfig({disabled,}: PolicyWatermarkConfigProps) {useEffect(() => {- if (parameters.convertPDFToImage !== true) {- onChange({ ...parameters, convertPDFToImage: true });- }+ const patch: Record<string, unknown> = {};+ if (parameters.convertPDFToImage !== true) patch.convertPDFToImage = true;+ // Policies only support text watermarks.+ if (parameters.watermarkType !== "text") patch.watermarkType = "text";+ if (Object.keys(patch).length > 0) onChange({ ...parameters, ...patch });}, []);return (@@ -33,6 +35,7 @@ export function PolicyWatermarkConfig({}disabled={disabled}showFlatten={false}+ textOnly/>);}diff --git a/frontend/editor/src/proprietary/components/policies/policyStatus.ts b/frontend/editor/src/proprietary/components/policies/policyStatus.tsindex 5fbd779725..ada31ad11b 100644--- a/frontend/editor/src/proprietary/components/policies/policyStatus.ts+++ b/frontend/editor/src/proprietary/components/policies/policyStatus.ts@@ -17,10 +17,19 @@ export const STATUS_LABEL: Record<PolicyRowStatus, string> = {setup: "Set up",};-/**- * Per-category accent colour- */+/** Per-category icon accent — neutral (no tint background) across all categories. */export const ROW_ACCENT: Record<string, IconBadgeAccent> = {+ ingestion: "neutral",+ security: "neutral",+ compliance: "neutral",+ routing: "neutral",+ retention: "neutral",+};++/** Per-category colour for the file badges + enforcement overlay. Separate from+ * ROW_ACCENT: the sidebar rows render neutral by design, but the badges keep+ * their identity colours so files remain distinguishable at a glance. */+const BADGE_ACCENT: Record<string, string> = {ingestion: "blue",classification: "orange",security: "purple",@@ -30,15 +39,9 @@ export const ROW_ACCENT: Record<string, IconBadgeAccent> = {};/**- * CSS colour var for a policy category's accent (blue for unknown categories) —- * the tint used by the file badges and the enforcement overlay.- *- * Derived straight from the accent name (`--color-<accent>`), which is exactly- * the token {@link IconBadge} uses for the same accent. Deriving it (rather than- * keeping a second name→var map) means the badge tint can never drift from the- * sidebar's colour — previously `orange` was missing from that map, so the- * Classification badge/overlay rendered untinted while its sidebar row was orange.+ * CSS colour var for a policy category's badge accent (blue for unknown+ * categories) — the tint used by the file badges and the enforcement overlay.*/export function policyAccentVar(categoryId: string): string {- return `var(--color-${ROW_ACCENT[categoryId] ?? "blue"})`;+ return `var(--color-${BADGE_ACCENT[categoryId] ?? "blue"})`;}