mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-06-21 09:52:03 -03:00
feat(versions): add View all local versions button to model versions tab
Clicking the button closes the modal, writes filter params to sessionStorage, and reloads the page to show all local versions of the model as individual cards (bypassing group-by-model dedup). The filter respects the update flag strategy and the versions-filter-toggle state (same-base vs all versions). Supporting changes: - sessionStorage keys vlm_model_id / vlm_model_name / vlm_base_model - BaseModelApiClient._addModelSpecificParams adds civitai_model_id param - LoraApiClient calls super._addModelSpecificParams for VLM detection - LorasControls / CheckpointsControls clearCustomFilter checks VLM first - PageControls.checkVlmFilter shows customFilterIndicator with label - Backend parses civitai_model_id, filters before group_by_model dedup
This commit is contained in:
@@ -752,6 +752,7 @@ export async function showModelModal(model, modelType) {
|
||||
modelId: civitaiModelId,
|
||||
currentVersionId: civitaiVersionId,
|
||||
currentBaseModel: modelWithFullData.base_model,
|
||||
modelName: model.model_name,
|
||||
onUpdateStatusChange: handleUpdateStatusChange,
|
||||
});
|
||||
setupEditableFields(modelWithFullData.file_path, modelType);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { translate } from '../../utils/i18nHelpers.js';
|
||||
import { state } from '../../state/index.js';
|
||||
import { buildCivitaiModelUrl } from '../../utils/civitaiUtils.js';
|
||||
import { formatFileSize } from './utils.js';
|
||||
import { setSessionItem, removeSessionItem } from '../../utils/storageHelpers.js';
|
||||
|
||||
const VIDEO_EXTENSIONS = ['.mp4', '.webm', '.mov', '.mkv'];
|
||||
const PREVIEW_PLACEHOLDER_URL = '/loras_static/images/no-preview.png';
|
||||
@@ -744,7 +745,7 @@ function renderToolbar(record, toolbarState = {}) {
|
||||
<button class="versions-toolbar-btn versions-toolbar-btn-primary" data-versions-action="toggle-model-ignore">
|
||||
${escapeHtml(ignoreText)}
|
||||
</button>
|
||||
<button class="versions-toolbar-btn versions-toolbar-btn-secondary" data-versions-action="view-local" title="${escapeHtml(translate('modals.model.versions.actions.viewLocalTooltip', {}, 'Coming soon'))}" disabled>
|
||||
<button class="versions-toolbar-btn versions-toolbar-btn-secondary" data-versions-action="view-local" title="${escapeHtml(translate('modals.model.versions.actions.viewLocalTooltip', {}, 'Show all local versions of this model on the main page'))}">
|
||||
${escapeHtml(viewLocalText)}
|
||||
</button>
|
||||
</div>
|
||||
@@ -792,6 +793,7 @@ export function initVersionsTab({
|
||||
modelId,
|
||||
currentVersionId,
|
||||
currentBaseModel,
|
||||
modelName,
|
||||
onUpdateStatusChange,
|
||||
}) {
|
||||
const pane = document.querySelector(`#${modalId} #versions-tab`);
|
||||
@@ -1019,6 +1021,31 @@ export function initVersionsTab({
|
||||
render(controller.record);
|
||||
}
|
||||
|
||||
function handleViewLocalVersions() {
|
||||
if (!controller.record || !modelId) {
|
||||
return;
|
||||
}
|
||||
// Determine base model filter based on current display mode
|
||||
const baseModelInfo = getCurrentVersionBaseModel(controller.record, normalizedCurrentVersionId);
|
||||
const isFilteringActive =
|
||||
displayMode === DISPLAY_FILTER_MODES.SAME_BASE &&
|
||||
Boolean(baseModelInfo.normalized);
|
||||
|
||||
// Write filter params to sessionStorage
|
||||
setSessionItem('vlm_model_id', String(modelId));
|
||||
setSessionItem('vlm_model_name', modelName || String(modelId));
|
||||
if (isFilteringActive) {
|
||||
// Use raw (non-normalized) base model for exact backend matching
|
||||
setSessionItem('vlm_base_model', baseModelInfo.raw);
|
||||
} else {
|
||||
removeSessionItem('vlm_base_model');
|
||||
}
|
||||
|
||||
// Close the modal and reload the page to show filtered cards
|
||||
modalManager.closeModal(modalId);
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
async function handleToggleVersionIgnore(button, versionId) {
|
||||
if (!controller.record) {
|
||||
return;
|
||||
@@ -1348,6 +1375,10 @@ export function initVersionsTab({
|
||||
event.preventDefault();
|
||||
handleToggleVersionDisplayMode();
|
||||
break;
|
||||
case 'view-local':
|
||||
event.preventDefault();
|
||||
handleViewLocalVersions();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user