Skip to content

Conversation

rabea-al
Copy link
Contributor

@rabea-al rabea-al commented Sep 3, 2025

Description

This PR addresses two issues with template library installation:

  1. Duplicate prompts for already installed libraries

    • Added canon() function to normalize library names (e.g., xai_flaskflask) before comparison.
    • Prevents re-install prompts when libraries are already present.
  2. Multiple confirmation dialogs for missing libraries

    • Replaced per-library confirmations with a single aggregated confirm dialog listing all missing libraries.
    • Uses handleInstall(..., { silent: true }) to skip internal confirms and only show one confirmation to the user.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

1. Already installed libraries

Goal: Ensure templates no longer prompt for libraries that are already installed.
Steps:

  1. Install xai_flask libraries.
  2. Open Service Template from the Launcher.
  3. Verify: no confirmation dialog appears for this library, and the template open directly.

2. Missing library

Goal: Confirm dialog appears only once when one library is missing.
Steps:

  1. Uninstall or remove the xai_agent and xai_openai libraries.

  2. Open Agent Template.

  3. Verify:

    • A single confirm dialog appears asking to install AGENT and OPENAI.
    • After accepting, the install runs silently.
    • Template file opens automatically.

3. Cancel install

Goal: Verify user cancellation aborts correctly.
Steps:

  1. Uninstall xai_agent.

  2. Open Agent Template.

  3. In the confirm dialog, click Cancel.

  4. Verify:

    • No library install occurs.
    • Template is not opened.

Tested on? Specify Version.

  • Windows
  • Linux
  • Mac
  • Others (State here -> xxx )

Copy link

github-actions bot commented Sep 3, 2025

Binder 👈 Launch a binder notebook on branch rabea-al/xircuits/fix/template-install-check

Copy link
Member

@MFA-X-AI MFA-X-AI left a comment

Choose a reason for hiding this comment

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

Okay so for this, I'd like you to rework it so it doesn't add complexity. I don't like having to add another parameter to pass or introduce a silent state just for this one case. Let's just make it a simple, check if the template required libs are already installed, then if not, prompt the install.

@rabea-al
Copy link
Contributor Author

rabea-al commented Oct 7, 2025

I've addressed your feedback and reworked this part as follows:

  • Reworked the template installation flow to gather all missing libraries and show a single confirmation prompt before installation.
  • Added installLibrarySilently for non-interactive, batch install scenarios (used after the unified confirmation).
  • Unified installed library detection using loadLibraryIndex and normalized library IDs instead of raw names.
  • Removed the unnecessary silent flag from handleInstall and simplified its usage.

@rabea-al rabea-al requested a review from MFA-X-AI October 7, 2025 13:31
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