[FE] Prevent setting different CSP namespace for X minutes after last update

Problem

Users can rapidly change CSP (Compliance Standards Project) group assignments, generating excessive background jobs and causing performance issues during policy propagation.

Solution

Implement a 15-minute cooldown period that prevents CSP namespace changes, with unassignment always allowed but triggering the cooldown period.

Requirements

Must Have:

  • Assignment: Block for 15 minutes after last assignment or unassignment
  • Unassignment: Always allowed, but triggers 15-minute cooldown for subsequent changes
  • Show remaining cooldown time when assignment is blocked
  • When timestamp unavailable: inform user and allow the operation

Should Have:

  • Visual countdown timer showing when next assignment will be allowed
  • Clear error message: "CSP group assignment is temporarily disabled after recent changes. Try again in X minutes Y seconds."

Nice to Have:

  • Instance-wide admin setting to configure cooldown duration

Implementation Details

Frontend Logic:

  • Track last_csp_update_timestamp from backend
  • Assignment: Check cooldown, block if within 15 minutes of last change
  • Unassignment: Always enabled, but updates timestamp on success
  • Calculate remaining cooldown time client-side

User Experience:

  • Unassignment button: Always enabled
  • Assignment dropdown/controls: Disabled during cooldown with countdown
  • Clear messaging about why assignment is blocked

Technical Approach:

  1. Add timestamp field tracking last CSP modification (assignment OR unassignment)
  2. Frontend validation only blocks assignment operations
  3. Both assignment and unassignment update the timestamp
  4. Hard-coded 15-minute cooldown constant

Acceptance Criteria

  • CSP group assignment blocked for 15 minutes after any previous change
  • CSP group unassignment always possible
  • Successful unassignment triggers 15-minute cooldown for next assignment
  • Clear countdown display for assignment restrictions
  • Graceful handling when timestamp is missing
Edited by 🤖 GitLab Bot 🤖