From 7475de366b3ef3a52cfab9afe1ac68be2c1b51cd Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Fri, 5 Sep 2025 10:55:38 +0800 Subject: [PATCH] feat(context-menu): enhance bulk workflow options with append and replace actions --- static/css/components/menu.css | 6 ++++-- .../components/ContextMenu/BulkContextMenu.js | 17 ++++++++++++----- static/js/managers/BulkManager.js | 4 ++-- templates/components/context_menu.html | 7 +++++-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/static/css/components/menu.css b/static/css/components/menu.css index 481bb213..b2b1ed24 100644 --- a/static/css/components/menu.css +++ b/static/css/components/menu.css @@ -217,17 +217,19 @@ /* Bulk Context Menu Header */ .bulk-context-header { padding: 10px 12px; - background: var(--lora-accent); - color: var(--lora-text); + background: var(--card-bg); /* Use card background for subtlety */ + color: var(--text-color); /* Use standard text color */ display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; border-radius: var(--border-radius-xs) var(--border-radius-xs) 0 0; + border-bottom: 1px solid var(--border-color); /* Add subtle separator */ } .bulk-context-header i { width: 16px; text-align: center; + color: var(--lora-accent); /* Accent only the icon for a hint of color */ } \ No newline at end of file diff --git a/static/js/components/ContextMenu/BulkContextMenu.js b/static/js/components/ContextMenu/BulkContextMenu.js index 70030764..0ef43e74 100644 --- a/static/js/components/ContextMenu/BulkContextMenu.js +++ b/static/js/components/ContextMenu/BulkContextMenu.js @@ -27,14 +27,18 @@ export class BulkContextMenu extends BaseContextMenu { // Update button visibility based on model type const addTagsItem = this.menu.querySelector('[data-action="add-tags"]'); - const sendToWorkflowItem = this.menu.querySelector('[data-action="send-to-workflow"]'); + const sendToWorkflowAppendItem = this.menu.querySelector('[data-action="send-to-workflow-append"]'); + const sendToWorkflowReplaceItem = this.menu.querySelector('[data-action="send-to-workflow-replace"]'); const copyAllItem = this.menu.querySelector('[data-action="copy-all"]'); const refreshAllItem = this.menu.querySelector('[data-action="refresh-all"]'); const moveAllItem = this.menu.querySelector('[data-action="move-all"]'); const deleteAllItem = this.menu.querySelector('[data-action="delete-all"]'); - if (sendToWorkflowItem) { - sendToWorkflowItem.style.display = config.sendToWorkflow ? 'flex' : 'none'; + if (sendToWorkflowAppendItem) { + sendToWorkflowAppendItem.style.display = config.sendToWorkflow ? 'flex' : 'none'; + } + if (sendToWorkflowReplaceItem) { + sendToWorkflowReplaceItem.style.display = config.sendToWorkflow ? 'flex' : 'none'; } if (copyAllItem) { copyAllItem.style.display = config.copyAll ? 'flex' : 'none'; @@ -71,8 +75,11 @@ export class BulkContextMenu extends BaseContextMenu { case 'add-tags': bulkManager.showBulkAddTagsModal(); break; - case 'send-to-workflow': - bulkManager.sendAllModelsToWorkflow(); + case 'send-to-workflow-append': + bulkManager.sendAllModelsToWorkflow(false); + break; + case 'send-to-workflow-replace': + bulkManager.sendAllModelsToWorkflow(true); break; case 'copy-all': bulkManager.copyAllModelsSyntax(); diff --git a/static/js/managers/BulkManager.js b/static/js/managers/BulkManager.js index 7ecdadcf..a6499d3b 100644 --- a/static/js/managers/BulkManager.js +++ b/static/js/managers/BulkManager.js @@ -228,7 +228,7 @@ export class BulkManager { await copyToClipboard(loraSyntaxes.join(', '), `Copied ${loraSyntaxes.length} LoRA syntaxes to clipboard`); } - async sendAllModelsToWorkflow() { + async sendAllModelsToWorkflow(replaceMode = false) { if (state.currentPageType !== MODEL_TYPES.LORA) { showToast('toast.loras.sendOnlyForLoras', {}, 'warning'); return; @@ -265,7 +265,7 @@ export class BulkManager { return; } - await sendLoraToWorkflow(loraSyntaxes.join(', '), false, 'lora'); + await sendLoraToWorkflow(loraSyntaxes.join(', '), replaceMode, 'lora'); } showBulkDeleteModal() { diff --git a/templates/components/context_menu.html b/templates/components/context_menu.html index 92e7a5b2..45868caf 100644 --- a/templates/components/context_menu.html +++ b/templates/components/context_menu.html @@ -53,8 +53,11 @@
-