Skip to content

fix(admin-ui): incorrect cancel button behaviour in the Application S…#2389

Merged
duttarnab merged 15 commits intomainfrom
admin-ui-issue-2388
Oct 30, 2025
Merged

fix(admin-ui): incorrect cancel button behaviour in the Application S…#2389
duttarnab merged 15 commits intomainfrom
admin-ui-issue-2388

Conversation

@faisalsiddique4400
Copy link
Contributor

@faisalsiddique4400 faisalsiddique4400 commented Oct 24, 2025

fix(admin-ui): incorrect cancel button behaviour in the Application Settings page in Home module

📝 Description

The Cancel button on the Application Settings page in the Home module is not resetting the field values to their previous state when clicked.

🧩 Steps to Reproduce

  1. Go to the Application Settings page.
  2. Modify any field value.
  3. Click the Cancel button.
  4. Observe that the values do not reset to their original state.

✅ Expected Behavior

On clicking the Cancel button, all fields should reset to their previous values before any modification.

🔗 Ticket

Closes: #2388

Summary by CodeRabbit

  • New Features

    • Settings page rebuilt with Formik/Yup, improved save/cancel flows, paging-size controls, script options, and dynamic config display.
    • Commit footer supports disabling Save/Back controls.
  • Improvements

    • Centralized paging-size management persisted and used across list/table views for consistent paging.
    • Submit flow shows contextual toast messages when relevant.
  • Tests

    • Added comprehensive unit tests for config save flow covering success, error, and toast scenarios.
  • Style

    • Minor parameter renames to mark unused arguments and reduce linter noise.

@mo-auto mo-auto added comp-admin-ui Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality labels Oct 24, 2025
@faisalsiddique4400
Copy link
Contributor Author

The field Custom Parameters (for authentication) is not updating from the backend side.
cc: @pujavs @duttarnab

Copy link
Contributor

@duttarnab duttarnab left a comment

Choose a reason for hiding this comment

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

  • the jenkins build is failing could you please check.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

📝 Walkthrough

Walkthrough

Replaces scattered localStorage pagingSize reads with a centralized paging utility; refactors SettingsPage to use Formik with correct cancel/reset and paging persistence; adds disable control for commit footer buttons; renames unused parameters to underscore-prefixed identifiers; exposes putConfigWorker and refines its _meta/toast handling.

Changes

