feat: Enhance project and scenario creation with monitoring metrics
Some checks failed
CI / lint (push) Failing after 1m14s
CI / test (push) Has been skipped
CI / build (push) Has been skipped

- 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:
2025-11-12 10:36:24 +01:00
parent f68321cd04
commit ce9c174b53
61 changed files with 2124 additions and 308 deletions

View File

@@ -25,6 +25,7 @@
<script src="/static/js/exports.js" defer></script>
<script src="/static/js/imports.js" defer></script>
<script src="/static/js/notifications.js" defer></script>
<script src="/static/js/navigation.js" defer></script>
<script src="/static/js/theme.js"></script>
</body>
</html>

View File

@@ -18,7 +18,7 @@ block content %}
<label for="email">Email:</label>
<input type="email" id="email" name="email" required />
</div>
<button type="submit">Reset Password</button>
<button type="submit" class="btn primary">Reset Password</button>
</form>
<p>Remember your password? <a href="/login">Login here</a></p>
</div>

View File

@@ -26,7 +26,7 @@
<label for="password">Password:</label>
<input type="password" id="password" name="password" required />
</div>
<button type="submit">Login</button>
<button type="submit" class="btn primary">Login</button>
</form>
<p>Don't have an account? <a href="/register">Register here</a></p>
<p><a href="/forgot-password">Forgot password?</a></p>

View File

@@ -1,5 +1,8 @@
<footer class="site-footer">
<div class="container footer-inner">
<div class="footer-logo">
<img src="/static/img/logo_big.png" alt="CalMiner Logo" class="footer-logo-img" />
</div>
<p>
&copy; {{ current_year }} CalMiner by
<a href="https://allucanget.biz/">AllYouCanGET</a>. All rights reserved.

View File

@@ -1,10 +1,14 @@
<div class="sidebar-inner">
<a class="sidebar-brand" href="{{ request.url_for('dashboard.home') }}">
<span class="brand-logo" aria-hidden="true">CM</span>
<img src="/static/img/logo_big.png" alt="CalMiner Logo" class="brand-logo" />
<div class="brand-text">
<span class="brand-title">CalMiner</span>
<span class="brand-subtitle">Mining Planner</span>
</div>
</a>
<div class="sidebar-nav-controls">
<button id="nav-prev" class="nav-chevron nav-chevron-prev" aria-label="Previous page">&larr;</button>
<button id="nav-next" class="nav-chevron nav-chevron-next" aria-label="Next page">&rarr;</button>
</div>
{% include "partials/sidebar_nav.html" %}
</div>

View File

@@ -1,12 +1,12 @@
<div class="scenario-actions">
<a
href="{{ request.url_for('reports.scenario_distribution_page', scenario_id=scenario.id) }}"
href="{{ request.url_for('reports.scenario_distribution_page', scenario_id=item.scenario.id) }}"
class="button button-secondary"
>
View Distribution
</a>
<a
href="{{ request.url_for('reports.scenario_distribution', scenario_id=scenario.id) }}"
href="{{ request.url_for('reports.scenario_distribution', scenario_id=item.scenario.id) }}"
class="button button-secondary"
>
Download JSON

View File

@@ -36,7 +36,7 @@ content %}
<label for="password">Password:</label>
<input type="password" id="password" name="password" required />
</div>
<button type="submit">Register</button>
<button type="submit" class="btn primary">Register</button>
</form>
<p>Already have an account? <a href="/login">Login here</a></p>
</div>

View File

@@ -2,10 +2,10 @@
{% block title %}Project Summary | CalMiner{% endblock %}
{% block content %}
{% include "partials/reports_header.html" with context %}
{% include "partials/reports_header.html" %}
{% include "partials/reports/options_card.html" with options=include_options iterations=iterations percentiles=percentiles %}
{% include "partials/reports/filters_card.html" with filters=filters %}
{% include "partials/reports/options_card.html" %}
{% include "partials/reports/filters_card.html" %}
<section class="report-overview">
<div class="report-grid">
@@ -105,7 +105,7 @@
<span class="meta-label">Currency</span>
<span class="meta-value">{{ item.scenario.currency or project.currency or "—" }}</span>
</div>
{% include "partials/reports/scenario_actions.html" with scenario=item.scenario %}
{% include "partials/reports/scenario_actions.html" %}
</div>
<div class="scenario-grid">
@@ -183,7 +183,7 @@
{% endfor %}
{% endif %}
</p>
{% include "partials/reports/monte_carlo_table.html" with metrics=item.monte_carlo.metrics currency=item.scenario.currency or project.currency percentiles=percentiles %}
{% include "partials/reports/monte_carlo_table.html" %}
{% else %}
<p class="muted">Monte Carlo metrics are unavailable for this scenario.</p>
{% if item.monte_carlo and item.monte_carlo.notes %}

View File

@@ -2,9 +2,9 @@
{% block title %}Scenario Comparison | CalMiner{% endblock %}
{% block content %}
{% include "partials/reports_header.html" with context %}
{% include "partials/reports_header.html" %}
{% include "partials/reports/options_card.html" with options=include_options iterations=iterations percentiles=percentiles %}
{% include "partials/reports/options_card.html" %}
<section class="report-filters">
<div class="report-card">
<h2>Compared Scenarios</h2>
@@ -104,7 +104,7 @@
<span class="meta-label">Primary Resource</span>
<span class="meta-value">{{ item.scenario.primary_resource or "—" }}</span>
</div>
{% include "partials/reports/scenario_actions.html" with scenario=item.scenario %}
{% include "partials/reports/scenario_actions.html" %}
</div>
<div class="scenario-grid">
@@ -147,7 +147,7 @@
{% endfor %}
{% endif %}
</p>
{% include "partials/reports/monte_carlo_table.html" with metrics=item.monte_carlo.metrics currency=item.scenario.currency or project.currency percentiles=percentiles %}
{% include "partials/reports/monte_carlo_table.html" %}
{% else %}
<p class="muted">No Monte Carlo data available for this scenario.</p>
{% if item.monte_carlo and item.monte_carlo.notes %}

View File

@@ -2,7 +2,7 @@
{% block title %}Scenario Distribution | CalMiner{% endblock %}
{% block content %}
{% include "partials/reports_header.html" with context %}
{% include "partials/reports_header.html" %}
<section class="report-overview">
<div class="report-grid">

View File

@@ -26,7 +26,7 @@ content %}
required
/>
</div>
<button type="submit">Update Password</button>
<button type="submit" class="btn primary">Update Password</button>
</form>
<p>
Remembered your password?