feat: Enhance project and scenario creation with monitoring metrics
- Added monitoring metrics for project creation success and error handling in `ProjectRepository`. - Implemented similar monitoring for scenario creation in `ScenarioRepository`. - Refactored `run_monte_carlo` function in `simulation.py` to include timing and success/error metrics. - Introduced new CSS styles for headers, alerts, and navigation buttons in `main.css` and `projects.css`. - Created a new JavaScript file for navigation logic to handle chevron buttons. - Updated HTML templates to include new navigation buttons and improved styling for buttons. - Added tests for reporting service and routes to ensure proper functionality and access control. - Removed unused imports and optimized existing test files for better clarity and performance.
This commit is contained in:
53
static/js/navigation.js
Normal file
53
static/js/navigation.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// Navigation chevron buttons logic
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const navPrev = document.getElementById("nav-prev");
|
||||
const navNext = document.getElementById("nav-next");
|
||||
|
||||
if (!navPrev || !navNext) return;
|
||||
|
||||
// Define the navigation order (main pages)
|
||||
const navPages = [
|
||||
"/",
|
||||
"/projects/ui",
|
||||
"/imports/ui",
|
||||
"/ui/simulations",
|
||||
"/ui/reporting",
|
||||
"/ui/settings",
|
||||
];
|
||||
|
||||
const currentPath = window.location.pathname;
|
||||
|
||||
// Find current index
|
||||
let currentIndex = -1;
|
||||
for (let i = 0; i < navPages.length; i++) {
|
||||
if (currentPath.startsWith(navPages[i])) {
|
||||
currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If not found, disable both
|
||||
if (currentIndex === -1) {
|
||||
navPrev.disabled = true;
|
||||
navNext.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up prev button
|
||||
if (currentIndex > 0) {
|
||||
navPrev.addEventListener("click", function () {
|
||||
window.location.href = navPages[currentIndex - 1];
|
||||
});
|
||||
} else {
|
||||
navPrev.disabled = true;
|
||||
}
|
||||
|
||||
// Set up next button
|
||||
if (currentIndex < navPages.length - 1) {
|
||||
navNext.addEventListener("click", function () {
|
||||
window.location.href = navPages[currentIndex + 1];
|
||||
});
|
||||
} else {
|
||||
navNext.disabled = true;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user