feat(ui): gray out enrich-hf-llm when no hf_url, add backend fast-fail, rename labels across locales, reposition menu item

This commit is contained in:
Will Miao
2026-07-06 00:34:18 +08:00
parent d0e8938039
commit 308d8f71b8
15 changed files with 95 additions and 66 deletions

View File

@@ -40,6 +40,12 @@
margin: 3px 0;
}
.context-menu-item.disabled {
opacity: 0.4;
cursor: not-allowed;
pointer-events: none;
}
.context-menu-item.delete-item {
color: var(--danger-color);
}

View File

@@ -27,8 +27,9 @@ export class BaseContextMenu {
const menuItem = e.target.closest('.context-menu-item');
if (!menuItem || !this.currentCard) return;
// Ignore clicks on submenu trigger (has-submenu parent)
// Ignore clicks on submenu trigger (has-submenu parent) or disabled items
if (menuItem.classList.contains('has-submenu')) return;
if (menuItem.classList.contains('disabled')) return;
const action = menuItem.dataset.action;
if (!action) return;

View File

@@ -24,6 +24,14 @@ export class LoraContextMenu extends BaseContextMenu {
showMenu(x, y, card) {
super.showMenu(x, y, card);
this.updateExcludeMenuItem();
this.updateEnrichMenuItem(card);
}
updateEnrichMenuItem(card) {
const enrichItem = this.menu?.querySelector('[data-action="enrich-hf-llm"]');
if (!enrichItem) return;
const hasHfUrl = !!card.dataset.hf_url;
enrichItem.classList.toggle('disabled', !hasHfUrl);
}
handleMenuAction(action, menuItem) {