feat: improve warning management by removing existing deleted LoRAs and early access warnings

This commit is contained in:
Will Miao
2025-04-26 19:46:48 +08:00
parent 7ce5857cd5
commit 9e61bbbd8e

View File

@@ -146,6 +146,18 @@ export class ImportManager {
if (totalSizeDisplay) { if (totalSizeDisplay) {
totalSizeDisplay.textContent = 'Calculating...'; 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) { toggleImportMode(mode) {
@@ -532,17 +544,17 @@ export class ImportManager {
const nextButton = document.querySelector('#detailsStep .primary-btn'); const nextButton = document.querySelector('#detailsStep .primary-btn');
if (!nextButton) return; if (!nextButton) return;
// Count deleted LoRAs // Always clean up previous warnings first
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'); const existingWarning = document.getElementById('deletedLorasWarning');
if (existingWarning) { if (existingWarning) {
existingWarning.remove(); 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) {
// Create a new warning container above the buttons // Create a new warning container above the buttons
const buttonsContainer = document.querySelector('#detailsStep .modal-actions') || nextButton.parentNode; const buttonsContainer = document.querySelector('#detailsStep .modal-actions') || nextButton.parentNode;
const warningContainer = document.createElement('div'); const warningContainer = document.createElement('div');