mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: Enhance checkpoint download manager to save active folder preference and update UI accordingly
This commit is contained in:
@@ -3,7 +3,7 @@ import { showToast } from '../utils/uiHelpers.js';
|
|||||||
import { LoadingManager } from './LoadingManager.js';
|
import { LoadingManager } from './LoadingManager.js';
|
||||||
import { state } from '../state/index.js';
|
import { state } from '../state/index.js';
|
||||||
import { resetAndReload } from '../api/checkpointApi.js';
|
import { resetAndReload } from '../api/checkpointApi.js';
|
||||||
import { getStorageItem } from '../utils/storageHelpers.js';
|
import { getStorageItem, setStorageItem } from '../utils/storageHelpers.js';
|
||||||
|
|
||||||
export class CheckpointDownloadManager {
|
export class CheckpointDownloadManager {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -338,8 +338,22 @@ export class CheckpointDownloadManager {
|
|||||||
showToast('Download completed successfully', 'success');
|
showToast('Download completed successfully', 'success');
|
||||||
modalManager.closeModal('checkpointDownloadModal');
|
modalManager.closeModal('checkpointDownloadModal');
|
||||||
|
|
||||||
// Update state and trigger reload with folder update
|
// Update state specifically for the checkpoints page
|
||||||
state.activeFolder = targetFolder;
|
state.pages.checkpoints.activeFolder = targetFolder;
|
||||||
|
|
||||||
|
// Save the active folder preference to storage
|
||||||
|
setStorageItem('checkpoints_activeFolder', targetFolder);
|
||||||
|
|
||||||
|
// Update UI to show the folder as selected
|
||||||
|
document.querySelectorAll('.folder-tags .tag').forEach(tag => {
|
||||||
|
const isActive = tag.dataset.folder === targetFolder;
|
||||||
|
tag.classList.toggle('active', isActive);
|
||||||
|
if (isActive && !tag.parentNode.classList.contains('collapsed')) {
|
||||||
|
// Scroll the tag into view if folder tags are not collapsed
|
||||||
|
tag.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
await resetAndReload(true); // Pass true to update folders
|
await resetAndReload(true); // Pass true to update folders
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user