fix: resolve all architecture validation warnings
JavaScript improvements: - Add try/catch error handling to all async init() functions - Move initialization guards before try/catch blocks (JS-005) - Use centralized logger in i18n.js with silent fallback (JS-001) - Add loading state to icons-page.js (JS-007) Payments module structure: - Add templates/, static/, and locales/ directories (MOD-005) - Add locale files for en, de, fr, lb (MOD-006) Architecture validation now passes with 0 errors, 0 warnings, 0 info. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,11 +53,6 @@ function vendorOrderDetail() {
|
||||
],
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('orders');
|
||||
|
||||
orderDetailLog.info('Order detail init() called, orderId:', this.orderId);
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._orderDetailInitialized) {
|
||||
orderDetailLog.warn('Already initialized, skipping');
|
||||
@@ -65,26 +60,31 @@ function vendorOrderDetail() {
|
||||
}
|
||||
window._orderDetailInitialized = true;
|
||||
|
||||
// IMPORTANT: Call parent init first to set vendorCode from URL
|
||||
const parentInit = data().init;
|
||||
if (parentInit) {
|
||||
await parentInit.call(this);
|
||||
}
|
||||
|
||||
if (!this.orderId) {
|
||||
this.error = 'Order ID not provided';
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('orders');
|
||||
|
||||
orderDetailLog.info('Order detail init() called, orderId:', this.orderId);
|
||||
|
||||
// IMPORTANT: Call parent init first to set vendorCode from URL
|
||||
const parentInit = data().init;
|
||||
if (parentInit) {
|
||||
await parentInit.call(this);
|
||||
}
|
||||
|
||||
if (!this.orderId) {
|
||||
this.error = 'Order ID not provided';
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
await this.loadOrderDetails();
|
||||
|
||||
orderDetailLog.info('Order detail initialization complete');
|
||||
} catch (error) {
|
||||
orderDetailLog.error('Init failed:', error);
|
||||
this.error = 'Failed to load order details';
|
||||
}
|
||||
|
||||
orderDetailLog.info('Order detail initialization complete');
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
50
app/modules/orders/static/vendor/js/orders.js
vendored
50
app/modules/orders/static/vendor/js/orders.js
vendored
@@ -128,37 +128,37 @@ function vendorOrders() {
|
||||
},
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('orders');
|
||||
|
||||
vendorOrdersLog.info('Orders init() called');
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._vendorOrdersInitialized) {
|
||||
vendorOrdersLog.warn('Already initialized, skipping');
|
||||
return;
|
||||
}
|
||||
window._vendorOrdersInitialized = true;
|
||||
|
||||
// IMPORTANT: Call parent init first to set vendorCode from URL
|
||||
const parentInit = data().init;
|
||||
if (parentInit) {
|
||||
await parentInit.call(this);
|
||||
}
|
||||
|
||||
// Load platform settings for rows per page
|
||||
if (window.PlatformSettings) {
|
||||
this.pagination.per_page = await window.PlatformSettings.getRowsPerPage();
|
||||
}
|
||||
|
||||
try {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('orders');
|
||||
|
||||
vendorOrdersLog.info('Orders init() called');
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._vendorOrdersInitialized) {
|
||||
vendorOrdersLog.warn('Already initialized, skipping');
|
||||
return;
|
||||
}
|
||||
window._vendorOrdersInitialized = true;
|
||||
|
||||
// IMPORTANT: Call parent init first to set vendorCode from URL
|
||||
const parentInit = data().init;
|
||||
if (parentInit) {
|
||||
await parentInit.call(this);
|
||||
}
|
||||
|
||||
// Load platform settings for rows per page
|
||||
if (window.PlatformSettings) {
|
||||
this.pagination.per_page = await window.PlatformSettings.getRowsPerPage();
|
||||
}
|
||||
|
||||
await this.loadOrders();
|
||||
|
||||
vendorOrdersLog.info('Orders initialization complete');
|
||||
} catch (error) {
|
||||
vendorOrdersLog.error('Init failed:', error);
|
||||
this.error = 'Failed to initialize orders page';
|
||||
}
|
||||
|
||||
vendorOrdersLog.info('Orders initialization complete');
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user