Skip to content

Fix a couple of related issues in the Query Tool layout.#9781

Merged
khushboovashi merged 1 commit intopgadmin-org:masterfrom
dpage:fix_qt_layout
Mar 27, 2026
Merged

Fix a couple of related issues in the Query Tool layout.#9781
khushboovashi merged 1 commit intopgadmin-org:masterfrom
dpage:fix_qt_layout

Conversation

@dpage
Copy link
Copy Markdown
Contributor

@dpage dpage commented Mar 23, 2026

  • Hide the AI Assistant tab if AI is disabled or uncofnigured.
  • Ensure the AI Assistant tab is not the first one shown (that should be the Query tab - saved layouts may need a reset).

Summary by CodeRabbit

  • Bug Fixes

    • Prevented errors when no saved layout exists and preserved the default layout.
    • Restored prior tab focus after adding missing panels to avoid unexpected focus shifts.
    • Adjusted Query Tool tab ordering to improve navigation flow and consistency.
  • Improvements

    • LLM availability is now checked dynamically at request time for more accurate feature exposure.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 851fc6ba-6969-4b1f-bff3-e5a5f5351065

📥 Commits

Reviewing files that changed from the base of the PR and between 4393e64 and ce99826.

📒 Files selected for processing (3)
  • web/pgadmin/browser/__init__.py
  • web/pgadmin/static/js/helpers/Layout/index.jsx
  • web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
✅ Files skipped from review due to trivial changes (2)
  • web/pgadmin/browser/init.py
  • web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/pgadmin/static/js/helpers/Layout/index.jsx

Walkthrough

llm_enabled is determined at request time via pgadmin.llm.utils.is_llm_enabled(); layout loading avoids parsing falsy input and restores focus when adding default panels; Query Tool tab ordering now places Query History after the conditional AI Assistant panel.

Changes

Cohort / File(s) Summary
LLM Configuration
web/pgadmin/browser/__init__.py
Compute llm_enabled at request time by calling pgadmin.llm.utils.is_llm_enabled() instead of reading config.LLM_ENABLED.
Layout Panel Management
web/pgadmin/static/js/helpers/Layout/index.jsx
loadLayout(savedLayout) returns early for falsy input; addMissingDefaultPanels() exits when nothing to add, collects current panel activeIds before inserting missing tabs, and restores focus to previously active tabs after insertion.
Query Tool Tab Ordering
web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
Reordered default tabs so Query History is inserted after the conditional AI Assistant panel (pgAdmin.llm_enabled ? [...] : []).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective of the pull request—fixing layout-related issues in the Query Tool by properly handling the AI Assistant tab visibility and initial tab focus.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@dpage dpage force-pushed the fix_qt_layout branch 2 times, most recently from 057b73d to 4393e64 Compare March 26, 2026 12:07
- Hide the AI Assistant tab if AI is disabled or uncofnigured.
- Ensure the AI Assistant tab is not the first one shown (that should be the Query tab - saved layouts may need a reset).
@khushboovashi khushboovashi merged commit bf64942 into pgadmin-org:master Mar 27, 2026
33 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.

3 participants