From 9e61bbbd8e7c2125c7fefa8d389e4d8a43629d36 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Sat, 26 Apr 2025 19:46:48 +0800 Subject: [PATCH] feat: improve warning management by removing existing deleted LoRAs and early access warnings --- static/js/managers/ImportManager.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/static/js/managers/ImportManager.js b/static/js/managers/ImportManager.js index 8a97880f..b86cb0fe 100644 --- a/static/js/managers/ImportManager.js +++ b/static/js/managers/ImportManager.js @@ -146,6 +146,18 @@ export class ImportManager { if (totalSizeDisplay) { totalSizeDisplay.textContent = 'Calculating...'; } + + // Remove any existing deleted LoRAs warning + const deletedLorasWarning = document.getElementById('deletedLorasWarning'); + if (deletedLorasWarning) { + deletedLorasWarning.remove(); + } + + // Remove any existing early access warning + const earlyAccessWarning = document.getElementById('earlyAccessWarning'); + if (earlyAccessWarning) { + earlyAccessWarning.remove(); + } } toggleImportMode(mode) { @@ -532,17 +544,17 @@ export class ImportManager { const nextButton = document.querySelector('#detailsStep .primary-btn'); if (!nextButton) return; + // Always clean up previous warnings first + const existingWarning = document.getElementById('deletedLorasWarning'); + if (existingWarning) { + existingWarning.remove(); + } + // Count deleted LoRAs const deletedLoras = this.recipeData.loras.filter(lora => lora.isDeleted).length; // If we have deleted LoRAs, show a warning and update button text if (deletedLoras > 0) { - // Remove any existing warning - const existingWarning = document.getElementById('deletedLorasWarning'); - if (existingWarning) { - existingWarning.remove(); - } - // Create a new warning container above the buttons const buttonsContainer = document.querySelector('#detailsStep .modal-actions') || nextButton.parentNode; const warningContainer = document.createElement('div');