RetentionPolicyInputController

Retention Policy Input Controller

Provides a structured interface for retention policy configuration with real-time preview. Replaces simple JSON textarea with user-friendly inputs (years, months, days, anchor).

Targets:

  • anchorSelect: The anchor point selection (gathering_end_date, upload_date, permanent)
  • yearsInput: Years input field
  • monthsInput: Months input field
  • daysInput: Days input field
  • durationSection: Container for duration inputs (hidden when anchor=permanent)
  • preview: Preview text showing formatted policy
  • hiddenInput: Hidden input that stores the JSON value for form submission

Actions:

  • updatePreview: Updates preview text and hidden JSON field when any input changes

Constructor

new RetentionPolicyInputController()

Methods

connect()

Initialize controller

formatPreviewText(anchor, years, months, days) → {string}

Format preview text in human-readable format

Parameters:
NameTypeDescription
anchorstring

The anchor point

yearsnumber

Years duration

monthsnumber

Months duration

daysnumber

Days duration

Returns:

Formatted preview text

Type: 
string

parseJson(jsonValue)

Parse existing JSON value into form fields Called when editing an existing waiver type

Parameters:
NameTypeDescription
jsonValuestring

JSON string from database

updatePreview()

Update preview text and hidden JSON field Called whenever any input changes

validate() → {boolean}

Validate inputs before form submission

Returns:

True if valid, false otherwise

Type: 
boolean