feat(admin): adding uniformity in cancel and back buttons present in SERVICES#2411
Conversation
📝 WalkthroughWalkthroughMultiple admin-UI components are updated to improve form state handling: a modal dialog now tracks state changes to reset user messages on open using refs; form footer disable logic is refined to consider form validity and touch state; and loading indicators are defaulted to false when submission state is undefined using nullish coalescing. Changes
Sequence DiagramsequenceDiagram
participant User
participant Modal as GluuCommitDialog
participant Ref as prevModalRef
participant Effect as useEffect
participant State as userMessage State
User->>Modal: Opens modal
Modal->>Effect: Run effect (active changed)
Effect->>Ref: Check prevModalRef.current
alt First open transition
Ref-->>Effect: prevModalRef null/false
Effect->>State: Reset userMessage to ""
Effect->>Ref: Update prevModalRef.current = true
else Already open
Ref-->>Effect: prevModalRef true
Effect-->>Effect: Skip reset
end
Note over Effect: activeState = userMessage.length > 0
Effect-->>Modal: Update active state
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
…ices Signed-off-by: Faisal Siddique <71010439+faisalsiddique4400@users.noreply.github.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
admin-ui/plugins/services/Components/Configuration/CachePage.js (1)
90-95: Cancel handler correctly resets both form and local state.The implementation properly resets the Formik form and the local
cacheProviderTypestate, ensuring the UI reflects the cancellation. This aligns with the PR objective that Cancel should reset all fields to previous values.Optional: Consider memoizing with
useCallbackfor performance.Since
handleCancelis recreated on every render, wrapping it inuseCallbackcould prevent unnecessary re-renders ofGluuFormFooterif that component is memoized:const handleCancel = useCallback((formik) => { return () => { formik.resetForm() setCacheProviderType(cacheData.cacheProviderType) } }, [cacheData.cacheProviderType])
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
admin-ui/app/routes/Apps/Gluu/GluuCommitDialog.tsx(3 hunks)admin-ui/plugins/fido/components/DynamicConfiguration.tsx(1 hunks)admin-ui/plugins/fido/components/StaticConfiguration.tsx(1 hunks)admin-ui/plugins/scim/components/ScimConfiguration.tsx(1 hunks)admin-ui/plugins/services/Components/Configuration/CachePage.js(2 hunks)admin-ui/plugins/services/Components/Configuration/PersistenceDetail.js(2 hunks)admin-ui/plugins/smtp-management/components/SmtpManagement/SmtpForm.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: faisalsiddique4400
Repo: GluuFederation/flex PR: 2404
File: admin-ui/app/routes/Apps/Gluu/Gluuformfooter.tsx:70-77
Timestamp: 2025-11-03T08:47:33.926Z
Learning: In the admin-ui forms (Gluuformfooter component), the Back button should always navigate to '/home/dashboard' rather than using history-based navigation (navigate(-1)), as clarified by faisalsiddique4400 in PR #2404.
📚 Learning: 2025-11-03T08:47:33.926Z
Learnt from: faisalsiddique4400
Repo: GluuFederation/flex PR: 2404
File: admin-ui/app/routes/Apps/Gluu/Gluuformfooter.tsx:70-77
Timestamp: 2025-11-03T08:47:33.926Z
Learning: In the admin-ui forms (Gluuformfooter component), the Back button should always navigate to '/home/dashboard' rather than using history-based navigation (navigate(-1)), as clarified by faisalsiddique4400 in PR #2404.
Applied to files:
admin-ui/plugins/services/Components/Configuration/PersistenceDetail.jsadmin-ui/plugins/services/Components/Configuration/CachePage.js
🔇 Additional comments (1)
admin-ui/plugins/services/Components/Configuration/CachePage.js (1)
238-241: Remove this review comment—the suggested changes are based on a misunderstanding of the Formik API.The
formik.handleSubmit()method is synchronous and does not return an awaitable promise. It validates the form and invokes theonSubmitcallback. Async Redux operations are handled separately via Redux middleware, and the loading state is correctly displayed via theBlockUicomponent.The current pattern in CachePage.js (calling
formik.handleSubmit()synchronously, then closing the modal) is consistent with the rest of the codebase and is correct. The Reduxloadingstate provides user feedback about async operations while the modal closes immediately as intended.No changes are required.
Likely an incorrect or invalid review comment.
… Users and Whole Home Module (#2418) * fix(admin-ui): unable to add Custom and Module properties in Scripts page (#2401) * code rabbit suggestions * code rabbit suggestions * code rabbit suggestions * pagination count issues fixed * fix(admin-ui): unable to map permission to a role using GUI (#2400) * fix(admin-ui): adding uniformity in cancel and back buttons present in SCIM forms (#2361) * Code rabbit suggestions * Code rabbit suggestions * Code rabbit suggestions * Code rabbit suggestions * Code rabbit suggestions * Code rabbit suggestions * buttons swapping * Code Rabbit fixes * Code Rabbit fixes * Code Rabbit fixes * Code Rabbit fixes * Code Rabbit fixes * Code Rabbit fixes * feat(admin): adding uniformity in cancel and back buttons present in Jans Lock (#2405) * feat(admin): adding uniformity in cancel and back buttons present in Jans Lock * feat(admin): adding uniformity in cancel and back buttons present in Jans Lock * Code Rabbit fixes * Saperating footer components * Code rabbit changes * Code rabbit changes * Code rabbit changes * Code rabbit changes * file notations fixes * file notations fixes * Rename Gluuformfooter.tsx to GluuFormFooter.tsx Signed-off-by: Faisal Siddique <71010439+faisalsiddique4400@users.noreply.github.com> * code rabbit fixes * code rabbit fixes * code rabbit fixes * feat(admin): adding uniformity in cancel and back buttons present in FIDO * feat(admin): adding uniformity in cancel and back buttons present in FIDO * code rabbit changes * code rabbit changes * feat(admin): adding uniformity in cancel and back buttons present in SMTP * feat(admin): adding uniformity in cancel and back buttons present in SMTP (#2410) * feat(admin): adding uniformity in cancel and back buttons present in Services * commit text not getting rollover issue * feat(admin): adding uniformity in cancel and back buttons present in SERVICES (#2411) * feat(admin): adding uniformity in cancel and back buttons present in SMTP * feat(admin): adding uniformity in cancel and back buttons present in Services * commit text not getting rollover issue --------- Signed-off-by: Faisal Siddique <71010439+faisalsiddique4400@users.noreply.github.com> * feat(admin): adding uniformity in cancel and back buttons present in Script * Code rabbit changes * Code rabbit changes * Code rabbit changes * Code rabbit changes * Code rabbit changes * Code rabbit changes * Code rabbit changes * feat(admin): adding uniformity in cancel and back buttons present in Logging (#2416) * feat(admin): adding uniformity in cancel and back buttons present in Logging * feat(admin): adding uniformity in cancel and back buttons present in SSA * Code rabbit changes * SSA Layout fixed * SSA Layout fixed * SSA Layout fixed * Comments on the PR resolved * Comments on the PR resolved * Comments on the PR resolved * Comments on the PR resolved * adding uniformity in cancel and back buttons present in Scopes (#2430) * a minor enhancement on iteration * SSA implemented with TS * Implementing new formFooter in User management * FormFooter in Users and Webhook done * FormFooter in Jans Assets done * FormFooter in Jans Assets done and dynamic navigations * Enhanced the password validations * Minor adjustments * Minor fixes(#2471) * Minor fixes(#2471) * Minor fixes(#2471) * Minor fixes(#2471) * Minor fixes(#2471) --------- Signed-off-by: Faisal Siddique <71010439+faisalsiddique4400@users.noreply.github.com>
feat(admin): adding uniformity in cancel and back buttons present in SERVICES
Summary
This update introduces consistent behavior for Cancel, Back, and Apply buttons across Admin UI forms, including correct enabling and disabling based on form state.
Improvements
Additional Enhancements
Affected Modules
This change is applied across all forms where configuration changes are possible, including but not limited to:
Parent issue: #2268
Testing Steps
Summary by CodeRabbit
Bug Fixes
Improvements