|
|
|
|
|
console.log("App loaded"); |
|
|
|
|
|
|
|
|
const techCombinations = { |
|
|
backend: { |
|
|
'FastAPI': { |
|
|
orm: ['SQLAlchemy', 'Tortoise ORM', 'Django ORM'], |
|
|
packageManager: ['pip', 'poetry', 'uv'], |
|
|
runtime: ['Python 3.12', 'Python 3.11'] |
|
|
}, |
|
|
'Django': { |
|
|
orm: ['Django ORM', 'SQLAlchemy'], |
|
|
packageManager: ['pip', 'poetry', 'uv'], |
|
|
runtime: ['Python 3.12', 'Python 3.11'] |
|
|
}, |
|
|
'Flask': { |
|
|
orm: ['SQLAlchemy', 'Tortoise ORM'], |
|
|
packageManager: ['pip', 'poetry', 'uv'], |
|
|
runtime: ['Python 3.12', 'Python 3.11'] |
|
|
}, |
|
|
'Express.js': { |
|
|
orm: ['Prisma', 'TypeORM', 'Sequelize', 'Mongoose', 'Drizzle'], |
|
|
packageManager: ['npm', 'yarn', 'pnpm'], |
|
|
runtime: ['Node.js (LTS)', 'Bun'] |
|
|
}, |
|
|
'NestJS': { |
|
|
orm: ['Prisma', 'TypeORM', 'Sequelize', 'Mongoose', 'Drizzle'], |
|
|
packageManager: ['npm', 'yarn', 'pnpm'], |
|
|
runtime: ['Node.js (LTS)', 'Bun'] |
|
|
}, |
|
|
'Spring Boot': { |
|
|
orm: ['Entity Framework'], |
|
|
packageManager: ['nuget'], |
|
|
runtime: ['Java 21 (LTS)'] |
|
|
}, |
|
|
'Ruby on Rails': { |
|
|
orm: [], |
|
|
packageManager: [], |
|
|
runtime: [] |
|
|
}, |
|
|
'Laravel': { |
|
|
orm: [], |
|
|
packageManager: ['composer'], |
|
|
runtime: [] |
|
|
}, |
|
|
'ASP.NET Core': { |
|
|
orm: ['Entity Framework'], |
|
|
packageManager: ['nuget'], |
|
|
runtime: ['.NET 8'] |
|
|
}, |
|
|
'Go (Gin)': { |
|
|
orm: ['GORM'], |
|
|
packageManager: ['go mod'], |
|
|
runtime: ['Go 1.22'] |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
function filterTechnologyOptions() { |
|
|
const backendSelect = document.getElementById('backend'); |
|
|
const ormSelect = document.getElementById('orm'); |
|
|
const packageManagerSelect = document.getElementById('package_manager'); |
|
|
const runtimeSelect = document.getElementById('runtime'); |
|
|
|
|
|
const selectedBackend = backendSelect.value; |
|
|
|
|
|
if (selectedBackend && techCombinations.backend[selectedBackend]) { |
|
|
const compatibleTech = techCombinations.backend[selectedBackend]; |
|
|
|
|
|
|
|
|
filterSelectOptions(ormSelect, compatibleTech.orm); |
|
|
|
|
|
|
|
|
filterSelectOptions(packageManagerSelect, compatibleTech.packageManager); |
|
|
|
|
|
|
|
|
filterSelectOptions(runtimeSelect, compatibleTech.runtime); |
|
|
} else { |
|
|
|
|
|
resetSelectOptions(ormSelect); |
|
|
resetSelectOptions(packageManagerSelect); |
|
|
resetSelectOptions(runtimeSelect); |
|
|
} |
|
|
} |
|
|
|
|
|
function filterSelectOptions(selectElement, allowedValues) { |
|
|
for (const option of selectElement.options) { |
|
|
if (option.value === '') { |
|
|
option.disabled = false; |
|
|
option.style.display = ''; |
|
|
continue; |
|
|
} |
|
|
|
|
|
if (allowedValues.length === 0 || allowedValues.includes(option.value)) { |
|
|
|
|
|
option.disabled = false; |
|
|
option.style.display = ''; |
|
|
} else { |
|
|
option.disabled = true; |
|
|
option.style.display = 'none'; |
|
|
|
|
|
if (option.selected) { |
|
|
selectElement.value = ''; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
function resetSelectOptions(selectElement) { |
|
|
for (const option of selectElement.options) { |
|
|
option.disabled = false; |
|
|
option.style.display = ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
const backendSelect = document.getElementById('backend'); |
|
|
if (backendSelect) { |
|
|
backendSelect.addEventListener('change', filterTechnologyOptions); |
|
|
|
|
|
filterTechnologyOptions(); |
|
|
} |
|
|
}); |