fix: rename URL error element ID to 'importUrlError' for consistency across components

This commit is contained in:
Will Miao
2025-07-29 16:13:27 +08:00
parent 854ca322c1
commit a5808193a6
6 changed files with 12 additions and 14 deletions

View File

@@ -119,10 +119,10 @@ class RecipeMetadataParser(ABC):
# Check if exists locally # Check if exists locally
if recipe_scanner and lora_entry['hash']: if recipe_scanner and lora_entry['hash']:
lora_scanner = recipe_scanner._lora_scanner lora_scanner = recipe_scanner._lora_scanner
exists_locally = lora_scanner.has_lora_hash(lora_entry['hash']) exists_locally = lora_scanner.has_hash(lora_entry['hash'])
if exists_locally: if exists_locally:
try: try:
local_path = lora_scanner.get_lora_path_by_hash(lora_entry['hash']) local_path = lora_scanner.get_path_by_hash(lora_entry['hash'])
lora_entry['existsLocally'] = True lora_entry['existsLocally'] = True
lora_entry['localPath'] = local_path lora_entry['localPath'] = local_path
lora_entry['file_name'] = os.path.splitext(os.path.basename(local_path))[0] lora_entry['file_name'] = os.path.splitext(os.path.basename(local_path))[0]

View File

@@ -55,7 +55,7 @@ class RecipeFormatParser(RecipeMetadataParser):
# Check if this LoRA exists locally by SHA256 hash # Check if this LoRA exists locally by SHA256 hash
if lora.get('hash') and recipe_scanner: if lora.get('hash') and recipe_scanner:
lora_scanner = recipe_scanner._lora_scanner lora_scanner = recipe_scanner._lora_scanner
exists_locally = lora_scanner.has_lora_hash(lora['hash']) exists_locally = lora_scanner.has_hash(lora['hash'])
if exists_locally: if exists_locally:
lora_cache = await lora_scanner.get_cached_data() lora_cache = await lora_scanner.get_cached_data()
lora_item = next((item for item in lora_cache.raw_data if item['sha256'].lower() == lora['hash'].lower()), None) lora_item = next((item for item in lora_cache.raw_data if item['sha256'].lower() == lora['hash'].lower()), None)

View File

@@ -408,7 +408,7 @@ class BaseModelRoutes(ABC):
group["models"].append(await self.service.format_response(model)) group["models"].append(await self.service.format_response(model))
# Find the model from the main index too # Find the model from the main index too
hash_val = self.service.scanner._hash_index.get_hash_by_filename(filename) hash_val = self.service.scanner.get_hash_by_filename(filename)
if hash_val: if hash_val:
main_path = self.service.get_path_by_hash(hash_val) main_path = self.service.get_path_by_hash(hash_val)
if main_path and main_path not in paths: if main_path and main_path not in paths:

View File

@@ -1,7 +1,5 @@
import { modalManager } from './ModalManager.js'; import { modalManager } from './ModalManager.js';
import { showToast } from '../utils/uiHelpers.js';
import { LoadingManager } from './LoadingManager.js'; import { LoadingManager } from './LoadingManager.js';
import { getStorageItem } from '../utils/storageHelpers.js';
import { ImportStepManager } from './import/ImportStepManager.js'; import { ImportStepManager } from './import/ImportStepManager.js';
import { ImageProcessor } from './import/ImageProcessor.js'; import { ImageProcessor } from './import/ImageProcessor.js';
import { RecipeDataManager } from './import/RecipeDataManager.js'; import { RecipeDataManager } from './import/RecipeDataManager.js';
@@ -86,8 +84,8 @@ export class ImportManager {
const uploadError = document.getElementById('uploadError'); const uploadError = document.getElementById('uploadError');
if (uploadError) uploadError.textContent = ''; if (uploadError) uploadError.textContent = '';
const urlError = document.getElementById('urlError'); const importUrlError = document.getElementById('importUrlError');
if (urlError) urlError.textContent = ''; if (importUrlError) importUrlError.textContent = '';
const recipeName = document.getElementById('recipeName'); const recipeName = document.getElementById('recipeName');
if (recipeName) recipeName.value = ''; if (recipeName) recipeName.value = '';
@@ -167,10 +165,10 @@ export class ImportManager {
// Clear error messages // Clear error messages
const uploadError = document.getElementById('uploadError'); const uploadError = document.getElementById('uploadError');
const urlError = document.getElementById('urlError'); const importUrlError = document.getElementById('importUrlError');
if (uploadError) uploadError.textContent = ''; if (uploadError) uploadError.textContent = '';
if (urlError) urlError.textContent = ''; if (importUrlError) importUrlError.textContent = '';
} }
handleImageUpload(event) { handleImageUpload(event) {
@@ -224,8 +222,8 @@ export class ImportManager {
const uploadError = document.getElementById('uploadError'); const uploadError = document.getElementById('uploadError');
if (uploadError) uploadError.textContent = ''; if (uploadError) uploadError.textContent = '';
const urlError = document.getElementById('urlError'); const importUrlError = document.getElementById('importUrlError');
if (urlError) urlError.textContent = ''; if (importUrlError) importUrlError.textContent = '';
} }
backToDetails() { backToDetails() {

View File

@@ -27,7 +27,7 @@ export class ImageProcessor {
async handleUrlInput() { async handleUrlInput() {
const urlInput = document.getElementById('imageUrlInput'); const urlInput = document.getElementById('imageUrlInput');
const errorElement = document.getElementById('urlError'); const errorElement = document.getElementById('importUrlError');
const input = urlInput.value.trim(); const input = urlInput.value.trim();
// Validate input // Validate input

View File

@@ -25,7 +25,7 @@
<i class="fas fa-download"></i> Fetch Image <i class="fas fa-download"></i> Fetch Image
</button> </button>
</div> </div>
<div class="error-message" id="urlError"></div> <div class="error-message" id="importUrlError"></div>
</div> </div>
</div> </div>