Files
orion/static/admin/js/vendor-themes.js
Samir Boulahtit dd0ba1ed5e fix(js): replace console.log with centralized logger (JS-002)
Convert direct console.log/error/warn calls to use centralized logger:
- imports.js: 13 violations fixed using adminImportsLog
- vendor-themes.js: 5 violations fixed using vendorThemesLog
- code-quality-dashboard.js: 2 violations fixed using codeQualityLog
- code-quality-violations.js: 1 violation fixed using codeQualityViolationsLog
- settings.js: 1 violation fixed using settingsLog

All files now use window.LogConfig.loggers.* for consistent logging.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:31:48 +01:00

69 lines
1.8 KiB
JavaScript

// static/admin/js/vendor-themes.js
/**
* Admin vendor themes selection page
*/
// ✅ Use centralized logger
const vendorThemesLog = window.LogConfig.loggers.vendorTheme;
vendorThemesLog.info('Loading...');
function adminVendorThemes() {
vendorThemesLog.debug('adminVendorThemes() called');
return {
// Inherit base layout state
...data(),
// Set page identifier
currentPage: 'vendor-theme',
// State
loading: false,
error: '',
vendors: [],
selectedVendorCode: '',
async init() {
// Guard against multiple initialization
if (window._adminVendorThemesInitialized) {
return;
}
window._adminVendorThemesInitialized = true;
// Call parent init first
const parentInit = data().init;
if (parentInit) {
await parentInit.call(this);
}
await this.loadVendors();
},
async loadVendors() {
this.loading = true;
this.error = '';
try {
const response = await apiClient.get('/admin/vendors?limit=1000');
this.vendors = response.vendors || [];
vendorThemesLog.debug('Loaded vendors:', this.vendors.length);
} catch (error) {
vendorThemesLog.error('Failed to load vendors:', error);
this.error = error.message || 'Failed to load vendors';
} finally {
this.loading = false;
}
},
navigateToTheme() {
if (!this.selectedVendorCode) {
return;
}
window.location.href = `/admin/vendors/${this.selectedVendorCode}/theme`;
}
};
}
vendorThemesLog.info('Module loaded');