mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-04-10 04:42:14 -03:00
feat(recipes): add configurable storage path migration
This commit is contained in:
@@ -766,6 +766,11 @@ export class SettingsManager {
|
||||
usePortableCheckbox.checked = !!state.global.settings.use_portable_settings;
|
||||
}
|
||||
|
||||
const recipesPathInput = document.getElementById('recipesPath');
|
||||
if (recipesPathInput) {
|
||||
recipesPathInput.value = state.global.settings.recipes_path || '';
|
||||
}
|
||||
|
||||
const autoOrganizeExclusionsInput = document.getElementById('autoOrganizeExclusions');
|
||||
if (autoOrganizeExclusionsInput) {
|
||||
const patterns = this.normalizePatternList(state.global.settings.auto_organize_exclusions);
|
||||
@@ -2464,6 +2469,7 @@ export class SettingsManager {
|
||||
if (!element) return;
|
||||
|
||||
const value = element.value.trim(); // Trim whitespace
|
||||
const shouldShowLoading = settingKey === 'recipes_path';
|
||||
|
||||
try {
|
||||
// Check if value has changed from existing value
|
||||
@@ -2472,6 +2478,12 @@ export class SettingsManager {
|
||||
return; // No change, exit early
|
||||
}
|
||||
|
||||
if (shouldShowLoading) {
|
||||
state.loadingManager?.showSimpleLoading(
|
||||
translate('settings.folderSettings.recipesPathMigrating', {}, 'Migrating recipes...')
|
||||
);
|
||||
}
|
||||
|
||||
// For username and password, handle empty values specially
|
||||
if ((settingKey === 'proxy_username' || settingKey === 'proxy_password') && value === '') {
|
||||
// Remove from state instead of setting to empty string
|
||||
@@ -2497,10 +2509,25 @@ export class SettingsManager {
|
||||
await this.saveSetting(settingKey, value);
|
||||
}
|
||||
|
||||
showToast('toast.settings.settingsUpdated', { setting: settingKey.replace(/_/g, ' ') }, 'success');
|
||||
if (shouldShowLoading) {
|
||||
state.loadingManager?.hide();
|
||||
}
|
||||
|
||||
if (settingKey === 'recipes_path') {
|
||||
showToast('toast.settings.recipesPathUpdated', {}, 'success');
|
||||
} else {
|
||||
showToast('toast.settings.settingsUpdated', { setting: settingKey.replace(/_/g, ' ') }, 'success');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
showToast('toast.settings.settingSaveFailed', { message: error.message }, 'error');
|
||||
if (shouldShowLoading) {
|
||||
state.loadingManager?.hide();
|
||||
}
|
||||
if (settingKey === 'recipes_path') {
|
||||
showToast('toast.settings.recipesPathSaveFailed', { message: error.message }, 'error');
|
||||
} else {
|
||||
showToast('toast.settings.settingSaveFailed', { message: error.message }, 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ const DEFAULT_SETTINGS_BASE = Object.freeze({
|
||||
default_lora_root: '',
|
||||
default_checkpoint_root: '',
|
||||
default_embedding_root: '',
|
||||
recipes_path: '',
|
||||
base_model_path_mappings: {},
|
||||
download_path_templates: {},
|
||||
example_images_path: '',
|
||||
|
||||
Reference in New Issue
Block a user