feat(admin): adding uniformity in cancel and back buttons present in Jans Lock#2405
Conversation
📝 WalkthroughWalkthroughThe PR wires the patch mutation's pending state into the JansLock configuration form, adds memoized trimmed-values/patch computation and form dirty/valid checks, updates footer actions to use those flags and submission state, and prevents emitting add patch operations for empty arrays/objects. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as JansLock (parent)
participant Form as JansLockConfiguration
participant Mut as patchMutation
participant Utils as createPatchOperations
UI->>Form: render(isLoading, isSubmitting = Mut.isPending)
Form->>Form: compute trimmedValuesAndPatches (useMemo)
Form->>Form: compute isFormDirty / isFormValid (useMemo)
alt user clicks Apply
Form->>Mut: mutate(patchOperations)
Mut-->>Form: isPending true (prop updates)
Form->>Form: footer shows isLoading / disabled per flags
end
Note over Form,Utils: createPatchOperations skips add ops for empty arrays/objects
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (8)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
admin-ui/plugins/jans-lock/components/JansLock.tsx(1 hunks)admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx(4 hunks)admin-ui/plugins/jans-lock/helper/utils.ts(1 hunks)
🔇 Additional comments (5)
admin-ui/plugins/jans-lock/helper/utils.ts (1)
107-121: LGTM! Good defensive guard against empty values.The logic correctly identifies and filters out empty arrays and empty objects from patch operations, preventing unnecessary API calls with empty data structures. The checks properly distinguish between arrays and objects, and handle null values correctly.
admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx (3)
2-2: LGTM! Necessary import for performance optimization.The
useMemoimport supports the memoized form state computations introduced later in the file.
20-30: LGTM! Proper typing and integration of submission state.The
isSubmittingprop is correctly typed as optional and properly integrated into the component signature, allowing the parent to control the submission loading state.
431-440: LGTM! Footer controls correctly implement the PR objectives.The button states are properly derived from form state:
- Back: Always enabled (as specified)
- Cancel: Disabled when form is clean, enabled when dirty
- Apply: Disabled when form is invalid or clean, enabled when valid and dirty
The loading state correctly reflects the submission status.
admin-ui/plugins/jans-lock/components/JansLock.tsx (1)
44-54: Verify if dual loading indicators are intentional.The current implementation shows loading state in two places during patch submission:
- Page-level:
GluuLoaderblocks the entire UI whenpatchMutation.isPendingis true (line 44, 47)- Button-level: The Apply button in
JansLockConfigurationshows loading viaisSubmitting(line 54, used at line 440 in child)This might be intentional for layered user feedback (page-blocking + button feedback), but it could also be redundant. Consider whether:
- The page-level blocking is necessary during submission, or
- Only the button-level loading state is sufficient for better UX (allowing users to see the form while submission is in progress)
admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx
Outdated
Show resolved
Hide resolved
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx(6 hunks)
🔇 Additional comments (3)
admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx (3)
2-2: LGTM! Clean integration of submission state.The addition of
useMemoand theisSubmittingprop correctly supports the button state management objectives outlined in the PR.Also applies to: 23-23, 26-30
87-104: LGTM! Efficient use of memoized patches.The
submitFormcallback correctly uses the memoized patches and updates its dependency array accordingly. The silent behavior when no patches exist (line 101) is reasonable and prevents unnecessary API calls.
58-60: LGTM! Cancel correctly resets the form.The
handleCancelimplementation properly resets the form to its initial values usingformik.resetForm(), which aligns with the PR objective for Cancel button behavior.
admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx
Outdated
Show resolved
Hide resolved
admin-ui/plugins/jans-lock/components/JansLockConfiguration.tsx
Outdated
Show resolved
Hide resolved
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…SCIM & Jans Lock (#2404) * 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 * Code rabbit changes --------- Signed-off-by: Faisal Siddique <71010439+faisalsiddique4400@users.noreply.github.com>
… 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 Jans Lock
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