Add a Workflows page that manages ComfyUI workflow JSON files as a first-class library alongside loras/checkpoints/embeddings: - opt-in via the new 'Workflow Management' settings toggle (default off) - dedicated workflow folder roots with sidecar/preview support, separate from ComfyUI's own workflow storage; 'Send to ComfyUI' loads a workflow straight into the graph - workflow scanner parses the graph document (UI/API format sniffing, node classes, model/civitai refs) and persists the analysis in the SQLite model cache - settings UI: workflow folder paths editor in the Library tab and the standalone Model Paths page Fixes from sandbox E2E verification: - include the workflow scanner in startup initialization so the page no longer hangs on 'initializing' when enabled without folders - add the missing workflows entry to the frontend page-state map (page init crashed and the sidebar fell back to the loras tree without it) - project workflow analysis fields through the scanner cache entry and persist them in the model cache (new columns with auto-migration) - keep symlinked paths intact in the directory picker (abspath instead of resolve), so stored library paths match what the user sees on disk Also rebuilds the vue-widgets bundle to sync it with web/comfyui/utils.js.
63 lines
2.1 KiB
JavaScript
63 lines
2.1 KiB
JavaScript
// WorkflowControls.js - Specific implementation for the Workflows page
|
|
import { PageControls } from './PageControls.js';
|
|
import { getModelApiClient, resetAndReload } from '../../api/modelApiFactory.js';
|
|
import { showToast } from '../../utils/uiHelpers.js';
|
|
import { downloadManager } from '../../managers/DownloadManager.js';
|
|
|
|
/**
|
|
* WorkflowControls class - Extends PageControls for the Workflows page
|
|
* (ComfyUI workflow JSON resources)
|
|
*/
|
|
export class WorkflowControls extends PageControls {
|
|
constructor() {
|
|
// Initialize with 'workflows' page type
|
|
super('workflows');
|
|
|
|
// Register API methods specific to the Workflows page
|
|
this.registerWorkflowAPI();
|
|
}
|
|
|
|
/**
|
|
* Register workflow-specific API methods
|
|
*/
|
|
registerWorkflowAPI() {
|
|
const workflowAPI = {
|
|
// Core API functions
|
|
loadMoreModels: async (resetPage = false, updateFolders = false) => {
|
|
return await getModelApiClient().loadMoreWithVirtualScroll(resetPage, updateFolders);
|
|
},
|
|
|
|
resetAndReload: async (updateFolders = false) => {
|
|
return await resetAndReload(updateFolders);
|
|
},
|
|
|
|
// Add fetch from Civitai functionality for workflows
|
|
fetchFromCivitai: async () => {
|
|
return await getModelApiClient().fetchCivitaiMetadata();
|
|
},
|
|
|
|
// Add show download modal functionality
|
|
showDownloadModal: () => {
|
|
downloadManager.showDownloadModal();
|
|
},
|
|
|
|
toggleBulkMode: () => {
|
|
if (window.bulkManager) {
|
|
window.bulkManager.toggleBulkMode();
|
|
} else {
|
|
console.error('Bulk manager not available');
|
|
}
|
|
},
|
|
|
|
// No clearCustomFilter implementation is needed for workflows
|
|
// as custom filters are currently only used for LoRAs
|
|
clearCustomFilter: async () => {
|
|
showToast('toast.filters.noCustomFilterToClear', {}, 'info');
|
|
}
|
|
};
|
|
|
|
// Register the API
|
|
this.registerAPI(workflowAPI);
|
|
}
|
|
}
|