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:
@@ -29,37 +29,42 @@ function adminUserEditPage() {
|
||||
|
||||
// Initialize
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('tenancy');
|
||||
try {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('tenancy');
|
||||
|
||||
adminUserEditLog.info('=== ADMIN USER EDIT PAGE INITIALIZING ===');
|
||||
adminUserEditLog.info('=== ADMIN USER EDIT PAGE INITIALIZING ===');
|
||||
|
||||
// Prevent multiple initializations
|
||||
if (window._adminUserEditInitialized) {
|
||||
adminUserEditLog.warn('Admin user edit page already initialized, skipping...');
|
||||
return;
|
||||
// Prevent multiple initializations
|
||||
if (window._adminUserEditInitialized) {
|
||||
adminUserEditLog.warn('Admin user edit page already initialized, skipping...');
|
||||
return;
|
||||
}
|
||||
window._adminUserEditInitialized = true;
|
||||
|
||||
// Get current user ID
|
||||
this.currentUserId = this.adminProfile?.id || null;
|
||||
|
||||
// Get user ID from URL
|
||||
const path = window.location.pathname;
|
||||
const match = path.match(/\/admin\/admin-users\/(\d+)\/edit/);
|
||||
|
||||
if (match) {
|
||||
this.userId = parseInt(match[1], 10);
|
||||
adminUserEditLog.info('Editing admin user:', this.userId);
|
||||
await this.loadAdminUser();
|
||||
await this.loadAllPlatforms();
|
||||
} else {
|
||||
adminUserEditLog.error('No user ID in URL');
|
||||
Utils.showToast(I18n.t('tenancy.messages.invalid_admin_user_url'), 'error');
|
||||
setTimeout(() => window.location.href = '/admin/admin-users', 2000);
|
||||
}
|
||||
|
||||
adminUserEditLog.info('=== ADMIN USER EDIT PAGE INITIALIZATION COMPLETE ===');
|
||||
} catch (error) {
|
||||
adminUserEditLog.error('Init failed:', error);
|
||||
this.error = 'Failed to initialize admin user edit page';
|
||||
}
|
||||
window._adminUserEditInitialized = true;
|
||||
|
||||
// Get current user ID
|
||||
this.currentUserId = this.adminProfile?.id || null;
|
||||
|
||||
// Get user ID from URL
|
||||
const path = window.location.pathname;
|
||||
const match = path.match(/\/admin\/admin-users\/(\d+)\/edit/);
|
||||
|
||||
if (match) {
|
||||
this.userId = parseInt(match[1], 10);
|
||||
adminUserEditLog.info('Editing admin user:', this.userId);
|
||||
await this.loadAdminUser();
|
||||
await this.loadAllPlatforms();
|
||||
} else {
|
||||
adminUserEditLog.error('No user ID in URL');
|
||||
Utils.showToast(I18n.t('tenancy.messages.invalid_admin_user_url'), 'error');
|
||||
setTimeout(() => window.location.href = '/admin/admin-users', 2000);
|
||||
}
|
||||
|
||||
adminUserEditLog.info('=== ADMIN USER EDIT PAGE INITIALIZATION COMPLETE ===');
|
||||
},
|
||||
|
||||
// Load admin user data
|
||||
|
||||
Reference in New Issue
Block a user