mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-09 22:47:36 +01:00
Add empty view to stats page
This commit is contained in:
parent
53601b77c8
commit
b0cece3f5f
@ -34,12 +34,18 @@ async function load_data() {
|
|||||||
const response = await fetch(source);
|
const response = await fetch(source);
|
||||||
const json = await response.json();
|
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) =>
|
const jsonOther = json.platform_minetest.map((value, i) =>
|
||||||
value + json.platform_other[i]
|
value + json.platform_other[i]
|
||||||
- json.reason_new[i] - json.reason_dependency[i]
|
- json.reason_new[i] - json.reason_dependency[i]
|
||||||
- json.reason_update[i]);
|
- json.reason_update[i]);
|
||||||
|
|
||||||
document.getElementById("loading").style.display = "none";
|
|
||||||
root.style.display = "block";
|
root.style.display = "block";
|
||||||
|
|
||||||
function getData(list) {
|
function getData(list) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
{% block scriptextra %}
|
{% block scriptextra %}
|
||||||
<script src="/static/libs/chart.min.js"></script>
|
<script src="/static/libs/chart.min.js"></script>
|
||||||
<script src="/static/libs/chartjs-adapter-date-fns.bundle.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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -35,6 +35,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="loading">{{ _("Loading...") }}</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;">
|
<div id="stats-root" data-source="{{ package.getURL('api.package_stats') }}" style="display: none;">
|
||||||
<h3>{{ _("Downloads") }}</h3>
|
<h3>{{ _("Downloads") }}</h3>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user