From ec9ec225292130ee7ff625eaf9b70e2924f5ffe6 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Sat, 25 Sep 2021 06:46:24 +0300 Subject: Add progress indicator. Handle errors. Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add a progress indicator to show the user that there is some progress happening, so that they can wait. Add a function to handle any errors that arise. --- wqflask/wqflask/templates/collections/view.html | 44 +++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 99ba3756..05186560 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -267,18 +267,49 @@ function clear_heatmap_area() { area = document.getElementById("clustered-heatmap-image-area"); - area.querySelectorAll("svg").forEach(function(child) { + area.querySelectorAll("*").forEach(function(child) { child.remove(); }); } - function generate_clustered_heatmap(heatmap_data) { + function generate_progress_indicator() { + count = 0; + default_message = "Computing" + return function() { + message = default_message; + if(count >= 10) { + count = 0; + } + for(i = 0; i < count; i++) { + message = message + " ."; + } + clear_heatmap_area(); + $("#clustered-heatmap-image-area").append( + '