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.
58 lines
2.0 KiB
JavaScript
58 lines
2.0 KiB
JavaScript
import { appCore } from './core.js';
|
|
import { confirmDelete, closeDeleteModal, confirmExclude, closeExcludeModal } from './utils/modalUtils.js';
|
|
import { createPageControls } from './components/controls/index.js';
|
|
import { ModelDuplicatesManager } from './components/ModelDuplicatesManager.js';
|
|
import { MODEL_TYPES } from './api/apiConfig.js';
|
|
import { initActiveFiltersSync } from './utils/activeFiltersSync.js';
|
|
|
|
// Initialize the Workflows page
|
|
class WorkflowsPageManager {
|
|
constructor() {
|
|
// Initialize page controls
|
|
this.pageControls = createPageControls(MODEL_TYPES.WORKFLOW);
|
|
|
|
// Initialize the ModelDuplicatesManager
|
|
this.duplicatesManager = new ModelDuplicatesManager(this, MODEL_TYPES.WORKFLOW);
|
|
|
|
// Expose only necessary functions to global scope
|
|
this._exposeRequiredGlobalFunctions();
|
|
}
|
|
|
|
_exposeRequiredGlobalFunctions() {
|
|
// Minimal set of functions that need to remain global
|
|
window.confirmDelete = confirmDelete;
|
|
window.closeDeleteModal = closeDeleteModal;
|
|
window.confirmExclude = confirmExclude;
|
|
window.closeExcludeModal = closeExcludeModal;
|
|
|
|
// Expose duplicates manager
|
|
window.modelDuplicatesManager = this.duplicatesManager;
|
|
}
|
|
|
|
async initialize() {
|
|
// Initialize common page features (including context menus)
|
|
appCore.initializePageFeatures();
|
|
|
|
// Mirror active filters to the backend for the ComfyUI-side autocomplete
|
|
initActiveFiltersSync(MODEL_TYPES.WORKFLOW);
|
|
|
|
console.log('Workflows Manager initialized');
|
|
}
|
|
}
|
|
|
|
async function initializeWorkflowsPage() {
|
|
// Initialize core application
|
|
await appCore.initialize();
|
|
|
|
// Initialize workflows page
|
|
const workflowsPage = new WorkflowsPageManager();
|
|
await workflowsPage.initialize();
|
|
|
|
return workflowsPage;
|
|
}
|
|
|
|
// Initialize everything when DOM is ready
|
|
document.addEventListener('DOMContentLoaded', initializeWorkflowsPage);
|
|
|
|
export { WorkflowsPageManager, initializeWorkflowsPage };
|