-
Notifications
You must be signed in to change notification settings - Fork 502
feat: Add getImportFailInfoBulk function to comfyManagerService #4626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,20 @@ import { isAbortError } from '@/utils/typeGuardUtil' | |
| const GENERIC_SECURITY_ERR_MSG = | ||
| 'Forbidden: A security error has occurred. Please check the terminal logs' | ||
|
|
||
| // TODO: These types will be auto-generated once ComfyUI-Manager types are updated | ||
| // After the ComfyUI-Manager PR is merged and types are generated, replace these with the generated types | ||
| interface ImportFailInfoBulkRequest { | ||
| cnr_ids?: string[] | ||
| urls?: string[] | ||
| } | ||
|
|
||
| interface ImportFailInfoItem { | ||
| error?: string | null | ||
| traceback?: string | null | ||
| } | ||
|
|
||
| type ImportFailInfoBulkResponse = Record<string, ImportFailInfoItem | null> | ||
|
|
||
| /** | ||
| * API routes for ComfyUI Manager | ||
| */ | ||
|
|
@@ -32,6 +46,7 @@ enum ManagerRoute { | |
| GET_NODES = 'customnode/getmappings', | ||
| GET_PACKS = 'customnode/getlist', | ||
| IMPORT_FAIL_INFO = 'customnode/import_fail_info', | ||
| IMPORT_FAIL_INFO_BULK = 'v2/customnode/import_fail_info_bulk', | ||
| REBOOT = 'manager/reboot' | ||
| } | ||
|
|
||
|
|
@@ -154,6 +169,35 @@ export const useComfyManagerService = () => { | |
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Retrieves import failure information for multiple custom nodes in bulk | ||
| * @param params - Object containing arrays of cnr_ids or urls to check | ||
| * @param signal - Optional AbortSignal for request cancellation | ||
| * @returns Dictionary mapping each cnr_id/url to its import failure info (or null if no failure) | ||
| */ | ||
| const getImportFailInfoBulk = async ( | ||
| params: ImportFailInfoBulkRequest, | ||
| signal?: AbortSignal | ||
| ) => { | ||
| const errorContext = 'Fetching bulk import failure information' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [quality] medium Priority\n\nIssue: Hard-coded error message violates internationalization requirements\nContext: According to CLAUDE.md line 35, all user-facing strings must use vue-i18n - no hard-coded text in services/utilities\nSuggestion: Replace with i18n key and add translation entry in src/locales/en/main.json |
||
| const routeSpecificErrors = { | ||
| 400: 'Bad Request: Either cnr_ids or urls field is required' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [quality] high Priority\n\nIssue: Hard-coded error message violates internationalization requirements\nContext: According to CLAUDE.md line 35, all user-facing strings must use vue-i18n - no hard-coded text in services/utilities\nSuggestion: Replace with i18n key and add translation entry in src/locales/en/main.json |
||
| } | ||
|
|
||
| // Validate that at least one field is provided | ||
| if (!params.cnr_ids?.length && !params.urls?.length) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [architecture] medium Priority\n\nIssue: Validation logic inconsistency between client and server\nContext: Client throws error before making API call, but the API also handles 400 errors for the same validation. This creates potential race conditions and inconsistent error handling paths\nSuggestion: Either handle all validation on the server side and let the API return 400, or ensure client validation exactly matches server validation rules |
||
| throw new Error('Either cnr_ids or urls field is required') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [quality] high Priority\n\nIssue: Hard-coded error message violates internationalization requirements\nContext: According to CLAUDE.md line 35, all user-facing strings must use vue-i18n - no hard-coded text in services/utilities\nSuggestion: Replace with i18n key and add translation entry in src/locales/en/main.json |
||
| } | ||
|
|
||
| return executeRequest<ImportFailInfoBulkResponse>( | ||
| () => | ||
| managerApiClient.post(ManagerRoute.IMPORT_FAIL_INFO_BULK, params, { | ||
| signal | ||
| }), | ||
| { errorContext, routeSpecificErrors } | ||
| ) | ||
| } | ||
|
|
||
| const installPack = async ( | ||
| params: InstallPackParams, | ||
| signal?: AbortSignal | ||
|
|
@@ -260,6 +304,7 @@ export const useComfyManagerService = () => { | |
| // Pack management | ||
| listInstalledPacks, | ||
| getImportFailInfo, | ||
| getImportFailInfoBulk, | ||
| installPack, | ||
| uninstallPack, | ||
| enablePack: installPack, // enable is done via install | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[quality] low Priority\n\nIssue: Missing JSDoc documentation for type interfaces\nContext: While the function has good JSDoc, the temporary type interfaces lack documentation explaining their structure and usage\nSuggestion: Add JSDoc comments to ImportFailInfoBulkRequest, ImportFailInfoItem, and ImportFailInfoBulkResponse interfaces