Model-config web apps: describe the app in configuration instead of writing code. Built on Polars and DuckDB.
test_config_page.html · 2.0 KB · 48 lines
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <title>Test Config Page</title> |
| 6 | </head> |
| 7 | <body> |
| 8 | <h1>Testing Config Browser</h1> |
| 9 | |
| 10 | <div id="service-configs"></div> |
| 11 | <div id="framework-configs"></div> |
| 12 | |
| 13 | <script> |
| 14 | // Exact copy of the generated JavaScript |
| 15 | const configs = [{"path": "/Users/danq/websheet/dbbasic/shipping_config_example.yaml", "category": "Service Configs", "name": "Shipping Config Example"}, {"path": "/Users/danq/websheet/dbbasic/calculate_shipping_config.yaml", "category": "Service Configs", "name": "Calculate Shipping Config"}, {"path": "/Users/danq/websheet/dbbasic/docs/paradigms/NEXTJS_IN_CONFIG.yaml", "category": "Frameworks as Config", "name": "Nextjs"}]; |
| 16 | |
| 17 | console.log('Loaded configs:', configs); |
| 18 | console.log('Type of configs:', typeof configs); |
| 19 | console.log('Is array?:', Array.isArray(configs)); |
| 20 | |
| 21 | // Group configs by category |
| 22 | const serviceConfigs = configs.filter(c => c.category === 'Service Configs'); |
| 23 | const frameworkConfigs = configs.filter(c => c.category === 'Frameworks as Config'); |
| 24 | |
| 25 | console.log('Service configs:', serviceConfigs.length); |
| 26 | console.log('Framework configs:', frameworkConfigs.length); |
| 27 | |
| 28 | // Render service configs |
| 29 | const serviceGrid = document.getElementById('service-configs'); |
| 30 | console.log('Service grid element:', serviceGrid); |
| 31 | |
| 32 | if (serviceGrid) { |
| 33 | serviceConfigs.forEach(config => { |
| 34 | const card = document.createElement('div'); |
| 35 | card.className = 'config-card'; |
| 36 | card.innerHTML = ` |
| 37 | <div class="config-name">${config.name}</div> |
| 38 | <div class="config-path">${config.path}</div> |
| 39 | `; |
| 40 | serviceGrid.appendChild(card); |
| 41 | console.log('Added card for:', config.name); |
| 42 | }); |
| 43 | } else { |
| 44 | console.error('Could not find service-configs element!'); |
| 45 | } |
| 46 | </script> |
| 47 | </body> |
| 48 | </html> |