feat(admin): adding uniformity in cancel and back buttons present in Script, Logging & SSA#2415
feat(admin): adding uniformity in cancel and back buttons present in Script, Logging & SSA#2415
Conversation
…i-issue-2361-scim
…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
1748b55 to
4b25dea
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
admin-ui/plugins/admin/components/CustomScripts/CustomScriptForm.tsx (2)
219-227: Remove redundantremoveModulePropertycall.The
updateModulePropertyfunction already handles updating existing properties (lines 147-152), so callingremoveModulePropertybeforehand is unnecessary and adds overhead.Apply this diff:
const scriptPathChange = useCallback( (value: string): void => { if (!value) return formik.setFieldValue('locationPath', value) - removeModuleProperty('location_path') updateModuleProperty('location_path', value) }, - [formik.setFieldValue, removeModuleProperty, updateModuleProperty], + [formik.setFieldValue, updateModuleProperty], )
54-59: Back button fallback is incomplete.When there's no browser history (e.g., direct link or page refresh),
navigate(-1)is called but the earlyreturnon line 58 prevents any fallback navigation. Based on recent learnings, the Back button should fall back to the respective listing screen rather than the dashboard, keeping users in the script management context.Apply this diff to add the scripts listing fallback:
const handleNavigateBack = useCallback(() => { if (window.history.length > 1) { navigate(-1) + return } - return + navigate('/auth-server/config/scripts') }, [navigate])Based on learnings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
admin-ui/app/utils/TokenController.ts(1 hunks)admin-ui/plugins/admin/components/CustomScripts/CustomScriptForm.tsx(16 hunks)admin-ui/plugins/admin/components/CustomScripts/helper/utils.ts(1 hunks)admin-ui/plugins/admin/components/CustomScripts/types/forms.ts(1 hunks)admin-ui/plugins/auth-server/redux/sagas/LoggingSaga.js(2 hunks)admin-ui/plugins/auth-server/redux/sagas/SsaSaga.js(3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 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.943Z
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-06T08:23:20.931Z
Learnt from: faisalsiddique4400
Repo: GluuFederation/flex PR: 2418
File: admin-ui/plugins/user-management/components/UserForm.tsx:290-297
Timestamp: 2025-11-06T08:23:20.931Z
Learning: In the UserForm component (admin-ui/plugins/user-management/components/UserForm.tsx), the Back button should fall back to '/user/usersmanagement' when browser history is unavailable, not '/home/dashboard', as this keeps users in the user management context. This aligns with the new requirement that users should be redirected to the respective listing screen of the component rather than the dashboard.
Applied to files:
admin-ui/plugins/admin/components/CustomScripts/CustomScriptForm.tsx
📚 Learning: 2025-11-03T08:47:33.943Z
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.943Z
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/admin/components/CustomScripts/CustomScriptForm.tsx
📚 Learning: 2025-11-05T19:57:35.134Z
Learnt from: faisalsiddique4400
Repo: GluuFederation/flex PR: 2415
File: admin-ui/plugins/auth-server/components/Ssa/SsaAddPage.tsx:148-153
Timestamp: 2025-11-05T19:57:35.134Z
Learning: In the SSA Add page (admin-ui/plugins/auth-server/components/Ssa/SsaAddPage.tsx), the Back button should fall back to '/auth-server/config/ssa' when browser history is unavailable, not '/home/dashboard', as this keeps users in the SSA management context.
Applied to files:
admin-ui/plugins/admin/components/CustomScripts/CustomScriptForm.tsxadmin-ui/plugins/auth-server/redux/sagas/SsaSaga.js
🧬 Code graph analysis (4)
admin-ui/plugins/admin/components/CustomScripts/helper/utils.ts (2)
admin-ui/plugins/admin/components/CustomScripts/types/forms.ts (1)
FormValues(15-30)admin-ui/app/utils/Util.ts (1)
filterEmptyObjects(82-84)
admin-ui/plugins/admin/components/CustomScripts/CustomScriptForm.tsx (6)
admin-ui/plugins/admin/components/CustomScripts/types/forms.ts (2)
CustomScriptFormProps(5-9)FormValues(15-30)admin-ui/plugins/admin/components/CustomScripts/types/customScript.ts (3)
ModuleProperty(3-10)ConfigurationProperty(12-18)CustomScriptItem(29-49)admin-ui/plugins/admin/components/CustomScripts/helper/utils.ts (2)
transformToFormValues(13-32)getModuleProperty(5-11)admin-ui/plugins/admin/components/CustomScripts/helper/validations.ts (1)
customScriptValidationSchema(3-59)admin-ui/app/utils/Util.ts (1)
filterEmptyObjects(82-84)admin-ui/app/customColors.ts (1)
customColors(4-25)
admin-ui/plugins/auth-server/redux/sagas/SsaSaga.js (2)
admin-ui/app/utils/TokenController.ts (1)
addAdditionalData(49-124)admin-ui/app/redux/api/backend-api.ts (1)
postUserAction(51-69)
admin-ui/app/utils/TokenController.ts (3)
admin-ui/plugins/auth-server/redux/sagas/LoggingSaga.js (2)
issuer(17-17)audit(39-39)admin-ui/plugins/auth-server/redux/sagas/SsaSaga.js (3)
issuer(22-22)audit(71-71)audit(103-103)admin-ui/plugins/admin/redux/sagas/ApiPermissionSaga.js (1)
actionData(125-125)
🔇 Additional comments (4)
admin-ui/plugins/admin/components/CustomScripts/CustomScriptForm.tsx (4)
188-217: LGTM! Location type switching correctly cleans up stale properties.The function now properly removes the
location_pathmodule property when switching todbmode, addressing the previous concern about contradictory data in the payload.
593-614: Excellent! Footer button behavior aligns with PR objectives.The conditional footer rendering correctly implements the required button behaviors:
- Cancel: disabled until changes are made (
!formik.dirty)- Apply: enabled only when form is valid and has changes (
!formik.isValid || !formik.dirty)- Back: always enabled in both modes
This provides a consistent and intuitive UX across configuration forms.
252-255: LGTM! Cancel correctly resets to initial values.The
handleCancelimplementation properly resets all form fields to their original values usingtransformToFormValues(item), fulfilling the PR requirement that "Cancel resets all fields to their previous values without navigating away."
77-139: LGTM! Formik setup is comprehensive and correct.The Formik configuration properly handles:
- Initial values transformation with
transformToFormValues(item)- Validation via
customScriptValidationSchema- Conditional payload structure based on
location_type('file' vs 'db')- Proper property transformation and filtering for API submission
- Optional
action_messagesupportThe
enableReinitializeandvalidateOnMountflags ensure the form stays synchronized with prop changes and validates immediately, supporting the dirty-state tracking required by the PR objectives.
Signed-off-by: Faisal Siddique <71010439+faisalsiddique4400@users.noreply.github.com>
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
duttarnab
left a comment
There was a problem hiding this comment.
- my question is why in logging and SSA we have only cancel and apply button. We also need back button right?
|




feat(admin): adding uniformity in cancel and back buttons present in Script, Logging & SSA
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
New Features
Bug Fixes
Improvements