mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-07 18:12:12 -03:00
The sidebar's folder tree merges every model root into one relative-path
namespace, but folder operations turned a node into a path by prefixing
default_*_root. A folder living under another root failed to delete with
"Folder no longer exists" (recipes under the primary lora root while
default_lora_root is the extra one), and where the same relative folder
exists in both roots the operation silently hit the other copy — 14 of the
16 top-level folders in the reporting library are shared, so guessing a root
was never safe.
Backend:
* ModelMoveService.resolve_folder() and GET /api/lm/{prefix}/resolve-folder
answer which directories a library-relative folder maps to
(folder_path/root/is_symlink), in scanner root order, skipping directories
no root holds and refusing absolute or climbing paths.
* delete_folder/rename_folder tag a vanished directory with code "missing"
so the sidebar can tell "this node is stale, refresh" from a failed
operation.
Frontend:
* _resolveFolderCandidates() is the single place that turns a node into
absolute paths: default root first, the old root-prefix fallback only
while a single root is configured, and an explicit unresolved error for a
multi-root library — nothing is guessed silently any more.
* One copy keeps the single-target modal, which now names the resolved
absolute path. Several copies render one checkbox row per copy, each
dry-run against the delete guard ("no models" / "contains N model
file(s)..." / a deletion is still pending / no longer exists / symbolic
link): a blocked copy is unticked, disabled and explained, the button
reads "Delete N folders", every ticked copy is deleted and guarded on its
own, and a partial failure is reported without discarding the successes.
* Rows are built once per open and only their status text is updated, so
ticking a box no longer rebuilds the list, steals focus or resizes the
modal mid-click; the action row keeps a fixed button width.
* Rename offers a root picker in its inline row, create inherits the
parent's root when the parent resolves to exactly one directory, and the
undo restores every copy a delete removed.
i18n: 26 new keys (sidebar.deleteFolderModal.*, .deleteFolderResult.*,
.renameFolderResult.*, .folderRoot.*, .folderResult.*) translated in all 9
locales, with the en wording normalized to the established "model root" noun
(it had said "library root") and the new terminology recorded in
docs/i18n-translation-guidelines.md.
Verified: pytest 3686 passed, vitest 1473 passed (86 in the folder-management
suite), pytest tests/i18n 20 passed, sync_translation_keys.py --dry-run
clean. A sandboxed standalone instance with two roots confirmed that deleting
one copy leaves the node in place, that the twin's model card survives the
purge, and that deleting both copies and undoing restores both directories.
210 lines
11 KiB
HTML
210 lines
11 KiB
HTML
<!-- Delete Confirmation Modal -->
|
|
<div id="deleteModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2>{{ t('modals.deleteModel.title') }}</h2>
|
|
<p class="delete-message">{{ t('modals.deleteModel.message') }}</p>
|
|
<div class="delete-model-info"></div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" onclick="closeDeleteModal()">{{ t('common.actions.cancel') }}</button>
|
|
<button class="delete-btn" onclick="confirmDelete()">{{ t('common.actions.delete') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Exclude Confirmation Modal -->
|
|
<div id="excludeModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2>{{ t('modals.excludeModel.title') }}</h2>
|
|
<p class="delete-message">{{ t('modals.excludeModel.message') }}</p>
|
|
<div class="exclude-model-info"></div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" onclick="closeExcludeModal()">{{ t('common.actions.cancel') }}</button>
|
|
<button class="exclude-btn" onclick="confirmExclude()">{{ t('modals.exclude.confirm') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recipes Duplicate Delete Confirmation Modal -->
|
|
<div id="duplicateDeleteModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2>{{ t('modals.deleteDuplicateRecipes.title') }}</h2>
|
|
<p class="delete-message">{{ t('modals.deleteDuplicateRecipes.message') }}</p>
|
|
<div class="delete-model-info">
|
|
<p><span id="duplicateDeleteCount">0</span> {{ t('modals.deleteDuplicateRecipes.countMessage') }}</p>
|
|
</div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" onclick="modalManager.closeModal('duplicateDeleteModal')">{{ t('common.actions.cancel') }}</button>
|
|
<button class="delete-btn" onclick="recipeManager.confirmDeleteDuplicates()">{{ t('common.actions.delete') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Models Duplicate Delete Confirmation Modal -->
|
|
<div id="modelDuplicateDeleteModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2>{{ t('modals.deleteDuplicateModels.title') }}</h2>
|
|
<p class="delete-message">{{ t('modals.deleteDuplicateModels.message') }}</p>
|
|
<div class="delete-model-info">
|
|
<p><span id="modelDuplicateDeleteCount">0</span> {{ t('modals.deleteDuplicateModels.countMessage') }}</p>
|
|
</div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" onclick="modalManager.closeModal('modelDuplicateDeleteModal')">{{ t('common.actions.cancel') }}</button>
|
|
<button class="delete-btn" onclick="modelDuplicatesManager.confirmDeleteDuplicates()">{{ t('common.actions.delete') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bulk Delete Confirmation Modal -->
|
|
<div id="bulkDeleteModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2>{{ t('modals.bulkDelete.title') }}</h2>
|
|
<p class="delete-message">{{ t('modals.bulkDelete.message') }}</p>
|
|
<div class="delete-model-info">
|
|
<p><span id="bulkDeleteCount">0</span> {{ t('modals.bulkDelete.countMessage') }}</p>
|
|
</div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" onclick="modalManager.closeModal('bulkDeleteModal')">{{ t('common.actions.cancel') }}</button>
|
|
<button class="delete-btn" onclick="bulkManager.confirmBulkDelete()">{{ t('modals.bulkDelete.action') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Check Updates Confirmation Modal -->
|
|
<div id="checkUpdatesConfirmModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2 data-role="title"></h2>
|
|
<p class="confirmation-message" data-role="message"></p>
|
|
<p class="confirmation-tip" data-role="tip"></p>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" data-action="cancel-check-updates">{{ t('common.actions.cancel') }}</button>
|
|
<button class="primary-btn" data-action="confirm-check-updates">{{ t('modals.checkUpdates.action') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filename Template Apply/Revert Confirmation Modal
|
|
Self-managed by SettingsManager (NOT registered with ModalManager): it
|
|
stacks above the settings modal, like the directory picker. -->
|
|
<div id="filenameTemplateConfirmModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2 data-role="title"></h2>
|
|
<p class="delete-message" data-role="message"></p>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" data-action="cancel-filename-template">{{ t('common.actions.cancel') }}</button>
|
|
<button class="primary-btn" data-action="confirm-filename-template"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Sidecar Migration Confirmation Modal
|
|
Self-managed by SettingsManager (NOT registered with ModalManager): it
|
|
stacks above the settings modal, like the directory picker. -->
|
|
<div id="sidecarMigrationConfirmModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2 data-role="title"></h2>
|
|
<p class="delete-message" data-role="message"></p>
|
|
<p class="delete-message sidecar-migration-destination" data-role="destination" style="display: none;"></p>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" data-action="cancel-sidecar-migration">{{ t('common.actions.cancel') }}</button>
|
|
<button class="primary-btn" data-action="confirm-sidecar-migration"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Sidebar Folder Delete Confirmation Modal -->
|
|
<!-- Shared by five states: 'confirm' (model-free folder), 'blocked' (the
|
|
subtree still holds models, so a cascade delete is refused), 'busy' (a
|
|
staged delete is still pending), 'missing' (the directory is gone from
|
|
disk) and 'symlink' (every copy is a symbolic link). The roots container
|
|
holds the checkbox list shown when the same relative folder exists under
|
|
several library roots: each copy is guarded on its own and the ticked ones
|
|
are all deleted, since only the absolute paths tell those copies apart. -->
|
|
<div id="deleteFolderModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2 data-role="title">{{ t('sidebar.deleteFolderModal.title') }}</h2>
|
|
<p class="delete-message" data-role="message">{{ t('sidebar.deleteFolderModal.message') }}</p>
|
|
<div class="delete-model-info" data-role="info"></div>
|
|
<div class="delete-folder-roots" data-role="roots"></div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" data-action="cancel-delete-folder">{{ t('common.actions.cancel') }}</button>
|
|
<button class="delete-btn" data-action="confirm-delete-folder">{{ t('sidebar.deleteFolderModal.confirm') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bulk Download Missing LoRAs Confirmation Modal -->
|
|
<div id="bulkDownloadMissingLorasModal" class="modal">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h2>{{ t('modals.bulkDownloadMissingLoras.title') }}</h2>
|
|
<span class="close" onclick="modalManager.closeModal('bulkDownloadMissingLorasModal')">×</span>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p class="confirmation-message" id="bulkDownloadMissingLorasMessage"></p>
|
|
<div class="bulk-download-loras-preview" id="bulkDownloadMissingLorasPreview">
|
|
<p class="preview-title">{{ t('modals.bulkDownloadMissingLoras.previewTitle') }}</p>
|
|
<ul class="bulk-download-loras-list" id="bulkDownloadMissingLorasList"></ul>
|
|
</div>
|
|
<p class="confirmation-note">
|
|
<i class="fas fa-info-circle"></i>
|
|
{{ t('modals.bulkDownloadMissingLoras.note') }}
|
|
</p>
|
|
</div>
|
|
<div class="modal-actions">
|
|
<button class="secondary-btn" onclick="modalManager.closeModal('bulkDownloadMissingLorasModal')">{{ t('common.actions.cancel') }}</button>
|
|
<button class="primary-btn" id="bulkDownloadMissingLorasConfirmBtn" onclick="bulkMissingLoraDownloadManager.confirmDownload()">
|
|
<i class="fas fa-download"></i>
|
|
{{ t('modals.bulkDownloadMissingLoras.downloadButton') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Resolve Filename Conflicts Confirmation Modal -->
|
|
<div id="resolveFilenameConflictsModal" class="modal delete-modal">
|
|
<div class="modal-content delete-modal-content">
|
|
<h2>{{ t('conflictConfirm.title') }}</h2>
|
|
<p class="confirmation-message">{{ t('conflictConfirm.message') }}</p>
|
|
<p class="resolve-conflicts-detail" id="resolveConflictsDetail"></p>
|
|
<div class="resolve-conflicts-impact" id="resolveConflictsImpact"></div>
|
|
<div class="modal-actions">
|
|
<button class="cancel-btn" onclick="modalManager.closeModal('resolveFilenameConflictsModal')">{{ t('common.actions.cancel') }}</button>
|
|
<button class="primary-btn" id="resolveConflictsConfirmBtn" onclick="doctorManager.confirmResolveConflicts()">
|
|
<i class="fas fa-check"></i>
|
|
{{ t('conflictConfirm.confirm') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recipe Rematch Options Modal -->
|
|
<div id="rematchOptionsModal" class="modal">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h2>{{ t('modals.rematchOptions.title') }}</h2>
|
|
<span class="close" onclick="rematchModalManager.cancelOptions()">×</span>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p class="confirmation-message" id="rematchOptionsMessage"></p>
|
|
<label class="rematch-option-card" for="rematchOptionsRelaxed">
|
|
<input type="checkbox" id="rematchOptionsRelaxed">
|
|
<span class="rematch-option-checkmark" aria-hidden="true"></span>
|
|
<span class="rematch-option-text">
|
|
<span class="rematch-option-title">{{ t('modals.rematchOptions.relaxedLabel') }}</span>
|
|
<span class="rematch-option-caveat">
|
|
<i class="fas fa-info-circle" aria-hidden="true"></i>
|
|
{{ t('modals.rematchOptions.relaxedDescription') }}
|
|
</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
<div class="modal-actions">
|
|
<button class="secondary-btn" onclick="rematchModalManager.cancelOptions()">{{ t('common.actions.cancel') }}</button>
|
|
<button class="primary-btn" id="rematchOptionsConfirmBtn" onclick="rematchModalManager.confirmOptions()">
|
|
<i class="fas fa-sync-alt"></i>
|
|
{{ t('modals.rematchOptions.confirmButton') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|