Skip to content

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

Open
dpage wants to merge 1 commit intopgadmin-org:masterfrom
dpage:fix_qt_layout
Open

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

Conversation

@dpage
Copy link
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

    • Fixed layout loading behavior to properly handle cases when no saved configuration exists
    • Corrected panel focus management to prevent newly added panels from unexpectedly taking focus away from active tabs
    • Adjusted Query Tool tab order to improve navigation workflow
  • Improvements

    • Enhanced LLM feature availability detection using dynamic runtime checks instead of relying on static configuration values

- 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).
@coderabbitai
Copy link

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: 86c95e42-e9b5-4634-bbb3-6a66cce3ad31

📥 Commits

Reviewing files that changed from the base of the PR and between 2576548 and 4d69ec2.

📒 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

Walkthrough

Three files modified to enhance LLM integration by dynamically checking enabled status, improve layout panel management with better focus restoration when adding missing tabs, and reorder Query Tool tabs to position Query History after the AI Assistant panel.

Changes

Cohort / File(s) Summary
LLM Configuration
web/pgadmin/browser/__init__.py
Changed llm_enabled flag determination to call pgadmin.llm.utils.is_llm_enabled() dynamically instead of reading static config.LLM_ENABLED.
Layout Panel Management
web/pgadmin/static/js/helpers/Layout/index.jsx
Enhanced loadLayout() with early return on falsy input; improved addMissingDefaultPanels() to collect active tab IDs before insertion and explicitly restore focus to previously active tabs.
Query Tool Tab Ordering
web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
Reordered tab definitions to position Query History after AI Assistant panel instead of immediately after Query panel.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 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 'Fix a couple of related issues in the Query Tool layout' directly aligns with the PR objectives of fixing layout-related issues in the Query Tool, though it's somewhat generic and doesn't specify the exact nature of the fixes.

✏️ 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.

this.addMissingDefaultPanels();
} catch {
/* Fallback to default */
this.layoutObj.loadLayout(this.defaultLayout);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is good to have in cases where savedLayout is corrupted.

}
});
};
collectActiveIds(this.layoutObj.getLayout().dockbox);
Copy link
Contributor

Choose a reason for hiding this comment

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

this should have been already taken care by the rc-dock.

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