From b0cece3f5fc346b596b6bf2bb9fbcaf9306fb67f Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 6 Nov 2022 19:47:39 +0000 Subject: [PATCH] Add empty view to stats page --- app/public/static/package_charts.js | 8 +++++++- app/templates/packages/stats.html | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/public/static/package_charts.js b/app/public/static/package_charts.js index c58f77e4..2397d158 100644 --- a/app/public/static/package_charts.js +++ b/app/public/static/package_charts.js @@ -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) { diff --git a/app/templates/packages/stats.html b/app/templates/packages/stats.html index 7992f7b6..13cf1bed 100644 --- a/app/templates/packages/stats.html +++ b/app/templates/packages/stats.html @@ -7,7 +7,7 @@ {% block scriptextra %} - + {% endblock %} {% block content %} @@ -35,6 +35,9 @@
{{ _("Loading...") }}
+