Skip to content

Conversation

@danielbowne
Copy link
Collaborator

@danielbowne danielbowne commented Jan 30, 2026

Summary

Closes #313

  • Add custom date selection and optional notes field when decommissioning a FISMA system
  • Display full audit trail (date, user name, notes) for already-decommissioned systems
  • Allow retroactive editing of decommission date and notes for systems decommissioned before this feature
  • Table auto-refreshes after decommission without requiring manual page reload

Changes

Types & data model (types.ts, emptySystem.ts)

  • Add decommissioned_by and decommissioned_notes fields to FismaSystemType

ConfirmDialog (ConfirmDialog.tsx)

  • Add optional title prop so callers can set contextual dialog headers (defaults to "Unsaved Changes")

EditSystemModal (EditSystemModal.tsx)

  • Replace old checkbox-only decommission UI with a two-step flow: checkbox reveals date picker + notes form + confirm button
  • Native HTML date input with calendar picker, defaults to today, rejects future dates
  • Optional notes textarea with 500 character limit and live counter
  • Send decommissioned_date and notes in DELETE request body (Axios { data: ... } syntax)
  • Display read-only audit trail for decommissioned systems: date, user full name (resolved from UUID via /users endpoint), and notes
  • "Edit Decommission Details" button for retroactive updates on already-decommissioned systems
  • Confirmation dialog shows contextual title and previews selected date + notes

FismaTable (FismaTable.tsx)

  • Re-fetch systems list after decommission so the row disappears from active view immediately

Context (Context.ts, Title.tsx)

  • Expose fetchFismaSystems through outlet context so child components can trigger table refresh

Test plan

  • Decommission a system with default date (today) and no notes — verify DELETE request body contains decommissioned_date as ISO string, no notes field
  • Decommission with a past date and notes — verify both fields in request body
  • Attempt future date — verify date picker greys out future dates and validation rejects them
  • Verify notes textarea enforces 500 char limit with counter
  • Open edit modal for a decommissioned system — verify audit trail shows date, user full name (not UUID), and notes
  • Click "Edit Decommission Details" on a decommissioned system — verify form pre-fills with existing date and notes, and update saves correctly
  • Verify table refreshes after decommission (row disappears from active list)
  • Verify confirmation dialog says "Confirm Decommission" for new decommissions and "Update Decommission Details" for edits
  • Open modal, close it, open for a different system — verify date resets to today and notes clear

…313)

Add custom date selection and optional notes when decommissioning a
FISMA system, and display a full audit trail for already-decommissioned
systems with the ability to retroactively edit decommission details.

- Add decommissioned_by and decommissioned_notes fields to FismaSystemType
- Add date picker (native HTML date input) and notes textarea to
  decommission form, hidden until checkbox is checked
- Send decommissioned_date and notes in DELETE request body
- Display audit trail (date, user name, notes) for decommissioned systems
- Resolve decommissioned_by UUID to user fullname via /users endpoint
- Add "Edit Decommission Details" for retroactive date/notes updates
- Add optional title prop to ConfirmDialog for contextual dialog headers
- Expose fetchFismaSystems through context so table refreshes after
  decommission without requiring manual page reload
- Validate decommission date: reject future dates, require valid format
- Cap notes at 500 characters with live character counter
Parse date input as UTC midnight (YYYY-MM-DDT00:00:00.000Z) instead of
local timezone to ensure consistent date storage and display across
timezones. Prevents dates from shifting by ±1 day depending on user's
timezone offset.
…alidation

- Always send notes field (as string or null) so empty notes clear backend value
- Add cleanup/cancellation to user lookup useEffect to prevent race condition
  when modal closes or switches systems mid-fetch
- Fix onBlur validation using stale state by reading e.currentTarget.value
  instead of decommissionDate state variable
Apply eslint --fix to match CI prettier rules - arrow function with
block statement for multi-line validation call.
Backend Go struct with omitempty expects field to be omitted when empty,
not sent as null. Also add console.error logging and 400 error handling
to show actual backend error messages instead of redirecting to sign-in.
Prevent crash when error.response is undefined. Add console logging
to debug table refresh failures after decommission.
Backend returns { data: { system } } but code was using res.data
directly instead of res.data.data. This caused a malformed object
to be passed to the table, throwing an error that showed as
'Decommission error: undefined undefined' in console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance decommission feature with custom date, notes, and audit trail display

2 participants