mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 06:32:12 -03:00
Refactor RecipeManager and ImportManager for improved functionality
- Removed deprecated global functions from RecipeManager to streamline the API and enhance clarity. - Updated the import handling in ImportManager to directly call loadRecipes on the RecipeManager, ensuring better integration. - Adjusted the recipes.html template to utilize the ImportManager for showing the import modal, improving code consistency.
This commit is contained in:
@@ -56,22 +56,7 @@ class RecipeManager {
|
||||
_exposeGlobalFunctions() {
|
||||
// Only expose what's needed for the page
|
||||
window.recipeManager = this;
|
||||
window.importRecipes = () => this.importRecipes();
|
||||
window.importManager = this.importManager;
|
||||
|
||||
// Deprecated - kept for backwards compatibility
|
||||
window.loadMoreRecipes = () => {
|
||||
console.warn('loadMoreRecipes is deprecated, use infiniteScroll instead');
|
||||
this.pageState.currentPage++;
|
||||
this.loadRecipes(false);
|
||||
};
|
||||
|
||||
// Add appendRecipeCards function for compatibility
|
||||
window.appendRecipeCards = (recipes) => {
|
||||
console.warn('appendRecipeCards is deprecated, use recipeManager.updateRecipesGrid instead');
|
||||
const data = { items: recipes, has_more: false };
|
||||
this.updateRecipesGrid(data, false);
|
||||
};
|
||||
}
|
||||
|
||||
initEventListeners() {
|
||||
@@ -140,6 +125,8 @@ class RecipeManager {
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
console.log('Recipes data:', data);
|
||||
|
||||
// Update recipes grid
|
||||
this.updateRecipesGrid(data, resetPage);
|
||||
@@ -205,11 +192,6 @@ class RecipeManager {
|
||||
showRecipeDetails(recipe) {
|
||||
this.recipeModal.showRecipeDetails(recipe);
|
||||
}
|
||||
|
||||
// Add a method to handle recipe import
|
||||
importRecipes() {
|
||||
this.importManager.showImportModal();
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize components
|
||||
|
||||
Reference in New Issue
Block a user