Merge pull request #16 from apache/no-other
Don't show Other in listing if it is empty
diff --git a/static/plugins/downloads.js b/static/plugins/downloads.js
index cf74231..4d568a5 100644
--- a/static/plugins/downloads.js
+++ b/static/plugins/downloads.js
@@ -142,6 +142,7 @@
const uris_top_downloads = uris.slice(0, 30); // Only include some of the top URIs in the graph
if (!target_uri) {
total_downloads_curated["Other files"] = [];
+ let other_count_total = 0;
for (const day of all_days) {
let other_count = 0;
for (const [uri, entry] of Object.entries(total_downloads_histogram)) {
@@ -154,6 +155,10 @@
}
}
total_downloads_curated["Other files"].push([day, other_count]);
+ other_count_total += other_count;
+ }
+ if (other_count_total == 0) {
+ delete total_downloads_curated["Other files"];
}
}
for (const uri of uris_top_downloads) {
@@ -203,6 +208,7 @@
const uris_top_bytes = uris.slice(0, 30); // Only include some of the top URIs in the graph
if (!target_uri) {
total_bytes_curated["Other files"] = [];
+ let other_count_total = 0;
for (const day of all_days) {
let other_count = 0;
for (const [uri, entry] of Object.entries(total_bytes_histogram)) {
@@ -215,6 +221,10 @@
}
}
total_bytes_curated["Other files"].push([day, other_count]);
+ other_count_total += other_count;
+ }
+ if (other_count_total == 0) {
+ delete total_bytes_curated["Other files"];
}
}
for (const uri of uris_top_bytes) {