mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-16 18:17:36 -03:00
feat(ui): add Open Source URL action to recipe modal header, align header styles with model modal
This commit is contained in:
@@ -383,6 +383,7 @@ class RecipeModal {
|
||||
|
||||
this.syncGenerationParams(hydratedRecipe.gen_params);
|
||||
this.syncResourcesSection(hydratedRecipe);
|
||||
this.syncSourceUrlAction();
|
||||
|
||||
// Show the modal
|
||||
modalManager.showModal('recipeModal');
|
||||
@@ -515,6 +516,7 @@ class RecipeModal {
|
||||
} else {
|
||||
this.updateSourceUrlDisplay(this.currentRecipe.source_path || '');
|
||||
}
|
||||
this.syncSourceUrlAction();
|
||||
}
|
||||
|
||||
getPreviewMediaUrl(recipe = {}) {
|
||||
@@ -582,6 +584,30 @@ class RecipeModal {
|
||||
}
|
||||
}
|
||||
|
||||
syncSourceUrlAction() {
|
||||
const actionsContainer = document.getElementById('recipeHeaderActions');
|
||||
if (!actionsContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
actionsContainer.innerHTML = '';
|
||||
|
||||
const sourcePath = this.currentRecipe?.source_path || '';
|
||||
const isValidUrl = sourcePath.startsWith('http://') || sourcePath.startsWith('https://');
|
||||
if (!isValidUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = document.createElement('button');
|
||||
btn.className = 'recipe-source-url-btn';
|
||||
btn.title = sourcePath;
|
||||
btn.innerHTML = '<i class="fas fa-globe"></i> Open Source URL';
|
||||
btn.addEventListener('click', () => {
|
||||
window.open(sourcePath, '_blank');
|
||||
});
|
||||
actionsContainer.appendChild(btn);
|
||||
}
|
||||
|
||||
syncTagsDisplay(tags) {
|
||||
const tagsContainer = document.getElementById('recipeTagsCompact');
|
||||
if (!tagsContainer) {
|
||||
@@ -1316,6 +1342,7 @@ class RecipeModal {
|
||||
// Update source URL in the UI
|
||||
this.commitField('source_path');
|
||||
this.updateSourceUrlDisplay(newSourceUrl, { forceInputSync: true });
|
||||
this.syncSourceUrlAction();
|
||||
|
||||
// Update the current recipe object
|
||||
this.currentRecipe.source_path = newSourceUrl;
|
||||
|
||||
Reference in New Issue
Block a user