mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
feat: Update recursive search option to default to true and remove related UI elements
This commit is contained in:
@@ -191,7 +191,7 @@ class BaseModelRoutes(ABC):
|
|||||||
'modelname': request.query.get('search_modelname', 'true').lower() == 'true',
|
'modelname': request.query.get('search_modelname', 'true').lower() == 'true',
|
||||||
'tags': request.query.get('search_tags', 'false').lower() == 'true',
|
'tags': request.query.get('search_tags', 'false').lower() == 'true',
|
||||||
'creator': request.query.get('search_creator', 'false').lower() == 'true',
|
'creator': request.query.get('search_creator', 'false').lower() == 'true',
|
||||||
'recursive': request.query.get('recursive', 'false').lower() == 'true',
|
'recursive': request.query.get('recursive', 'true').lower() == 'true',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse hash filters if provided
|
# Parse hash filters if provided
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class BaseModelService(ABC):
|
|||||||
'filename': True,
|
'filename': True,
|
||||||
'modelname': True,
|
'modelname': True,
|
||||||
'tags': False,
|
'tags': False,
|
||||||
'recursive': False,
|
'recursive': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the base data set using new sort logic
|
# Get the base data set using new sort logic
|
||||||
@@ -139,7 +139,7 @@ class BaseModelService(ABC):
|
|||||||
|
|
||||||
# Apply folder filtering
|
# Apply folder filtering
|
||||||
if folder is not None:
|
if folder is not None:
|
||||||
if search_options and search_options.get('recursive', False):
|
if search_options and search_options.get('recursive', True):
|
||||||
# Recursive folder filtering - include all subfolders
|
# Recursive folder filtering - include all subfolders
|
||||||
data = [
|
data = [
|
||||||
item for item in data
|
item for item in data
|
||||||
|
|||||||
@@ -445,69 +445,6 @@
|
|||||||
border-color: var(--lora-accent);
|
border-color: var(--lora-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch styles */
|
|
||||||
.search-option-switch {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 4px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.switch {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
width: 46px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.switch input {
|
|
||||||
opacity: 0;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider {
|
|
||||||
position: absolute;
|
|
||||||
cursor: pointer;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background-color: #ccc;
|
|
||||||
transition: .4s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider:before {
|
|
||||||
position: absolute;
|
|
||||||
content: "";
|
|
||||||
height: 18px;
|
|
||||||
width: 18px;
|
|
||||||
left: 3px;
|
|
||||||
bottom: 3px;
|
|
||||||
background-color: white;
|
|
||||||
transition: .4s;
|
|
||||||
}
|
|
||||||
|
|
||||||
input:checked + .slider {
|
|
||||||
background-color: var(--lora-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
input:focus + .slider {
|
|
||||||
box-shadow: 0 0 1px var(--lora-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
input:checked + .slider:before {
|
|
||||||
transform: translateX(22px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider.round {
|
|
||||||
border-radius: 34px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider.round:before {
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile adjustments */
|
/* Mobile adjustments */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.search-options-panel,
|
.search-options-panel,
|
||||||
|
|||||||
@@ -673,7 +673,6 @@ export class BaseModelApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.append('recursive', (pageState.searchOptions?.recursive ?? false).toString());
|
|
||||||
|
|
||||||
if (pageState.filters) {
|
if (pageState.filters) {
|
||||||
if (pageState.filters.tags && pageState.filters.tags.length > 0) {
|
if (pageState.filters.tags && pageState.filters.tags.length > 0) {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export class SearchManager {
|
|||||||
this.searchOptionsPanel = document.getElementById('searchOptionsPanel');
|
this.searchOptionsPanel = document.getElementById('searchOptionsPanel');
|
||||||
this.closeSearchOptions = document.getElementById('closeSearchOptions');
|
this.closeSearchOptions = document.getElementById('closeSearchOptions');
|
||||||
this.searchOptionTags = document.querySelectorAll('.search-option-tag');
|
this.searchOptionTags = document.querySelectorAll('.search-option-tag');
|
||||||
this.recursiveSearchToggle = document.getElementById('recursiveSearchToggle');
|
|
||||||
|
|
||||||
this.searchTimeout = null;
|
this.searchTimeout = null;
|
||||||
this.currentPage = options.page || document.body.dataset.page || 'loras';
|
this.currentPage = options.page || document.body.dataset.page || 'loras';
|
||||||
@@ -112,14 +111,6 @@ export class SearchManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursive search toggle
|
|
||||||
if (this.recursiveSearchToggle) {
|
|
||||||
this.recursiveSearchToggle.addEventListener('change', () => {
|
|
||||||
this.saveSearchPreferences();
|
|
||||||
this.performSearch();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add global click handler to close panels when clicking outside
|
// Add global click handler to close panels when clicking outside
|
||||||
document.addEventListener('click', (e) => {
|
document.addEventListener('click', (e) => {
|
||||||
// Close search options panel when clicking outside
|
// Close search options panel when clicking outside
|
||||||
@@ -218,11 +209,6 @@ export class SearchManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply recursive search - only if the toggle exists
|
|
||||||
if (this.recursiveSearchToggle && preferences.recursive !== undefined) {
|
|
||||||
this.recursiveSearchToggle.checked = preferences.recursive;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure at least one search option is selected
|
// Ensure at least one search option is selected
|
||||||
this.validateSearchOptions();
|
this.validateSearchOptions();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -272,11 +258,6 @@ export class SearchManager {
|
|||||||
options
|
options
|
||||||
};
|
};
|
||||||
|
|
||||||
// Only add recursive option if the toggle exists
|
|
||||||
if (this.recursiveSearchToggle) {
|
|
||||||
preferences.recursive = this.recursiveSearchToggle.checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
setStorageItem(`${this.currentPage}_search_prefs`, preferences);
|
setStorageItem(`${this.currentPage}_search_prefs`, preferences);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error saving search preferences:', error);
|
console.error('Error saving search preferences:', error);
|
||||||
@@ -294,7 +275,6 @@ export class SearchManager {
|
|||||||
performSearch() {
|
performSearch() {
|
||||||
const query = this.searchInput.value.trim();
|
const query = this.searchInput.value.trim();
|
||||||
const options = this.getActiveSearchOptions();
|
const options = this.getActiveSearchOptions();
|
||||||
const recursive = this.recursiveSearchToggle ? this.recursiveSearchToggle.checked : false;
|
|
||||||
|
|
||||||
// Update the state with search parameters
|
// Update the state with search parameters
|
||||||
const pageState = getCurrentPageState();
|
const pageState = getCurrentPageState();
|
||||||
@@ -318,16 +298,14 @@ export class SearchManager {
|
|||||||
filename: options.filename || false,
|
filename: options.filename || false,
|
||||||
modelname: options.modelname || false,
|
modelname: options.modelname || false,
|
||||||
tags: options.tags || false,
|
tags: options.tags || false,
|
||||||
creator: options.creator || false,
|
creator: options.creator || false
|
||||||
recursive: recursive
|
|
||||||
};
|
};
|
||||||
} else if (this.currentPage === 'checkpoints') {
|
} else if (this.currentPage === 'checkpoints') {
|
||||||
pageState.searchOptions = {
|
pageState.searchOptions = {
|
||||||
filename: options.filename || false,
|
filename: options.filename || false,
|
||||||
modelname: options.modelname || false,
|
modelname: options.modelname || false,
|
||||||
tags: options.tags || false,
|
tags: options.tags || false,
|
||||||
creator: options.creator || false,
|
creator: options.creator || false
|
||||||
recursive: recursive
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export const state = {
|
|||||||
modelname: true,
|
modelname: true,
|
||||||
tags: false,
|
tags: false,
|
||||||
creator: false,
|
creator: false,
|
||||||
recursive: false
|
recursive: true,
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
baseModel: [],
|
baseModel: [],
|
||||||
@@ -85,7 +85,7 @@ export const state = {
|
|||||||
filename: true,
|
filename: true,
|
||||||
modelname: true,
|
modelname: true,
|
||||||
creator: false,
|
creator: false,
|
||||||
recursive: false
|
recursive: true,
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
baseModel: [],
|
baseModel: [],
|
||||||
@@ -113,7 +113,7 @@ export const state = {
|
|||||||
modelname: true,
|
modelname: true,
|
||||||
tags: false,
|
tags: false,
|
||||||
creator: false,
|
creator: false,
|
||||||
recursive: false
|
recursive: true,
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
baseModel: [],
|
baseModel: [],
|
||||||
|
|||||||
@@ -101,17 +101,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if request.path != '/loras/recipes' %}
|
|
||||||
<div class="options-section">
|
|
||||||
<div class="search-option-switch">
|
|
||||||
<span>Include Subfolders</span>
|
|
||||||
<label class="switch">
|
|
||||||
<input type="checkbox" id="recursiveSearchToggle">
|
|
||||||
<span class="slider round"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Add filter panel -->
|
<!-- Add filter panel -->
|
||||||
|
|||||||
Reference in New Issue
Block a user