Update data/templates/dashboard.html

This commit is contained in:
2026-05-25 02:05:00 +00:00
parent 266abd4fa2
commit cca8979754
+110 -93
View File
@@ -1,94 +1,111 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% macro render_nested(value) %}
<div class="dashboard-container"> {% if value is mapping %}
<h1>{{ title }}</h1> {% for k, v in value.items() %}
<div class="nested-item">
{# ── Filter bar ─────────────────────────────────────────── #} <span class="nested-key">{{ k }}:</span>
<form class="filter-bar" method="get" id="filter-form" onsubmit=" <span class="nested-value">{{ render_nested(v) }}</span>
this.querySelectorAll('input').forEach(function(el){ if(!el.value) el.disabled = true; }); </div>
"> {% endfor %}
<div class="filter-group"> {% elif value is iterable and not value is string %}
<label for="recon_job_name">Job Name</label> {% for item in value %}
<input type="text" id="recon_job_name" name="recon_job_name" {{ render_nested(item) }}
placeholder="e.g. daily-fx-recon" {% endfor %}
value="{{ recon_job_name or '' }}"> {% else %}
</div> {{ value }}
<div class="filter-group"> {% endif %}
<label for="as_at_date">As-at Date</label> {% endmacro %}
<input type="date" id="as_at_date" name="as_at_date"
value="{{ as_at_date or '' }}">
</div> {% block content %}
<div class="filter-actions"> <div class="dashboard-container">
<button type="submit" class="btn btn-primary">Apply</button> <h1>{{ title }}</h1>
<a href="?" class="btn btn-secondary">Clear</a>
</div> {# ── Filter bar ─────────────────────────────────────────── #}
</form> <form class="filter-bar" method="get" id="filter-form" onsubmit="
<script> this.querySelectorAll('input').forEach(function(el){ if(!el.value) el.disabled = true; });
(function () { ">
var params = new URLSearchParams(window.location.search); <div class="filter-group">
["recon_job_name", "as_at_date"].forEach(function (key) { <label for="recon_job_name">Job Name</label>
var val = params.get(key); <input type="text" id="recon_job_name" name="recon_job_name"
if (val) { placeholder="e.g. daily-fx-recon"
var el = document.getElementById(key); value="{{ recon_job_name or '' }}">
if (el) el.value = val; </div>
} <div class="filter-group">
}); <label for="as_at_date">As-at Date</label>
})(); <input type="date" id="as_at_date" name="as_at_date"
</script> value="{{ as_at_date or '' }}">
</div>
{% if results | length > 0 %} <div class="filter-actions">
<div class="table-scroll"> <button type="submit" class="btn btn-primary">Apply</button>
<table class="data-table"> <a href="?" class="btn btn-secondary">Clear</a>
<thead> </div>
<tr> </form>
{% for key in results[0].keys() %} <script>
<th>{{ key }}</th> (function () {
{% endfor %} var params = new URLSearchParams(window.location.search);
</tr> ["recon_job_name", "as_at_date"].forEach(function (key) {
</thead> var val = params.get(key);
<tbody> if (val) {
{% for row in results %} var el = document.getElementById(key);
<tr> if (el) el.value = val;
{% for key, value in row.items() %} }
<td> });
{% if key == 'Status' %} })();
<span class="badge badge-{{ value | lower }}">{{ value }}</span> </script>
{% elif key == 'Flag' %}
<span class="badge badge-{{ 'none' if value == 'None' else 'flag' }}">{{ value }}</span> {% if results | length > 0 %}
{% else %} <div class="table-scroll">
{{ value }} <table class="data-table">
{% endif %} <thead>
</td> <tr>
{% endfor %} {% for key in results[0].keys() %}
</tr> <th>{{ key }}</th>
{% endfor %} {% endfor %}
</tbody> </tr>
</table> </thead>
</div> <tbody>
{% for row in results %}
{# ── Pagination ─────────────────────────────────────────── #} <tr>
{# Build filter params string only for values that are set #} {% for key, value in row.items() %}
{% set filter_qs %}{% if recon_job_name %}&recon_job_name={{ recon_job_name }}{% endif %}{% if as_at_date %}&as_at_date={{ as_at_date }}{% endif %}{% endset %} <td>
<div class="pagination"> {% if key == 'Status' %}
{% if prev_cursor %} <span class="badge badge-{{ value | lower }}">{{ value }}</span>
<a class="btn btn-secondary" {% elif key == 'Flag' %}
href="?cursor={{ prev_cursor }}{{ filter_qs }}"> <span class="badge badge-{{ 'none' if value == 'None' else 'flag' }}">{{ value }}</span>
← Previous {% else %}
</a> {{ render_nested(value) }}
{% else %} {% endif %}
<span class="btn btn-secondary btn-disabled">← Previous</span> </td>
{% endif %} {% endfor %}
</tr>
{% if next_cursor %} {% endfor %}
<a class="btn btn-secondary" </tbody>
href="?cursor={{ next_cursor }}{{ filter_qs }}"> </table>
Next → </div>
</a>
{% else %} {# ── Pagination ─────────────────────────────────────────── #}
<span class="btn btn-secondary btn-disabled">Next →</span> {% set filter_qs %}{% if recon_job_name %}&recon_job_name={{ recon_job_name }}{% endif %}{% if as_at_date %}&as_at_date={{ as_at_date }}{% endif %}{% endset %}
{% endif %} <div class="pagination">
</div> {% if prev_cursor %}
{% endif %} <a class="btn btn-secondary"
</div> href="?cursor={{ prev_cursor }}{{ filter_qs }}">
← Previous
</a>
{% else %}
<span class="btn btn-secondary btn-disabled">← Previous</span>
{% endif %}
{% if next_cursor %}
<a class="btn btn-secondary"
href="?cursor={{ next_cursor }}{{ filter_qs }}">
Next →
</a>
{% else %}
<span class="btn btn-secondary btn-disabled">Next →</span>
{% endif %}
</div>
{% endif %}
</div>
{% endblock %} {% endblock %}