Add empty view to stats page

This commit is contained in:
rubenwardy 2022-11-06 19:47:39 +00:00
parent 53601b77c8
commit b0cece3f5f
2 changed files with 11 additions and 2 deletions

@ -34,12 +34,18 @@ async function load_data() {
const response = await fetch(source);
const json = await response.json();
document.getElementById("loading").style.display = "none";
if (json == null) {
document.getElementById("empty-view").style.display = "block";
return;
}
const jsonOther = json.platform_minetest.map((value, i) =>
value + json.platform_other[i]
- json.reason_new[i] - json.reason_dependency[i]
- json.reason_update[i]);
document.getElementById("loading").style.display = "none";
root.style.display = "block";
function getData(list) {

@ -7,7 +7,7 @@
{% block scriptextra %}
<script src="/static/libs/chart.min.js"></script>
<script src="/static/libs/chartjs-adapter-date-fns.bundle.min.js"></script>
<script src="/static/package_charts.js"></script>
<script src="/static/package_charts.js?v=2"></script>
{% endblock %}
{% block content %}
@ -35,6 +35,9 @@
</div>
</div>
<div id="loading">{{ _("Loading...") }}</div>
<div id="empty-view" style="display: none;">
{{ _("No data") }}
</div>
<div id="stats-root" data-source="{{ package.getURL('api.package_stats') }}" style="display: none;">
<h3>{{ _("Downloads") }}</h3>