mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-06-10 12:59:24 -03:00
feat(recipe): add reimport UI with context menus, progress display, and i18n
- Single recipe right-click menu: Re-import from Source - Bulk context menu: Re-import Metadata for Selected - Progress overlay with LoadingManager for single and bulk operations - Virtual scroller data lookup (replaces fragile DOM querySelector) - Fix dynamic import path for resetAndReload on recipe pages - Add translation keys for all 9 supported languages
This commit is contained in:
@@ -97,6 +97,9 @@ export class RecipeContextMenu extends BaseContextMenu {
|
||||
// Repair recipe metadata
|
||||
this.repairRecipe(recipeId);
|
||||
break;
|
||||
case 'reimport':
|
||||
this.reimportRecipe(recipeId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,6 +328,35 @@ export class RecipeContextMenu extends BaseContextMenu {
|
||||
showToast('recipes.contextMenu.repair.failed', { message: error.message }, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async reimportRecipe(recipeId) {
|
||||
if (!recipeId) {
|
||||
showToast('recipes.contextMenu.reimport.missingId', {}, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
state.loadingManager.showSimpleLoading('Re-importing recipe from source...');
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/lm/recipe/${recipeId}/reimport`, {
|
||||
method: 'POST'
|
||||
});
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
state.loadingManager.hide();
|
||||
showToast('toast.recipes.reimportSuccess', {}, 'success');
|
||||
const { resetAndReload } = await import('../../api/recipeApi.js');
|
||||
resetAndReload(false, { preserveScroll: true });
|
||||
} else {
|
||||
throw new Error(result.error || 'Re-import failed');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error reimporting recipe:', error);
|
||||
state.loadingManager.hide();
|
||||
showToast('recipes.contextMenu.reimport.failed', { message: error.message }, 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mix in shared methods from ModelContextMenuMixin
|
||||
|
||||
Reference in New Issue
Block a user