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:
@@ -2718,8 +2718,18 @@ class ArchitectureValidator:
|
|||||||
if file_path.name in excluded_files:
|
if file_path.name in excluded_files:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if this file has pagination (look for pagination object)
|
# Check for various pagination patterns:
|
||||||
has_pagination = re.search(r"pagination:\s*\{", content)
|
# - 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:
|
if not has_pagination:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -2729,7 +2739,7 @@ class ArchitectureValidator:
|
|||||||
if not uses_platform_settings:
|
if not uses_platform_settings:
|
||||||
# Find the line where pagination is defined
|
# Find the line where pagination is defined
|
||||||
for i, line in enumerate(lines, 1):
|
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(
|
self._add_violation(
|
||||||
rule_id="JS-010",
|
rule_id="JS-010",
|
||||||
rule_name="Use PlatformSettings for pagination",
|
rule_name="Use PlatformSettings for pagination",
|
||||||
|
|||||||
@@ -150,6 +150,16 @@ function adminMarketplaceLetzshop() {
|
|||||||
}
|
}
|
||||||
window._marketplaceLetzshopInitialized = true;
|
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
|
// Initialize Tom Select after a short delay to ensure DOM is ready
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.initTomSelect();
|
this.initTomSelect();
|
||||||
@@ -1466,26 +1476,32 @@ function adminMarketplaceLetzshop() {
|
|||||||
* View job errors
|
* View job errors
|
||||||
*/
|
*/
|
||||||
async viewJobErrors(job) {
|
async viewJobErrors(job) {
|
||||||
if (job.type !== 'import') return;
|
if (job.type !== 'import' && job.type !== 'historical_import') return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.get(`/admin/marketplace-import-jobs/${job.id}/errors`);
|
const endpoint = job.type === 'import'
|
||||||
const errors = response.errors || [];
|
? `/admin/marketplace-import-jobs/${job.id}/errors`
|
||||||
|
: `/admin/letzshop/historical-imports/${job.id}`;
|
||||||
|
|
||||||
if (errors.length === 0) {
|
const response = await apiClient.get(endpoint);
|
||||||
alert('No error details available');
|
|
||||||
return;
|
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) {
|
} catch (error) {
|
||||||
marketplaceLetzshopLog.error('Failed to load job errors:', error);
|
marketplaceLetzshopLog.error('Failed to load job errors:', error);
|
||||||
this.error = 'Failed to load error details';
|
Utils.showToast('Failed to load error details', 'error');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user