feat: add import error tracking and translation tabs
Import Error Tracking:
- Add MarketplaceImportError model to store detailed error information
- Store row number, identifier, error type, message, and row data for each error
- Add API endpoint GET /admin/marketplace-import-jobs/{job_id}/errors
- Add UI to view and browse import errors in job details modal
- Support pagination and error type filtering
Translation Tabs:
- Replace flat translation list with tabbed interface on product detail page
- Add language tabs with full language names
- Add copy-to-clipboard functionality for translation content
- Improved UX with better visual separation of translations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ from app.exceptions import (
|
||||
ImportJobNotOwnedException,
|
||||
ValidationException,
|
||||
)
|
||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
||||
from models.database.marketplace_import_job import MarketplaceImportError, MarketplaceImportJob
|
||||
from models.database.user import User
|
||||
from models.database.vendor import Vendor
|
||||
from models.schema.marketplace_import_job import (
|
||||
@@ -271,5 +271,50 @@ class MarketplaceImportJobService:
|
||||
raise ImportJobNotFoundException(job_id)
|
||||
return job
|
||||
|
||||
def get_import_job_errors(
|
||||
self,
|
||||
db: Session,
|
||||
job_id: int,
|
||||
error_type: str | None = None,
|
||||
page: int = 1,
|
||||
limit: int = 50,
|
||||
) -> tuple[list[MarketplaceImportError], int]:
|
||||
"""
|
||||
Get import errors for a specific job with pagination.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
job_id: Import job ID
|
||||
error_type: Optional filter by error type
|
||||
page: Page number (1-indexed)
|
||||
limit: Number of items per page
|
||||
|
||||
Returns:
|
||||
Tuple of (list of errors, total count)
|
||||
"""
|
||||
try:
|
||||
query = db.query(MarketplaceImportError).filter(
|
||||
MarketplaceImportError.import_job_id == job_id
|
||||
)
|
||||
|
||||
if error_type:
|
||||
query = query.filter(MarketplaceImportError.error_type == error_type)
|
||||
|
||||
total = query.count()
|
||||
|
||||
offset = (page - 1) * limit
|
||||
errors = (
|
||||
query.order_by(MarketplaceImportError.row_number)
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
.all()
|
||||
)
|
||||
|
||||
return errors, total
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting import job errors for job {job_id}: {str(e)}")
|
||||
raise ValidationException("Failed to retrieve import errors")
|
||||
|
||||
|
||||
marketplace_import_job_service = MarketplaceImportJobService()
|
||||
|
||||
Reference in New Issue
Block a user