mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 11:11:26 -03:00
4938faa049
Folders created from the sidebar had no in-app way back out: the only
removal path was to leave ComfyUI, delete the directory by hand and
rescan. A typo'd folder also polluted the move/download destination
picker permanently, since it reads the same all_folders source.
Adds POST /api/lm/{prefix}/delete-folder, restricted to directories
whose subtree holds no model weight files — a folder-level cascade would
bypass the per-model lifecycle bookkeeping (metadata sidecars, previews,
cache entries, pending-delete staging, recipe references). The service
walks the directory itself instead of trusting the possibly stale cache,
reports what it would remove (models / files / subfolders / symlinks),
and refuses library roots, top-level symlinks (shutil.rmtree rejects
those) and folders holding a staged delete, whose manifest would be
invalidated by the move. Symbolic links inside the subtree are counted
but never followed.
ModelScanner.remove_known_folder mirrors add_known_folder: the removed
subtree leaves all_folders while ancestors are kept (every recorded
ancestor exists on disk in its own right), stale cache entries under the
prefix are purged and the folder list recomputed. The handler broadcasts
models_changed so destination pickers drop the folder too.
The sidebar entry is a destructive context-menu item. The modal opens in
a confirm state for model-free folders and an explanatory one when the
subtree still holds models, decided from the models-only set that already
dims empty nodes; a stale tree is caught by the 409 not_empty/busy
conflict. Truly empty folders get the existing 20s undo affordance,
implemented by re-creating the directory.
175 lines
8.9 KiB
HTML
175 lines
8.9 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>
|
|
|
|
<!-- Sidebar Folder Delete Confirmation Modal -->
|
|
<!-- Shared by two states: 'confirm' (model-free folder) and 'blocked' (the
|
|
subtree still holds models, so a cascade delete is refused). -->
|
|
<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="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>
|