feat: dashboard - Reset All Filters button + R key resets filter UI
Adds a 'Reset All' button to the filter modal header that re-selects all filter buttons and clears search/logic filters. Updates the R key shortcut to also reset the filter UI before reloading cards so visual state stays consistent with the data. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
7821c60d98
commit
b95d2d0cfc
@@ -694,6 +694,66 @@ function initFilters() {
|
||||
});
|
||||
}
|
||||
|
||||
// Reset all button-filters to "all selected" and update the pipeline.
|
||||
// Also clears searchFilters and logicFilters so the full dataset is visible.
|
||||
function resetAllFilters() {
|
||||
if (!activeData || activeData.length === 0) return;
|
||||
|
||||
const filterKeys = ['model', 'sampler', 'scheduler', 'denoise', 'lora', 'positive', 'negative', 'size', 'seed', 'steps', 'cfg', 'upscaleMethod', 'mediaType'];
|
||||
|
||||
// Re-populate every filter Set with all unique values from activeData
|
||||
filterKeys.forEach(key => {
|
||||
if (!filters[key]) filters[key] = new Set();
|
||||
filters[key].clear();
|
||||
activeData.forEach(d => {
|
||||
let val;
|
||||
if (key === 'model') val = d.model || meta.model || "Default";
|
||||
else if (key === 'positive') val = d.positive || meta.positive || "";
|
||||
else if (key === 'negative') val = d.negative || meta.negative || "";
|
||||
else if (key === 'size') val = `${d.width}x${d.height}`;
|
||||
else if (key === 'steps') val = String(d.steps);
|
||||
else if (key === 'cfg') val = String(d.cfg);
|
||||
else if (key === 'upscaleMethod') {
|
||||
if (!d.upscaled) { val = 'No Upscale'; }
|
||||
else {
|
||||
const mode = d.upscale_mode || '';
|
||||
const model = d.upscale_model;
|
||||
const shortModel = model ? String(model).replace(/\\/g, '/').split('/').pop().replace(/\.[^.]+$/, '') : '';
|
||||
val = shortModel ? `${mode} + ${shortModel}` : mode || 'Upscaled';
|
||||
}
|
||||
} else if (key === 'mediaType') val = d.media_type || 'image';
|
||||
else val = d[key];
|
||||
if (val !== undefined && val !== null) filters[key].add(val);
|
||||
});
|
||||
});
|
||||
|
||||
// Mark all filter buttons as active
|
||||
const filterButtonContainers = document.querySelectorAll('.filter-buttons-container');
|
||||
filterButtonContainers.forEach(container => {
|
||||
container.querySelectorAll('.filter-btn').forEach(btn => btn.classList.add('active'));
|
||||
});
|
||||
|
||||
// Clear search filters
|
||||
if (typeof searchFilters !== 'undefined') {
|
||||
searchFilters = [];
|
||||
if (typeof renderSearchFilters === 'function') renderSearchFilters();
|
||||
}
|
||||
|
||||
// Clear logic filters
|
||||
if (typeof logicFilters !== 'undefined') {
|
||||
logicFilters = [];
|
||||
if (typeof renderLogicFilters === 'function') renderLogicFilters();
|
||||
}
|
||||
|
||||
// Clear the filter button cache so initFilters rebuilds on next call
|
||||
if (typeof filterButtonCache !== 'undefined') {
|
||||
for (const key in filterButtonCache) delete filterButtonCache[key];
|
||||
}
|
||||
|
||||
updateDataPipeline();
|
||||
console.log('[Reset Filters] All filters reset to default (show all)');
|
||||
}
|
||||
|
||||
// Toggle trigger word visibility in prompts
|
||||
function toggleTriggerWords(showTriggers) {
|
||||
// Rebuild filters with new prompt mode
|
||||
|
||||
@@ -20,6 +20,8 @@ function setupKeyReloadFullscreen() {
|
||||
toggleFullscreen()
|
||||
break;
|
||||
case 'r':
|
||||
// Reset all filters visually before reloading so the UI is consistent
|
||||
if (typeof resetAllFilters === 'function') resetAllFilters();
|
||||
loadSession()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -452,6 +452,10 @@
|
||||
<div id="filters-popup" class="filters-popup" style="display: none;">
|
||||
<div class="filters-popup-header">
|
||||
<h3>Filters & Info</h3>
|
||||
<button onclick="resetAllFilters()" title="Reset all filters to show everything"
|
||||
style="background: #c45000; border: 1px solid #ff7733; color: #fff; font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 4px; cursor: pointer; letter-spacing: 0.5px;">
|
||||
RESET ALL
|
||||
</button>
|
||||
<button class="close-popup-btn" onclick="toggleFiltersPopup()">✕</button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user