Cohort / File(s) Change Summary
Paging utility
admin-ui/app/utils/pagingUtils.ts
Added getPagingSize(defaultSize?: number) and savePagingSize(size) with SSR/non-browser guards, validation, and safe localStorage access.
List pages: use centralized paging
admin-ui/plugins/admin/components/CustomScripts/ScriptListPage.tsx, admin-ui/plugins/admin/components/Permissions/UiPermListPage.js, admin-ui/plugins/admin/components/Roles/UiRoleListPage.js, admin-ui/plugins/auth-server/components/Sessions/SessionListPage.tsx, admin-ui/plugins/schema/components/Person/AttributeListPage.tsx, admin-ui/plugins/services/Components/Configuration/LdapListPage.js, admin-ui/plugins/services/Components/Configuration/SqlListPage.js
Replaced direct localStorage reads of paggingSize with getPagingSize() and adjusted initial pageSize/limit state accordingly.
SettingsPage Formik refactor
admin-ui/plugins/admin/components/Settings/SettingsPage.js
Rewrote to embed Formik + Yup (reinit on config/script change), wired save/cancel flows, integrated savePagingSize(), uses Redux dispatches and script loading; removed separate exported SettingsForm.
Commit footer button control
admin-ui/app/routes/Apps/Gluu/GluuCommitFooter.tsx
Added optional disableButtons?: { save?: boolean; back?: boolean } prop and applied it to Back/Save controls to conditionally disable buttons.
Reducer / handler unused param renames
admin-ui/app/redux/features/authSlice.ts, admin-ui/plugins/admin/components/CustomScripts/ScriptListPage.tsx
Renamed unused parameters to _state and _rowData in reducers and action handlers (no behavioral change).
Saga: export & toast/meta handling
admin-ui/app/redux/sagas/AuthSaga.ts
Exported putConfigWorker, destructures payload to remove _meta before API call, and uses _meta.cedarlingLogTypeChanged / _meta.toastMessage to select success toast.
Tests: saga coverage
admin-ui/app/redux/sagas/__tests__/AuthSaga.test.ts
Added tests covering putConfigWorker behaviors: _meta handling, toast selection, success/error flows, and ensured finalization branch calls.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsPage as SettingsPage (Formik)
    participant GluuCommitFooter
    participant Redux
    participant LocalStorage

    User->>SettingsPage: Load page
    SettingsPage->>Redux: Fetch config/scripts
    SettingsPage->>LocalStorage: getPagingSize()
    SettingsPage->>SettingsPage: Initialize Formik (values from config)

    User->>SettingsPage: Edit form
    SettingsPage->>GluuCommitFooter: Provide disableButtons based on form state

    alt Save
        User->>GluuCommitFooter: Click Save
        GluuCommitFooter->>SettingsPage: Submit
        SettingsPage->>SettingsPage: Validate (Yup)
        SettingsPage->>Redux: Dispatch putConfigWorker(payload + _meta)
        SettingsPage->>LocalStorage: savePagingSize()
        Redux->>User: Show toast (uses _meta if provided)
    else Cancel
        User->>GluuCommitFooter: Click Cancel
        GluuCommitFooter->>SettingsPage: Trigger cancel
        SettingsPage->>SettingsPage: Reset Formik to config values
        SettingsPage->>LocalStorage: restore paging size if needed
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to review closely:
    • admin-ui/plugins/admin/components/Settings/SettingsPage.js — Formik initialization/reinitialization, validation schema, submit/cancel flows, and interaction with savePagingSize() (addresses linked issue Incorrect cancel button behaviour in the Application Settings page in Home module. #2388).
    • admin-ui/app/utils/pagingUtils.ts — SSR/non-browser guards, parsing/validation, and persistence semantics.
    • admin-ui/app/routes/Apps/Gluu/GluuCommitFooter.tsx — ensure disableButtons remains backward-compatible and applied consistently.
    • admin-ui/app/redux/sagas/AuthSaga.ts & __tests__/AuthSaga.test.ts — verify _meta stripping, API payload shape, toast selection, and test coverage accuracy.
    • Quick checks: authSlice.ts unused param renames and _rowData renames in ScriptListPage to confirm no unintended side effects.

Poem

🐰 I hopped through lines to tidy the trail,
Paging stored safe in one little tale,
Forms now reset when the Cancel bell rings,
Buttons stay quiet when the code strings,
A bunny applauds these neat little things.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR includes changes that appear tangential to the core cancel button fix. Most notably, admin-ui/app/redux/features/authSlice.ts contains parameter renaming (state → _state in three reducers), which is purely a code style improvement unrelated to fixing the cancel button behavior. Additionally, while the introduction of pagingUtils.ts and updates across multiple list pages (ScriptListPage, UiPermListPage, UiRoleListPage, SessionListPage, etc.) support the paging size feature mentioned in SettingsPage changes, the scope of updating all these list pages may extend beyond the stated objective of fixing the cancel button on specific settings pages. Consider reverting or separating the parameter renaming changes in authSlice.ts (state → _state), as this is a cosmetic code style change unrelated to the cancel button fix and could be addressed in a separate cleanup PR. Clarify whether the comprehensive paging utilities refactoring across multiple list pages is essential for the cancel button fix or should be addressed separately to keep the PR focused on resolving issue #2388.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(admin-ui): incorrect cancel button behaviour in the Application S…" directly corresponds to the main objective of fixing the cancel button behavior on the Application Settings page. The title clearly identifies the primary issue being addressed (cancel button behavior) and is specific enough for a developer scanning history to understand the core change. While truncated, the title accurately reflects the main purpose of the changeset based on the comprehensive refactoring of SettingsPage.js that implements the Cancel flow to reset form values.
Linked Issues Check ✅ Passed The PR successfully addresses the core requirement from issue #2388: implementing a Cancel flow that resets all fields to their previous values. The SettingsPage.js refactoring introduces Formik + Yup for form state management and Redux integration, with a specific Cancel flow that resets form values to config-derived values and reverts paging size to the saved baseline. Supporting changes include GluuCommitFooter enhancements to control button states, AuthSaga modifications to handle the form submission workflow, and comprehensive test coverage for the updated saga. These changes collectively implement the required cancel functionality for settings pages.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch admin-ui-issue-2388

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2696021 and 9f94208.

📒 Files selected for processing (2)
  • admin-ui/app/redux/sagas/AuthSaga.ts (2 hunks)
  • admin-ui/app/redux/sagas/__tests__/AuthSaga.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
admin-ui/app/redux/sagas/__tests__/AuthSaga.test.ts (2)
admin-ui/app/redux/sagas/AuthSaga.ts (1)
  • putConfigWorker (57-84)
admin-ui/app/redux/api/backend-api.ts (1)
  • putServerConfiguration (15-25)
admin-ui/app/redux/sagas/AuthSaga.ts (1)
admin-ui/app/redux/api/backend-api.ts (1)
  • putServerConfiguration (15-25)
🔇 Additional comments (8)
admin-ui/app/redux/sagas/AuthSaga.ts (3)

57-57: Good testability improvement.

Exporting putConfigWorker enables direct unit testing of the saga, as demonstrated in the new test file.


59-62: Correct metadata extraction pattern.

The destructuring correctly strips _meta from the API payload while preserving all configuration data. This ensures internal metadata (like cedarlingLogTypeChanged and toastMessage) is not sent to the backend.


65-71: Conditional toast logic is correct and now properly tested.

The implementation correctly uses optional chaining to safely access _meta properties and shows a custom toast only when both cedarlingLogTypeChanged and toastMessage are truthy. The new test file (AuthSaga.test.ts) provides comprehensive coverage for both branches, fully addressing the previous review concern about missing tests.

admin-ui/app/redux/sagas/__tests__/AuthSaga.test.ts (5)

1-31: Clean test setup with appropriate mocks.

The test file correctly imports testing utilities, sets up mock data with all required fields, and provides a properly structured mock state. This foundation supports comprehensive saga testing.


32-79: Thorough coverage of cedarling-specific toast behavior.

These tests correctly validate that custom toast messages appear only on successful operations when cedarlingLogTypeChanged is true, and that error scenarios display only the generic error toast.


81-140: Comprehensive edge-case coverage for generic toast scenarios.

These tests validate all conditions where the generic success toast should appear: no metadata, cedarlingLogTypeChanged false, and undefined toastMessage. This ensures the conditional logic handles all edge cases correctly.


161-203: Critical validation of metadata extraction.

These tests verify the essential behavior that _meta is excluded from the API payload (lines 163-183) while ensuring the saga functions correctly with or without metadata present. This directly validates the destructuring pattern in the saga implementation.


142-158: Complete validation of error handling and finalization.

These tests ensure proper error handling (error toast dispatch) and critically verify that putConfigWorkerResponse is always called via the finally block, regardless of success or failure. This guarantees cleanup and state management consistency.

Also applies to: 205-248


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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fb486a and b54fd1a.

📒 Files selected for processing (3)
  • admin-ui/app/redux/features/authSlice.ts (3 hunks)
  • admin-ui/app/redux/features/types/authTypes.ts (1 hunks)
  • admin-ui/plugins/admin/components/Settings/SettingsPage.js (8 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (3)
admin-ui/plugins/user-management/types/CommonTypes.ts (1)
  • ThemeContext (13-17)
admin-ui/plugins/admin/components/Webhook/ShortcodePopover.js (1)
  • Label (91-118)
admin-ui/app/cedarling/index.ts (1)
  • CedarlingLogType (5-5)
🔇 Additional comments (8)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (8)

208-223: Formik wiring for cancel/reset looks correct.

enableReinitialize with resetForm to transformed config ensures Cancel restores pre-edit values. Nice.

Edge case: confirm additionalParameters deep equality doesn’t retain stale touched/error state after reset; current resetForm({ values }) should clear it.


277-285: Additional parameters mapping is safe; preserves empty values.

Options mapping defensively handles blank keys/values; good for UI.


60-67: Cancel behavior for paging size is correct.

Local state resets to saved value; submit persists to Redux.

Also applies to: 195-199


44-46: Selector default is good for backward compat.

Fallback to 10 covers older persisted states lacking the key.


32-34: Version display via package.json is useful.

Immutable and read-only; good UX.


139-139: PropTypes kept in sync—nice.

Once you rename to paging, update prop names here accordingly.


31-31: Toast on Cedarling setting change is a good touch.

Clear UX feedback.


287-292: The review comment is incorrect—a visible submit action is present.

The component renders a submit button when type="submit" is configured. The hideButtons={{ save: true }} prop hides the save button (which uses onClick={saveHandler}), not the submit button. These are two different submission mechanisms: the hidden save button is for direct handlers, while the submit button is for form submission. The page uses form submission (wrapped in <Form>), so the submit button with "Apply" text will display and function correctly. No changes are needed.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b54fd1a and 2daffc8.

📒 Files selected for processing (3)
  • admin-ui/app/redux/features/authSlice.ts (6 hunks)
  • admin-ui/app/redux/features/types/authTypes.ts (1 hunks)
  • admin-ui/plugins/admin/components/Settings/SettingsPage.js (8 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (2)
admin-ui/plugins/services/Components/Configuration/LdapForm.js (2)
  • dispatch (20-20)
  • formik (42-74)
admin-ui/plugins/auth-server/components/Configuration/ConfigPage.js (1)
  • ConfigPage (28-163)
🔇 Additional comments (5)
admin-ui/app/redux/features/authSlice.ts (1)

55-55: Minor: unused-arg cleanup is fine.

Underscored params avoid TS lint noise without logic changes in getUserInfo/getAPIAccessToken/getUserLocation.

Also applies to: 78-78, 93-93

admin-ui/plugins/admin/components/Settings/SettingsPage.js (4)

48-50: Nice SSR/test guard for window access.

Safe fallback prevents crashes outside the browser.


124-126: Correct: use selected value, not selectedIndex.

parseInt(e.target.value, 10) avoids order-coupling bugs.


168-173: Good: deduplicated auth script names.

Set-based unique list avoids duplicate SIMPLE_PASSWORD_AUTH.


193-197: Cancel now correctly resets to prior values.

Resets Formik to current config and restores paging size from store.

Manual check:

  • Change multiple fields + paging size.
  • Click Cancel → values match Redux config and paging resets to savedPagingSize.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
admin-ui/app/routes/Apps/Gluu/GluuCommitFooter.tsx (1)

87-112: Avoid duplicate “Apply” buttons (submit vs click handler).

When type==='submit' and hideButtons.save is falsy, two Apply buttons render. Make them mutually exclusive.

Apply:

-        {type === 'submit' && (
+        {type === 'submit' ? (
           <Button
             type="submit"
             color={`primary-${selectedTheme}`}
             style={{ ...applicationStyle.buttonStyle, ...applicationStyle.buttonFlexIconStyles }}
             className="ms-auto px-4"
             disabled={disableButtons?.save}
           >
             <i className="fa fa-check-circle me-2"></i>
             {t('actions.apply')}
           </Button>
-        )}
+        ) : (
+          (!hideButtons || !hideButtons['save']) && (
+            <Button
+              type="button"
+              color={`primary-${selectedTheme}`}
+              style={{ ...applicationStyle.buttonStyle, ...applicationStyle.buttonFlexIconStyles }}
+              className="ms-auto px-4"
+              onClick={saveHandler}
+              disabled={disableButtons?.save}
+            >
+              <i className="fa fa-check-circle me-2"></i>
+              {t('actions.apply')}
+            </Button>
+          )
+        )}
-
-        {!hideButtons || !hideButtons['save'] ? (
-          <Button
-            type="button"
-            color={`primary-${selectedTheme}`}
-            style={{ ...applicationStyle.buttonStyle, ...applicationStyle.buttonFlexIconStyles }}
-            className="ms-auto px-4"
-            onClick={saveHandler}
-            disabled={disableButtons?.save}
-          >
-            <i className="fa fa-check-circle me-2"></i>
-            {t('actions.apply')}
-          </Button>
-        ) : null}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2daffc8 and e8498f3.

📒 Files selected for processing (11)
  • admin-ui/app/redux/features/authSlice.ts (3 hunks)
  • admin-ui/app/routes/Apps/Gluu/GluuCommitFooter.tsx (5 hunks)
  • admin-ui/app/utils/pagingUtils.ts (1 hunks)
  • admin-ui/plugins/admin/components/CustomScripts/ScriptListPage.tsx (5 hunks)
  • admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (2 hunks)
  • admin-ui/plugins/admin/components/Roles/UiRoleListPage.js (1 hunks)
  • admin-ui/plugins/admin/components/Settings/SettingsPage.js (3 hunks)
  • admin-ui/plugins/auth-server/components/Sessions/SessionListPage.tsx (2 hunks)
  • admin-ui/plugins/schema/components/Person/AttributeListPage.tsx (2 hunks)
  • admin-ui/plugins/services/Components/Configuration/LdapListPage.js (2 hunks)
  • admin-ui/plugins/services/Components/Configuration/SqlListPage.js (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (8)
admin-ui/plugins/services/Components/Configuration/SqlListPage.js (3)
admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (1)
  • pageSize (53-53)
admin-ui/plugins/services/Components/Configuration/LdapListPage.js (1)
  • pageSize (64-64)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/services/Components/Configuration/LdapListPage.js (3)
admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (1)
  • pageSize (53-53)
admin-ui/plugins/services/Components/Configuration/SqlListPage.js (1)
  • pageSize (60-60)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (1)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/schema/components/Person/AttributeListPage.tsx (4)
admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (1)
  • pageSize (53-53)
admin-ui/plugins/services/Components/Configuration/LdapListPage.js (1)
  • pageSize (64-64)
admin-ui/plugins/services/Components/Configuration/SqlListPage.js (1)
  • pageSize (60-60)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/admin/components/CustomScripts/ScriptListPage.tsx (4)
admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (1)
  • pageSize (53-53)
admin-ui/plugins/services/Components/Configuration/LdapListPage.js (1)
  • pageSize (64-64)
admin-ui/plugins/services/Components/Configuration/SqlListPage.js (1)
  • pageSize (60-60)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/auth-server/components/Sessions/SessionListPage.tsx (4)
admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (1)
  • pageSize (53-53)
admin-ui/plugins/services/Components/Configuration/LdapListPage.js (1)
  • pageSize (64-64)
admin-ui/plugins/services/Components/Configuration/SqlListPage.js (1)
  • pageSize (60-60)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/admin/components/Roles/UiRoleListPage.js (1)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (3)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-6)
admin-ui/app/utils/PermChecker.ts (1)
  • buildPayload (153-160)
admin-ui/app/cedarling/index.ts (1)
  • CedarlingLogType (5-5)
🔇 Additional comments (21)
admin-ui/app/redux/features/authSlice.ts (1)

54-92: LGTM! Proper unused parameter naming.

Prefixing unused parameters with _ is idiomatic and clearly signals intent. These placeholder reducers correctly ignore the state parameter.

admin-ui/plugins/admin/components/Permissions/UiPermListPage.js (2)

30-30: LGTM! Centralized paging utility.

The import of getPagingSize aligns with the PR-wide refactor to centralize paging size management.


53-53: LGTM! Consistent with centralized paging.

Replacing direct localStorage access with getPagingSize() reduces duplication and centralizes paging logic.

admin-ui/plugins/services/Components/Configuration/LdapListPage.js (2)

30-30: LGTM! Centralized paging utility.

Consistent with the PR-wide refactor to centralize paging size management.


64-64: LGTM! Replaces direct localStorage access.

Using getPagingSize() centralizes paging logic and reduces code duplication.

admin-ui/plugins/schema/components/Person/AttributeListPage.tsx (2)

30-30: LGTM! Centralized paging utility.

Consistent with the PR-wide refactor to centralize paging size management.


70-71: LGTM! Centralized paging initialization.

Using getPagingSize() to initialize the limit state is consistent with other list pages in this PR.

admin-ui/plugins/admin/components/Roles/UiRoleListPage.js (2)

20-20: LGTM! Centralized paging utility.

Consistent with the PR-wide refactor to centralize paging size management.


31-31: LGTM! Replaces localStorage access.

Using getPagingSize() centralizes paging logic consistently with other list pages.

admin-ui/plugins/services/Components/Configuration/SqlListPage.js (2)

28-28: LGTM! Centralized paging utility.

Consistent with the PR-wide refactor to centralize paging size management.


60-60: LGTM! Centralized paging initialization.

Using getPagingSize() reduces direct localStorage dependencies and centralizes logic.

admin-ui/plugins/admin/components/CustomScripts/ScriptListPage.tsx (5)

30-30: LGTM! Centralized paging utility.

Consistent with the PR-wide refactor to centralize paging size management.


43-44: LGTM! Centralized paging initialization.

Using getPagingSize() to initialize pageSize and limit state is consistent with other list pages.


196-209: LGTM! Proper unused parameter naming.

Renaming rowData to _rowData correctly signals that the parameter is unused in this action handler (the actual row data comes from the entry parameter in the onClick handler).


213-226: LGTM! Proper unused parameter naming.

Renaming rowData to _rowData is appropriate since the parameter is unused in this action handler.


275-288: LGTM! Proper unused parameter naming.

Renaming rowData to _rowData correctly indicates the parameter is unused in this delete action handler.

admin-ui/plugins/auth-server/components/Sessions/SessionListPage.tsx (2)

40-40: LGTM! Centralized paging utility.

Consistent with the PR-wide refactor to centralize paging size management.


174-174: LGTM! Simplifies paging size retrieval.

Replacing manual parseInt and localStorage access with getPagingSize() simplifies the code and centralizes paging logic.

admin-ui/plugins/admin/components/Settings/SettingsPage.js (3)

116-121: Cancel now correctly resets to previous state.

resetForm with config-derived values and restoring savedPagingSize fulfills the issue’s expected behavior.

Please verify that GluuProperties respects formik.resetForm (no internal state persists beyond formik values).


286-291: Good wiring of Save/Cancel/disable states.

Save uses formik.handleSubmit; Cancel routes to handleCancel via GluuCommitFooter; disableButtons ties to dirty/validation flags — solid.


70-77: Backend field shape check: additionalParameters.

Confirm API expects an array of {key,value} and not a map/object; mismatch would explain “not updating” notes.

Would you like a small adapter to convert between UI array and backend object if needed?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8498f3 and 0e66049.

📒 Files selected for processing (2)
  • admin-ui/app/utils/pagingUtils.ts (1 hunks)
  • admin-ui/plugins/admin/components/Settings/SettingsPage.js (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (3)
admin-ui/plugins/user-management/types/CommonTypes.ts (1)
  • ThemeContext (13-17)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-24)
admin-ui/app/utils/PermChecker.ts (1)
  • buildPayload (153-160)
🔇 Additional comments (5)
admin-ui/app/utils/pagingUtils.ts (1)

1-45: LGTM! Well-implemented utility with robust error handling.

The paging utilities are well-designed with:

  • Proper SSR/test environment guards
  • Input validation ensuring only positive integers
  • Graceful error handling with informative warnings
  • Namespaced localStorage key to avoid collisions

The past review concerns about SSR safety and input validation have been thoroughly addressed.

admin-ui/plugins/admin/components/Settings/SettingsPage.js (4)

1-35: Imports and dependencies properly organized.

All imports are appropriately used throughout the component. The refactor correctly introduces Formik, Yup validation, and the new paging utilities. No unused imports detected.


36-63: Component initialization properly handles SSR and edge cases.

The setup correctly addresses previous review concerns:

  • Theme context accessed safely with optional chaining and fallback
  • Window object guarded against SSR environments
  • Paging size initialization uses the centralized utility with computed defaults

291-296: Excellent! The save button blocker has been resolved.

The GluuCommitFooter is now correctly configured:

  • saveHandler={formik.handleSubmit} properly wires form submission
  • Save button disabled only when form hasn't changed or has validation errors
  • Cancel handler properly resets form and paging size state

This resolves the critical issue from previous reviews where the save button was hidden and form submission was blocked.


96-115: Formik integration properly implements cancel/reset behavior.

The Formik configuration correctly addresses the PR's objective (fixing incorrect cancel button behavior):

  1. enableReinitialize: true keeps form in sync with config updates
  2. initialValues derived from config ensures correct reset state
  3. handleCancel explicitly resets to config-derived values and paging size
  4. Validation prevents invalid submissions

The form now properly reverts all fields (including custom authentication parameters and paging size) when Cancel is clicked.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (4)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (4)

293-298: Save/cancel wiring looks correct now.

Save uses formik.handleSubmit; Cancel resets form and paging; buttons disable state respects dirty/errors.


39-41: Good: ThemeContext access is guarded with a safe fallback.

Prevents runtime errors when context is absent.


58-62: Good: window access is SSR-safe.

Guarded configApiUrl avoids crashes in SSR/tests.


198-201: Good: stable keys for options.

Uses option value as key; avoids index-key pitfalls.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e66049 and 114285b.

📒 Files selected for processing (1)
  • admin-ui/plugins/admin/components/Settings/SettingsPage.js (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (4)
admin-ui/plugins/user-management/types/CommonTypes.ts (1)
  • ThemeContext (13-17)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-24)
admin-ui/app/utils/PermChecker.ts (1)
  • buildPayload (153-160)
admin-ui/app/cedarling/index.ts (1)
  • CedarlingLogType (5-5)
🔇 Additional comments (1)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (1)

46-52: Nice: default paging size derived from the options.

Keeps defaults in sync with UI choices.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (2)

96-117: Blocker: Baseline paging size updates even if save fails; Cancel can revert to unsaved value.

setBaselinePagingSize is called unconditionally right after dispatch. If putConfigWorker fails, isFormChanged becomes false and Cancel resets to the new (unsaved) size. Gate the baseline update on confirmed success (saga success or a store “save succeeded” flag). At minimum, remove the immediate baseline update here and move it to the success path.

Proposed change (UI side):

   onSubmit: (values) => {
     savePagingSizeToStorage(currentPagingSize)
     const cedarlingLogTypeChanged = values?.cedarlingLogType !== config?.cedarlingLogType
     dispatch(
       putConfigWorker({
         ...values,
         _meta: {
           cedarlingLogTypeChanged,
           toastMessage: cedarlingLogTypeChanged ? t('fields.reloginToViewCedarlingChanges') : undefined,
         },
       }),
     )
-    setBaselinePagingSize(currentPagingSize)
   },

And update baseline from a success signal (example):

// Pseudocode — adjust names to your store:
// const saveSucceeded = useSelector((s) => s.authReducer.putConfig.success)
useEffect(() => {
  if (saveSucceeded) setBaselinePagingSize(currentPagingSize)
}, [saveSucceeded, currentPagingSize])

Run to locate a usable success flag/action:

#!/bin/bash
# Find success/failure signals for config save
rg -nP "putConfigWorker|putConfig(Success|Failed|Failure)|save(Config)?(Success|Failure)|TOAST|updateToast" -C2 admin-ui app redux

104-114: Gate cedarlingLogType toast on success, not preemptively.

Passing toastMessage via _meta is fine, but ensure the toast fires only when the saga confirms success. If the saga already handles success/failure toasts centrally, avoid duplicating or preempting here.

Suggested verification:

#!/bin/bash
# Inspect saga/reducer to confirm success-gated toast behavior
rg -nP "putConfigWorker|toastMessage|updateToast|try\s*\{|catch\s*\(" -C2 admin-ui app redux
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 114285b and 2696021.

📒 Files selected for processing (2)
  • admin-ui/app/redux/sagas/AuthSaga.ts (1 hunks)
  • admin-ui/plugins/admin/components/Settings/SettingsPage.js (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
admin-ui/plugins/admin/components/Settings/SettingsPage.js (3)
admin-ui/plugins/user-management/types/CommonTypes.ts (1)
  • ThemeContext (13-17)
admin-ui/app/utils/pagingUtils.ts (1)
  • getPagingSize (1-24)
admin-ui/app/utils/PermChecker.ts (1)
  • buildPayload (153-160)
admin-ui/app/redux/sagas/AuthSaga.ts (1)
admin-ui/app/redux/api/backend-api.ts (1)
  • putServerConfiguration (15-25)
🔇 Additional comments (7)
admin-ui/app/redux/sagas/AuthSaga.ts (1)

61-64: LGTM! Good separation of metadata from config data.

The destructuring pattern cleanly separates metadata (_meta) from the actual configuration data, ensuring that only the relevant config fields are sent to the backend API. This aligns correctly with the putServerConfiguration API signature.

admin-ui/plugins/admin/components/Settings/SettingsPage.js (6)

38-40: Good: ThemeContext access is safely guarded.

Optional chaining with a sane default avoids runtime errors in tests/SSR.


58-62: Good: window access guarded for SSR/tests.

Memoized, safe fallback to 'N/A' prevents crashes outside the browser.


45-50: Nice: default paging size derived from options.

Keeps defaults aligned with the UI list; avoids drift.


89-95: Nice: deduplicated ACR scripts with Set.

Prevents duplicate options while preserving SIMPLE_PASSWORD_AUTH.


199-209: Good: select uses string values and parses to number.

Aligns with HTML select semantics; stable option keys used.


301-306: Save wiring looks correct.

saveHandler points to formik.handleSubmit; buttons disabled based on dirty/errors; Cancel resets both form and paging size.

Quick manual check:

  • Change a field → Save enabled.
  • Click Save → verify state updates and Save disables after success.
  • Change paging size only → Save enabled; Cancel restores previous saved size.

@sonarqubecloud
Copy link

Copy link
Contributor

@duttarnab duttarnab left a comment

Choose a reason for hiding this comment

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

image

For Users page the default rows/page is 10 although I have set it to 10 in settings page.

@duttarnab duttarnab merged commit a4b296b into main Oct 30, 2025
9 checks passed
@duttarnab duttarnab deleted the admin-ui-issue-2388 branch October 30, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-admin-ui Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect cancel button behaviour in the Application Settings page in Home module.

3 participants