From d116950a9347a6789f48599b6490b0de4a15ecbb Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 24 Oct 2023 14:46:12 +0200 Subject: [PATCH] Avoid metrics being entirely empty --- scripts/graph/metrics.ts | 6 +++++- templates/pages/graph.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/graph/metrics.ts b/scripts/graph/metrics.ts index 7df0e1a..4434823 100644 --- a/scripts/graph/metrics.ts +++ b/scripts/graph/metrics.ts @@ -95,7 +95,11 @@ export class Metrics { } this.#div.textContent = ""; // Remove children - this.#div.append(folder.childrenToHtmlElements()); + if (folder.children.size == 0) { + this.#div.append("There aren't yet any metrics"); + } else { + this.#div.append(folder.childrenToHtmlElements()); + } const inputs = this.#div.querySelectorAll("input"); for (const input of inputs) { diff --git a/templates/pages/graph.html b/templates/pages/graph.html index 8e8c299..abb3fb4 100644 --- a/templates/pages/graph.html +++ b/templates/pages/graph.html @@ -13,7 +13,7 @@
-
+
Loading metrics...
{% endblock %}