[bugfix] Fix enable pack functionality to use proper API endpoint (#6157)

## Summary
- Fixed issue where enabling a disabled pack incorrectly triggered
installation instead of using the dedicated enable endpoint
- Added proper `enablePack` method in the manager service layer
- Updated store and component to use the correct API call

## Problem
When users toggled a disabled pack to enable it via `PackEnableToggle`
component, the system was incorrectly calling the install endpoint with
full installation parameters instead of the simpler enable endpoint that
only requires the pack ID.

## Solution
1. **Added dedicated `enablePack` method in `comfyManagerService.ts`**:
   - Uses the `'enable'` task kind with `EnablePackParams`
   - Only requires `cnr_id` parameter (simpler than install)

2. **Updated `comfyManagerStore.ts`**:
   - Created proper `enablePack` function that queues an enable task
- Removed the incorrect aliasing where `enablePack` was pointing to
`installPack`

3. **Simplified `PackEnableToggle.vue`**:
   - Now calls `enablePack` with only required parameters (id, version)
   - Removed unnecessary installation-specific parameters

## Test plan
- [x] Enable a disabled pack and verify it uses the enable endpoint (not
install)
- [x] Confirm the pack is properly enabled after the operation
- [x] Check that the task queue shows "Enabling" message (not
"Installing")
- [x] Verify existing install/uninstall functionality still works

Fixes #6154

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6157-bugfix-Fix-enable-pack-functionality-to-use-proper-API-endpoint-2926d73d3650819fa4caf1b848f99735)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Jin Yi
2025-10-20 15:55:21 +09:00
committed by GitHub
parent 4066fbd2d7
commit 32ed446285
4 changed files with 25 additions and 15 deletions

View File

@@ -317,6 +317,15 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
await enqueueTaskWithLogs(task, t('g.disabling', { id: params.id }))
}
const enablePack = async (params: ManagerPackInfo, signal?: AbortSignal) => {
const enableParams: components['schemas']['EnablePackParams'] = {
cnr_id: params.id
}
const task = (taskId: string) =>
managerService.enablePack(enableParams, taskId, signal)
await enqueueTaskWithLogs(task, t('g.enabling', { id: params.id }))
}
const getInstalledPackVersion = (packId: string) => {
const pack = installedPacks.value[packId]
return pack?.ver
@@ -380,7 +389,7 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
updatePack,
updateAllPacks,
disablePack,
enablePack: installPack // Enable is done via install endpoint with a disabled pack
enablePack
}
})