mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 14:42:11 -03:00
Refactor API routes and enhance recipe and filter management
- Removed the handle_get_recipes method from ApiRoutes to streamline the API structure. - Updated RecipeRoutes to include logging for recipe retrieval requests and improved filter management. - Consolidated filter management logic in FilterManager to support both recipes and loras, enhancing code reusability. - Deleted obsolete LoraSearchManager and RecipeSearchManager classes to simplify the search functionality. - Improved infinite scroll implementation for both recipes and loras, ensuring consistent loading behavior across pages.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { updateService } from '../managers/UpdateService.js';
|
||||
import { toggleTheme } from '../utils/uiHelpers.js';
|
||||
import { SearchManager } from '../managers/SearchManager.js';
|
||||
import { FilterManager } from '../managers/FilterManager.js';
|
||||
|
||||
/**
|
||||
* Header.js - Manages the application header behavior across different pages
|
||||
@@ -27,40 +29,14 @@ export class HeaderManager {
|
||||
}
|
||||
|
||||
initializeManagers() {
|
||||
// Import and initialize appropriate search manager based on page
|
||||
if (this.currentPage === 'loras') {
|
||||
import('../managers/LoraSearchManager.js').then(module => {
|
||||
const { LoraSearchManager } = module;
|
||||
this.searchManager = new LoraSearchManager();
|
||||
window.searchManager = this.searchManager;
|
||||
});
|
||||
|
||||
import('../managers/FilterManager.js').then(module => {
|
||||
const { FilterManager } = module;
|
||||
this.filterManager = new FilterManager();
|
||||
window.filterManager = this.filterManager;
|
||||
});
|
||||
} else if (this.currentPage === 'recipes') {
|
||||
import('../managers/RecipeSearchManager.js').then(module => {
|
||||
const { RecipeSearchManager } = module;
|
||||
this.searchManager = new RecipeSearchManager();
|
||||
window.searchManager = this.searchManager;
|
||||
});
|
||||
|
||||
import('../managers/RecipeFilterManager.js').then(module => {
|
||||
const { RecipeFilterManager } = module;
|
||||
this.filterManager = new RecipeFilterManager();
|
||||
window.filterManager = this.filterManager;
|
||||
});
|
||||
} else if (this.currentPage === 'checkpoints') {
|
||||
import('../managers/CheckpointSearchManager.js').then(module => {
|
||||
const { CheckpointSearchManager } = module;
|
||||
this.searchManager = new CheckpointSearchManager();
|
||||
window.searchManager = this.searchManager;
|
||||
});
|
||||
|
||||
// Note: Checkpoints page might get its own filter manager in the future
|
||||
// For now, we can use a basic filter manager or none at all
|
||||
// Initialize SearchManager for all page types
|
||||
this.searchManager = new SearchManager({ page: this.currentPage });
|
||||
window.searchManager = this.searchManager;
|
||||
|
||||
// Initialize FilterManager for all page types that have filters
|
||||
if (document.getElementById('filterButton')) {
|
||||
this.filterManager = new FilterManager({ page: this.currentPage });
|
||||
window.filterManager = this.filterManager;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user