feat(vlm): sort versions by newest first in VLM view, with disabled sort dropdown

When viewing all versions of a model (VLM mode via 'x versions' button):
- Backend always sorts by version ID descending, ignoring current sort_by
- A temporary 'Newest version first' option is injected into the sort
  dropdown (removed on exit, not a permanent option)
- The sort dropdown is disabled (greyed out) while VLM is active
- On clearing VLM, the previous sort preference is restored and the
  dropdown re-enabled
- Handles stale VLM state (e.g. after page reload with leftover session)
- Covers all three model page types: loras, checkpoints, embeddings

Also fixes review nits:
- Correct i18n call pattern (defaultValue in options object)
- Shared _restoreSortAfterVlm() helper to avoid triple duplication
This commit is contained in:
Will Miao
2026-06-24 16:25:14 +08:00
parent 71a459422f
commit 7a71b34b54
15 changed files with 127 additions and 10 deletions

View File

@@ -264,6 +264,23 @@
box-shadow: 0 0 0 2px oklch(var(--lora-accent) / 0.15);
}
/* Disabled sort dropdown — used when VLM custom filter is active */
.control-group select:disabled {
opacity: 0.5;
cursor: not-allowed;
background-color: var(--bg-color);
border-color: var(--border-color);
box-shadow: none;
transform: none;
}
.control-group select:disabled:hover {
border-color: var(--border-color);
background-color: var(--bg-color);
transform: none;
box-shadow: none;
}
/* Ensure hidden class works properly */
.hidden {
display: none !important;