Skip to content

FlowAuth: make Latest expiry picker clearable on Server and Role admin#7285

Merged
jakejellinek merged 1 commit intomasterfrom
flowauth/clearable-expiry-picker
Apr 30, 2026
Merged

FlowAuth: make Latest expiry picker clearable on Server and Role admin#7285
jakejellinek merged 1 commit intomasterfrom
flowauth/clearable-expiry-picker

Conversation

@jakejellinek
Copy link
Copy Markdown
Contributor

@jakejellinek jakejellinek commented Apr 30, 2026

Summary

The backend started accepting NULL for latest_token_expiry on Server and Role in #7277, but the admin UI made that value unreachable:

  • The Material-UI v4 DateTimePickers on both forms had no Clear option — there was no UI gesture that produced an empty value.
  • ServerAdminDetails.handleSubmit always wrapped state in new Date(latest_expiry).toISOString(), so even if the picker held null you'd send the 1970 epoch string back to the API.

Both fixed here. Operators can now actually clear an existing absolute expiry cap on a server or role from the admin UI.

Changes

  • flowauth/frontend/src/ServerAdminDetails.jsxclearable={true} on the picker, helper text, conditional null/ISO string in handleSubmit.
  • flowauth/frontend/src/RoleDetails.jsxclearable={true} on the picker. The role form already passes the picker value through unchanged, so the API path is fine once the Clear button exists.

Test plan

  • Server admin → edit existing server → click the Clear button on Latest expiry → save → reload → field shows blank, GET /servers/<id> returns latest_token_expiry: null.
  • Role admin → same flow on a role.
  • Mint a token against a server with cleared latest_token_expiry and longest_token_life_minutes only → token expiry equals now + longest_token_life_minutes, no silent clamp.
  • Editing a server/role with an expiry set still works (regression check).

Summary by CodeRabbit

  • New Features

    • Latest expiry fields in Role and Server administrator forms can now be cleared with clear action buttons and helpful text guidance.
  • Bug Fixes

    • Empty Latest expiry field values now correctly submit as null instead of invalid date strings.
    • Updated the submission logic to properly handle empty expiry fields.

The backend now accepts NULL for `latest_token_expiry` on both Server
and Role (PR #7277), but the admin UI made that value unreachable: the
Material-UI v4 DateTimePickers had no Clear option, and Server's
`handleSubmit` always wrapped the state in `new Date(...).toISOString()`,
turning empty/null state into the 1970 epoch string.

- Add `clearable={true}` to the DateTimePickers on `ServerAdminDetails`
  and `RoleDetails`, with a small helper line explaining what blank
  means.
- In `ServerAdminDetails.handleSubmit`, only stringify the date when it
  has a truthy value; otherwise pass `null` through to the API. The role
  form already passes the picker value through unchanged, so no change
  is needed there beyond exposing the Clear button.

Without this, operators saw "no absolute expiry cap" semantics in the
API but had no UI path to actually clear an existing cap.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a00c84ba-bfc8-4255-90ec-9501233a73e8

📥 Commits

Reviewing files that changed from the base of the PR and between 786e629 and 79805c8.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • flowauth/frontend/src/RoleDetails.jsx
  • flowauth/frontend/src/ServerAdminDetails.jsx

Walkthrough

The pull request updates the FlowAuth admin UI to make the "Latest expiry" fields clearable in both Server and Role forms. The submission logic is modified to send null instead of invalid date strings when the field is empty, enabling users to remove absolute expiry caps from the UI.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Documents the introduction of Clear action on Server/Role forms and the change from invalid date strings to null for empty submissions.
Frontend Forms
flowauth/frontend/src/ServerAdminDetails.jsx, flowauth/frontend/src/RoleDetails.jsx
Adds clearable DateTimePicker components with helper text explaining that empty fields remove expiry caps. Updates ServerAdminDetails submission logic to pass null instead of calling toISOString() when Latest expiry is unset.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

FlowAuth

Poem

🐰 With a flourish and a hop, the expiry date falls free,
Clear buttons now appear where durations used to be,
Nulls replace the epochs in this UI's grand replay,
A rabbit's touch makes absolute caps fade away! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: making the Latest expiry picker clearable on Server and Role admin forms.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch flowauth/clearable-expiry-picker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@cypress
Copy link
Copy Markdown

cypress Bot commented Apr 30, 2026

FlowAuth    Run #26007

Run Properties:  status check passed Passed #26007  •  git commit 79805c8166: FlowAuth: make Latest expiry picker clearable on Server and Role admin
Project FlowAuth
Branch Review flowauth/clearable-expiry-picker
Run status status check passed Passed #26007
Run duration 00m 49s
Commit git commit 79805c8166: FlowAuth: make Latest expiry picker clearable on Server and Role admin
Committer Joachim Jellinek
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.02%. Comparing base (786e629) to head (79805c8).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7285      +/-   ##
==========================================
- Coverage   94.23%   92.02%   -2.22%     
==========================================
  Files         258      279      +21     
  Lines        9305    10878    +1573     
  Branches      697      697              
==========================================
+ Hits         8769    10010    +1241     
- Misses        387      716     +329     
- Partials      149      152       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jakejellinek jakejellinek merged commit ffe59b9 into master Apr 30, 2026
39 of 40 checks passed
@jakejellinek jakejellinek deleted the flowauth/clearable-expiry-picker branch April 30, 2026 15:37
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.

1 participant