Skip to content

Add data retention time configuration component to admin panel#239

Draft
duckbytes with Copilot wants to merge 7 commits into
masterfrom
copilot/add-data-retention-component
Draft

Add data retention time configuration component to admin panel#239
duckbytes with Copilot wants to merge 7 commits into
masterfrom
copilot/add-data-retention-component

Conversation

Copilot AI commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

Data Retention Time Component Implementation Plan

  • Explore repository structure and understand admin panel components
  • Identify existing patterns (UnitSelector, DaysSelection components)
  • Create DataRetentionSelector component with time unit options (days, weeks, months, years)
  • Create AdminDataRetention component for admin panel
  • Add component to AdminControl panel
  • Create unit tests for DataRetentionSelector
  • Create unit tests for AdminDataRetention
  • Address code review feedback (try-catch, unused imports)
  • Improve input handling to allow clearing field
  • Add loading state delay for better UX
  • Run security scan with CodeQL (0 issues found)
  • Address PR feedback:
    • Use Stack instead of Grid in DataRetentionSelector
    • Move component to bottom of AdminControl
    • Add indefinite retention option (default)
    • Add warning dialog for retention < 7 days
    • Left-align save button
    • Change minimum value to 1
  • Fix minimum value handling to enforce 1 as minimum
  • Document day calculation assumptions
  • Fix all test failures:
    • Added IDs to TextField components for proper label association
    • Updated tests to work with MUI Select aria-disabled behavior
    • Fixed duplicate text element issues in tests
  • All 14 tests passing
Original prompt

a component for the admin panel that lets a user determine a data retention time in days, weeks, months, or years


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 20, 2025 00:16
Co-authored-by: duckbytes <32309223+duckbytes@users.noreply.github.com>
Co-authored-by: duckbytes <32309223+duckbytes@users.noreply.github.com>
Co-authored-by: duckbytes <32309223+duckbytes@users.noreply.github.com>
Copilot AI changed the title [WIP] Add data retention component for admin panel Add data retention time configuration component to admin panel Dec 20, 2025
Copilot AI requested a review from duckbytes December 20, 2025 00:24
};

return (
<Grid container spacing={2} alignItems="center">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grid is overkill here, use Stack instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Stack in commit a33b3e2. The component now uses Stack direction="row" with flex styling for equal-width inputs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please place the component at the bottom instead of the top

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to bottom of AdminControl in commit a33b3e2. The component now appears after AdminAddLocation.

onChange={setState}
disabled={isPosting}
/>
<Button disabled={isPosting} onClick={handleSave}>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button appears in the center here but should be placed to the left to match the other components

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Button now left-aligned in commit a33b3e2 using sx={{ alignSelf: "flex-start" }} to match other admin components.

onChange={handleValueChange}
disabled={disabled}
inputProps={{
min: 0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the minimum possible input should be 1 instead of 0.

additionally, if the user tries to save a value that is very short, say less than 1 week or 7 days, the user should be prompted with a warning dialog and asked to confirm it. the user should be warned that all data will be deleted in n number of days if they go ahead with this choice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in commit a33b3e2:

  • Minimum value changed from 0 to 1
  • Warning dialog shows for retention periods < 7 days
  • Dialog warns users that "all data older than this will be automatically deleted" and requires confirmation to proceed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A choice should be given to save no retention policy at all, in which case all data is retained indefinitely. this should be the default choice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in commit a33b3e2:

  • Added "Retain data indefinitely (no automatic deletion)" checkbox
  • This is now the default (checked) state
  • When checked, the retention time selector is hidden
  • Users can uncheck to enable time-based retention

Copilot AI and others added 2 commits December 20, 2025 00:37
…ion, warning dialog, left-align button

Co-authored-by: duckbytes <32309223+duckbytes@users.noreply.github.com>
Co-authored-by: duckbytes <32309223+duckbytes@users.noreply.github.com>

@duckbytes duckbytes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the tests as most of them are failing on my machine

Co-authored-by: duckbytes <32309223+duckbytes@users.noreply.github.com>

Copilot AI commented Dec 20, 2025

Copy link
Copy Markdown
Contributor Author

Please check the tests as most of them are failing on my machine

Fixed in commit 92d7e87. The issue was that Material-UI TextFields weren't properly associating labels with inputs. Added id props to the TextField components and updated test assertions to work with MUI's Select component behavior (uses aria-disabled instead of disabled attribute). All 14 tests now passing.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /usr/local/bin/node node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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.

2 participants