Add option to create instance if not already exist from git/npm/URL
This enhancement adds a user-facing checkbox option "Create instance if not already exist" to the GitHubInstallDialog, allowing users to automatically create an adapter instance after installing from Git, npm, or custom URLs only when no instances already exist.
Background
Previously, when users installed adapters via Git/npm/URL, the adapter would be installed but no instance would be created automatically. Users had to manually navigate to the Adapters tab and click the "+" button to create an instance, which was an additional step that many users expected to happen automatically.
Solution
Added a checkbox control to all three installation tabs (GitHub, npm, URL) in the GitHubInstallDialog that intelligently determines when to create instances. When checked, the system will:
- Install the adapter as normal
- Automatically create an instance only if no instances already exist
- Skip instance creation for adapter updates where instances exist
- Bypass the instance creation dialog for a streamlined experience
Key Features
- Smart Default Behavior: Checkbox defaults to checked only when no instances exist for the selected adapter
- Update-Friendly: Accounts for scenarios where users are updating existing adapters
- Dynamic Updates: Checkbox state automatically updates when users select different adapters
- Persistent Preference: User choices are saved in localStorage for convenience
- All Installation Types: Works with GitHub, npm, and custom URL installations
- Backward Compatible: Existing behavior unchanged when checkbox is unchecked
- Internationalized: Includes translations for English and German
Technical Implementation
- Modified
GitHubInstallDialog.tsxto add checkbox UI, state management, and instance checking logic - Added
hasExistingInstances()method to check adapter instance count from installed adapters - Added
updateCreateInstanceForAdapter()to dynamically update checkbox state on adapter selection - Updated
AdapterInstallDialog.tsxaddInstance method to respect the createInstance parameter - Enhanced installation flow in
Adapters.tsxto pass the option through - Updated translations from "Create instance after installation" to "Create instance if not already exist"
The implementation follows the suggestion from @Apollon77 to handle this through a dialog option rather than requiring js-controller changes, with enhanced logic based on feedback from @GermanBluefox.
Testing
- All builds pass successfully
- Linting passes without errors
- Code follows existing style guidelines and patterns
- No breaking changes to existing functionality
- Development server validates UI changes work correctly
This addresses the user need expressed in the issue: "I as user want to have an instance of newly installed adapter via git/npm automatically" while intelligently handling both new installations and adapter updates.
Addressing #2693.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
@copilot The option must be "Create instance if not already exist" and it must be checked before installation if not any instance already exist as the user could just make an update of the existing adapter
@copilot The option must be "Create instance if not already exist" and it must be checked before installation if not any instance already exist as the user could just make an update of the existing ad...
Updated the implementation as requested in commit c5e4f2e:
- ✅ Changed checkbox text to "Create instance if not already exist" (updated both English and German translations)
- ✅ Checkbox is now checked by default BEFORE installation only when no instances already exist for the selected adapter
- ✅ Added logic to check existing instances using the
installedprop and automatically update checkbox state when adapter selection changes - ✅ Properly handles update scenarios where users might just be updating existing adapters
The checkbox now intelligently defaults to checked only when it would be beneficial to create an instance, while preserving user preferences when they explicitly set the checkbox state.