Skip to content

Conversation

@RohitBhati8269
Copy link
Contributor

@RohitBhati8269 RohitBhati8269 commented Jan 5, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Role field is now read-only when editing existing memberships, preventing changes to role after creation.
    • Name field is now read-only when editing existing variables, preventing renaming of existing parameters.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Walkthrough

Two UI schema files were changed to add disabled-state logic: the membership role field and the variable name field are now disabled when editing existing records, allowing changes only for new entries.

Changes

Cohort / File(s) Summary
Membership schema field restrictions
web/pgadmin/browser/server_groups/servers/static/js/membership.ui.js
Added a closure-based disabled(state) implementation for the role field in MembershipSchema.baseFields that returns true when the state is not a new entry, preventing role edits on existing memberships.
Variable schema field restrictions
web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js
Added disabled(state) to the name field in VariableSchema.baseFields so the name is editable only for new variables and disabled when editing existing ones.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: disabling membership and parameter fields when editing existing objects instead of creating new ones.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 663ce02 and c5d5278.

📒 Files selected for processing (2)
  • web/pgadmin/browser/server_groups/servers/static/js/membership.ui.js
  • web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js
  • web/pgadmin/browser/server_groups/servers/static/js/membership.ui.js

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

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

Copy link

@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: 0

🧹 Nitpick comments (2)
web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js (1)

172-174: LGTM! Correctly disables the name field for existing entries.

The logic properly prevents editing the parameter name when modifying an existing entry, which is appropriate since the name serves as the identifier.

Optional: Use arrow function for style consistency

The codebase predominantly uses arrow functions (see lines 167, 186, etc.). Consider using an arrow function for consistency:

-        disabled: function (state) {
-          return !obj.isNew(state);
-        },
+        disabled: (state) => !obj.isNew(state),
web/pgadmin/browser/server_groups/servers/static/js/membership.ui.js (1)

42-44: LGTM! Correctly disables the role field for existing memberships.

The logic properly prevents editing the role field when modifying an existing membership, which is appropriate since the role serves as the identifier.

Optional: Use arrow function for style consistency

The codebase uses arrow functions elsewhere (see line 53). Consider using an arrow function for consistency:

-      disabled: function (state) {
-        return !obj.isNew(state);
-      },
+      disabled: (state) => !obj.isNew(state),
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79de352 and 663ce02.

📒 Files selected for processing (2)
  • web/pgadmin/browser/server_groups/servers/static/js/membership.ui.js
  • web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js
🧰 Additional context used
🧬 Code graph analysis (1)
web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js (1)
web/pgadmin/static/js/SchemaView/MappedControl.jsx (2)
  • state (315-315)
  • state (351-351)
🔇 Additional comments (1)
web/pgadmin/browser/server_groups/servers/static/js/membership.ui.js (1)

32-32: Good: Closure variable for accessing schema instance.

The obj reference is necessary to access the isNew method within the disabled callback closure.

@akshay-joshi akshay-joshi merged commit d30fd5d into pgadmin-org:master Jan 6, 2026
31 of 43 checks passed
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.

2 participants