fix: use PlatformSettings for pagination in Letzshop page

- Load rows per page from PlatformSettings in init()
- Apply setting to ordersLimit, exceptionsLimit, productsLimit, jobsPagination
- Replace alert() with Utils.showToast() for error display
- Improve viewJobErrors to show errors in modal instead of alert
- Update architecture validator to catch non-standard pagination patterns
  (jobsPagination, ordersLimit, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 00:35:01 +01:00
parent bedc979b12
commit 4902ff274b
2 changed files with 43 additions and 17 deletions

View File

@@ -2718,8 +2718,18 @@ class ArchitectureValidator:
if file_path.name in excluded_files:
return
# Check if this file has pagination (look for pagination object)
has_pagination = re.search(r"pagination:\s*\{", content)
# Check for various pagination patterns:
# - Standard: pagination: { ... }
# - Named: jobsPagination: { ... }, ordersPagination: { ... }
# - Separate vars: ordersLimit, productsLimit, etc.
pagination_patterns = [
r"pagination:\s*\{",
r"\w+Pagination:\s*\{",
r"(orders|products|exceptions|jobs|items)Limit\s*:",
r"per_page\s*:\s*\d+",
]
has_pagination = any(re.search(p, content) for p in pagination_patterns)
if not has_pagination:
return
@@ -2729,7 +2739,7 @@ class ArchitectureValidator:
if not uses_platform_settings:
# Find the line where pagination is defined
for i, line in enumerate(lines, 1):
if "pagination:" in line and "{" in line:
if re.search(r"(pagination|Pagination|Limit|per_page)\s*[:{]", line):
self._add_violation(
rule_id="JS-010",
rule_name="Use PlatformSettings for pagination",

View File

@@ -150,6 +150,16 @@ function adminMarketplaceLetzshop() {
}
window._marketplaceLetzshopInitialized = true;
// Load platform settings for pagination
if (window.PlatformSettings) {
const rowsPerPage = await window.PlatformSettings.getRowsPerPage();
this.ordersLimit = rowsPerPage;
this.exceptionsLimit = rowsPerPage;
this.productsLimit = rowsPerPage;
this.jobsPagination.per_page = rowsPerPage;
marketplaceLetzshopLog.info('Loaded rows per page setting:', rowsPerPage);
}
// Initialize Tom Select after a short delay to ensure DOM is ready
this.$nextTick(() => {
this.initTomSelect();
@@ -1466,26 +1476,32 @@ function adminMarketplaceLetzshop() {
* View job errors
*/
async viewJobErrors(job) {
if (job.type !== 'import') return;
if (job.type !== 'import' && job.type !== 'historical_import') return;
try {
const response = await apiClient.get(`/admin/marketplace-import-jobs/${job.id}/errors`);
const errors = response.errors || [];
const endpoint = job.type === 'import'
? `/admin/marketplace-import-jobs/${job.id}/errors`
: `/admin/letzshop/historical-imports/${job.id}`;
if (errors.length === 0) {
alert('No error details available');
return;
const response = await apiClient.get(endpoint);
if (job.type === 'import') {
const errors = response.errors || [];
if (errors.length === 0) {
Utils.showToast('No error details available', 'info');
return;
}
// Store errors and show in job details modal
this.selectedJobDetails = { ...job, errors: errors.slice(0, 20) };
this.showJobDetailsModal = true;
} else {
// Historical import - show job details
this.selectedJobDetails = { ...job, ...response };
this.showJobDetailsModal = true;
}
// Show errors in alert for now
const errorText = errors.slice(0, 10).map(e =>
`Row ${e.row_number}: ${e.error_message}`
).join('\n');
alert(`Import Errors (showing first 10):\n\n${errorText}`);
} catch (error) {
marketplaceLetzshopLog.error('Failed to load job errors:', error);
this.error = 'Failed to load error details';
Utils.showToast('Failed to load error details', 'error');
}
},