Centralize policy table and policy section components in core WebUI #228

Closed
opened 2026-07-09 18:41:42 +02:00 by zemion · 1 comment
Owner

Context

Policy editor screens now share a visual language but still carry local table/row markup and slightly divergent behavior. Consolidate the common shell into core WebUI components while leaving domain-specific policy calculation in the owning modules.

Current call sites found by scan

  • govoplan-core/webui/src/features/privacy/RetentionPolicyManagement.tsx
    • Inline retention policy section/table markup with retention-policy-table policy-table, effective column, lower-level override column, FieldLabel help for concrete source path, field locking, and retention-specific controls.
  • govoplan-mail/webui/src/features/mail/MailProfileManagement.tsx
    • Local MailPolicyTable and MailPolicyRow components with showEffectiveColumn, showAllowColumn, settingLabel, effectiveHelp, and allowControl.
  • govoplan-campaign/webui/src/features/campaigns/GlobalSettingsPage.tsx
    • Local PolicyTable, PolicyRow, and PolicySelectControl for campaign behavior policy rows.
  • govoplan-files/webui/src/features/files/FileConnectorSettingsPanel.tsx
    • Connector policy uses form-grid textareas plus allow-override toggles; it should be evaluated for the same shared section/row layout once the basic policy table API exists.

Proposed core API shape

  • PolicySection
    • Props: title, summary, description, actions, children, className.
    • Should standardize spacing currently done by .policy-section and module-specific section wrappers.
  • PolicyTable
    • Props: settingLabel, policyLabel, effectiveLabel, lowerLevelLabel, showEffectiveColumn, showAllowColumn, className, children.
    • Should emit shared .policy-table, .policy-row, .policy-row-header structure and accept module-specific className only as an extension.
  • PolicyRow
    • Props: label, help, note, lockedNote, control, effective, effectiveHelp, allowControl, className.
    • Must support FieldLabel in both the main and effective columns.
    • Must support rows without effective/allow columns.
  • Optional helper: PolicyEffectiveValue
    • Wraps effective values with FieldLabel and source-path help.

Acceptance criteria

  • Core exports shared policy components and shared CSS remains in core.
  • Retention and mail policy editors use the shared components first; campaign policy table follows if the shape fits without adding complexity.
  • File connector policy is explicitly evaluated: either migrated or left with a note explaining why the textarea matrix is not a table row fit yet.
  • Preserve policy provenance help text and effective-column behavior.
  • Build and module permutation tests pass.
## Context Policy editor screens now share a visual language but still carry local table/row markup and slightly divergent behavior. Consolidate the common shell into core WebUI components while leaving domain-specific policy calculation in the owning modules. ## Current call sites found by scan - `govoplan-core/webui/src/features/privacy/RetentionPolicyManagement.tsx` - Inline retention policy section/table markup with `retention-policy-table policy-table`, effective column, lower-level override column, `FieldLabel` help for concrete source path, field locking, and retention-specific controls. - `govoplan-mail/webui/src/features/mail/MailProfileManagement.tsx` - Local `MailPolicyTable` and `MailPolicyRow` components with `showEffectiveColumn`, `showAllowColumn`, `settingLabel`, `effectiveHelp`, and `allowControl`. - `govoplan-campaign/webui/src/features/campaigns/GlobalSettingsPage.tsx` - Local `PolicyTable`, `PolicyRow`, and `PolicySelectControl` for campaign behavior policy rows. - `govoplan-files/webui/src/features/files/FileConnectorSettingsPanel.tsx` - Connector policy uses form-grid textareas plus allow-override toggles; it should be evaluated for the same shared section/row layout once the basic policy table API exists. ## Proposed core API shape - `PolicySection` - Props: `title`, `summary`, `description`, `actions`, `children`, `className`. - Should standardize spacing currently done by `.policy-section` and module-specific section wrappers. - `PolicyTable` - Props: `settingLabel`, `policyLabel`, `effectiveLabel`, `lowerLevelLabel`, `showEffectiveColumn`, `showAllowColumn`, `className`, `children`. - Should emit shared `.policy-table`, `.policy-row`, `.policy-row-header` structure and accept module-specific className only as an extension. - `PolicyRow` - Props: `label`, `help`, `note`, `lockedNote`, `control`, `effective`, `effectiveHelp`, `allowControl`, `className`. - Must support `FieldLabel` in both the main and effective columns. - Must support rows without effective/allow columns. - Optional helper: `PolicyEffectiveValue` - Wraps effective values with `FieldLabel` and source-path help. ## Acceptance criteria - Core exports shared policy components and shared CSS remains in core. - Retention and mail policy editors use the shared components first; campaign policy table follows if the shape fits without adding complexity. - File connector policy is explicitly evaluated: either migrated or left with a note explaining why the textarea matrix is not a table row fit yet. - Preserve policy provenance help text and effective-column behavior. - Build and module permutation tests pass. <!-- codex-fingerprint: shared-policy-table-components-2026-07-09 -->
Author
Owner

Codex State: done

Summary

  • Added shared core PolicySection, PolicyTable, and PolicyRow components with configurable labels, effective column, lower-level override column, and policy help text support.
  • Replaced local policy table wrappers/usages in retention policy, mail profile policy, and campaign policy screens with the shared component.

Changed Files

  • webui/src/components/PolicyTable.tsx
  • webui/src/index.ts
  • webui/src/features/privacy/RetentionPolicyManagement.tsx
  • /mnt/DATA/git/govoplan-mail/webui/src/features/mail/MailProfileManagement.tsx
  • /mnt/DATA/git/govoplan-campaign/webui/src/features/campaigns/GlobalSettingsPage.tsx

Verification

  • npm run build passed in govoplan-core/webui
  • bash scripts/check-focused.sh passed
## Codex State: done ### Summary - Added shared core PolicySection, PolicyTable, and PolicyRow components with configurable labels, effective column, lower-level override column, and policy help text support. - Replaced local policy table wrappers/usages in retention policy, mail profile policy, and campaign policy screens with the shared component. ### Changed Files - `webui/src/components/PolicyTable.tsx` - `webui/src/index.ts` - `webui/src/features/privacy/RetentionPolicyManagement.tsx` - `/mnt/DATA/git/govoplan-mail/webui/src/features/mail/MailProfileManagement.tsx` - `/mnt/DATA/git/govoplan-campaign/webui/src/features/campaigns/GlobalSettingsPage.tsx` ### Verification - `npm run build passed in govoplan-core/webui` - `bash scripts/check-focused.sh passed`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-core#228
No description provided.