All checks were successful
CI / ci (push) Successful in 14s
- Introduced a new `stats.py` module to encapsulate dashboard statistics building and cache key constants. - Refactored `views.py` to utilize the new `build_stats` function for constructing metrics context, improving code organization and readability. - Updated Prometheus query handling to streamline metrics fetching with a new `fetch_dashboard_metrics` function. - Enhanced test cases to reflect changes in metrics fetching and context building, ensuring accurate functionality. - Added new HTML templates for displaying detailed resource allocation and flavor statistics on the dashboard.
59 lines
1.8 KiB
HTML
59 lines
1.8 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static mathfilters %}
|
|
|
|
{% block imports %}
|
|
<script src="{% static 'js/utils.js' %}"></script>
|
|
<script src="{% static 'js/chart.js' %}"></script>
|
|
<script src="{% static 'js/chartjs-plugin-datalabels.min.js' %}"></script>
|
|
<script src="{% static 'js/chartjs-plugin-annotation.min.js' %}"></script>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<!-- MAIN DASHBOARD -->
|
|
<div id="dashboard-content" class="p-4 space-y-8" {% if skeleton %}data-dashboard="skeleton"{% endif %}>
|
|
{% include "dashboard/_stats_cards.html" %}
|
|
{% include "dashboard/_allocation_flavors.html" %}
|
|
{% include "dashboard/_audit_section.html" %}
|
|
{% include "dashboard/_chart_migrations.html" %}
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
|
<script>
|
|
const SKELETON_MODE = {{ skeleton|yesno:"true,false" }};
|
|
const CURRENT_CLUSTER = {% if current_cluster %}{ "host_labels": {{ current_cluster.host_labels|safe }}, "cpu_current": {{ current_cluster.cpu_current|safe }} }{% else %}null{% endif %};
|
|
|
|
window.auditData = {
|
|
{% if not skeleton %}
|
|
{% for audit in audits %}
|
|
"{{ audit.id }}": {
|
|
name: "{{ audit.name }}",
|
|
migrations: {{ audit.migrations|safe }},
|
|
hostData: {
|
|
labels: {{ audit.host_labels|safe }},
|
|
current: {{ audit.cpu_current|safe }},
|
|
projected: {{ audit.cpu_projected|safe }}
|
|
}
|
|
}{% if not forloop.last %},{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
};
|
|
var INITIAL_AUDIT_ID = "{% if audits %}{{ audits.0.id }}{% endif %}";
|
|
</script>
|
|
<script src="{% static 'js/dashboard.js' %}"></script>
|
|
{% endblock %}
|
|
|
|
{% block css %}
|
|
<style>
|
|
.progress {
|
|
@apply h-2 rounded-full;
|
|
}
|
|
.table td, .table th {
|
|
@apply px-4 py-3;
|
|
}
|
|
.badge-xs {
|
|
@apply px-1.5 py-0.5 text-xs;
|
|
}
|
|
</style>
|
|
{% endblock %}
|