Move 47 JS files from static/{admin,vendor,shared}/js/ to their
respective module directories app/modules/*/static/*/js/:
- Orders: orders.js, order-detail.js
- Catalog: products.js (renamed from vendor-products.js), product-*.js
- Inventory: inventory.js (admin & vendor)
- Customers: customers.js, users.js, user-*.js
- Billing: billing-history.js, subscriptions.js, subscription-tiers.js,
billing.js, invoices.js, feature-store.js, upgrade-prompts.js
- Messaging: messages.js, notifications.js, email-templates.js
- Marketplace: marketplace*.js, letzshop*.js, onboarding.js
- Monitoring: monitoring.js, background-tasks.js, imports.js, logs.js
- Dev Tools: testing-*.js, code-quality-*.js
Update 39 templates to reference new module static paths using
url_for('{module}_static', path='...') pattern.
Files staying in static/ (platform core):
- admin: dashboard, login, platforms, vendors, companies, admin-users,
settings, components, init-alpine, module-config
- vendor: dashboard, login, profile, settings, team, media, init-alpine
- shared: api-client, utils, money, icons, log-config, vendor-selector,
media-picker
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
125 lines
4.0 KiB
JavaScript
125 lines
4.0 KiB
JavaScript
// app/modules/dev_tools/static/admin/js/testing-hub.js
|
|
|
|
// ✅ Use centralized logger - ONE LINE!
|
|
// Create custom logger for testing hub
|
|
const testingLog = window.LogConfig.createLogger('TESTING-HUB');
|
|
|
|
/**
|
|
* Testing Hub Alpine.js Component
|
|
* Central hub for all test suites and QA tools
|
|
*/
|
|
function adminTestingHub() {
|
|
return {
|
|
// ✅ CRITICAL: Inherit base layout functionality
|
|
...data(),
|
|
|
|
// ✅ CRITICAL: Set page identifier
|
|
currentPage: 'testing',
|
|
|
|
// Test suites data
|
|
testSuites: [
|
|
{
|
|
id: 'auth-flow',
|
|
name: 'Authentication Flow',
|
|
description: 'Test login, logout, token expiration, redirects, and protected route access.',
|
|
url: '/admin/test/auth-flow',
|
|
icon: 'lock-closed',
|
|
color: 'blue',
|
|
testCount: 6,
|
|
features: [
|
|
'Login with valid/invalid credentials',
|
|
'Token expiration handling',
|
|
'Protected route access & redirects',
|
|
'localStorage state monitoring'
|
|
]
|
|
},
|
|
{
|
|
id: 'vendors-users',
|
|
name: 'Data Migration & CRUD',
|
|
description: 'Test vendor and user creation, listing, editing, deletion, and data migration scenarios.',
|
|
url: '/admin/test/vendors-users-migration',
|
|
icon: 'database',
|
|
color: 'orange',
|
|
testCount: 10,
|
|
features: [
|
|
'Vendor CRUD operations',
|
|
'User management & roles',
|
|
'Data migration validation',
|
|
'Form validation & error handling'
|
|
]
|
|
}
|
|
],
|
|
|
|
// Stats
|
|
stats: {
|
|
totalSuites: 2,
|
|
totalTests: 16,
|
|
coverage: 'Auth, CRUD',
|
|
avgDuration: '< 5 min'
|
|
},
|
|
|
|
// Loading state
|
|
loading: false,
|
|
|
|
// ✅ CRITICAL: Proper initialization with guard
|
|
async init() {
|
|
testingLog.info('=== TESTING HUB INITIALIZING ===');
|
|
|
|
// Prevent multiple initializations
|
|
if (window._testingHubInitialized) {
|
|
testingLog.warn('Testing hub already initialized, skipping...');
|
|
return;
|
|
}
|
|
window._testingHubInitialized = true;
|
|
|
|
// Calculate stats
|
|
this.calculateStats();
|
|
|
|
testingLog.info('=== TESTING HUB INITIALIZATION COMPLETE ===');
|
|
},
|
|
|
|
/**
|
|
* Calculate test statistics
|
|
*/
|
|
calculateStats() {
|
|
this.stats.totalSuites = this.testSuites.length;
|
|
this.stats.totalTests = this.testSuites.reduce((sum, suite) => sum + suite.testCount, 0);
|
|
testingLog.debug('Stats calculated:', this.stats);
|
|
},
|
|
|
|
/**
|
|
* Get color classes for test suite cards
|
|
*/
|
|
getColorClasses(color) {
|
|
const colorMap = {
|
|
blue: {
|
|
gradient: 'from-blue-500 to-blue-600',
|
|
button: 'bg-blue-600 hover:bg-blue-700'
|
|
},
|
|
orange: {
|
|
gradient: 'from-orange-500 to-orange-600',
|
|
button: 'bg-orange-600 hover:bg-orange-700'
|
|
},
|
|
green: {
|
|
gradient: 'from-green-500 to-green-600',
|
|
button: 'bg-green-600 hover:bg-green-700'
|
|
},
|
|
purple: {
|
|
gradient: 'from-purple-500 to-purple-600',
|
|
button: 'bg-purple-600 hover:bg-purple-700'
|
|
}
|
|
};
|
|
return colorMap[color] || colorMap.blue;
|
|
},
|
|
|
|
/**
|
|
* Navigate to test suite
|
|
*/
|
|
goToTest(url) {
|
|
testingLog.info('Navigating to test suite:', url);
|
|
window.location.href = url;
|
|
}
|
|
};
|
|
}
|
|
|
|
testingLog.info('Testing hub module loaded'); |