aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/frontend/html/indexer
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2024-11-18 08:41:46 +0100
committerGitHub Enterprise <[email protected]>2024-11-18 08:41:46 +0100
commitcca69117b7ffac5cdd8933148ed9c94dd241528d (patch)
treeba9dfce342e86d9cbdf6cf54059e1e7d618eecee /src/zenserver/frontend/html/indexer
parentoplog prep gc fix (#216) (diff)
downloadzen-cca69117b7ffac5cdd8933148ed9c94dd241528d.tar.xz
zen-cca69117b7ffac5cdd8933148ed9c94dd241528d.zip
Dashboard: oplog tree view (#217)
* Turned tables and progress bars and friends into "widgets!" * A step to abstracting away a page's the internal DOM structure * Folded sector creation into Page and pivoted it to a widget host * Try and keep start/count as numbers regardless of input * No need for the entry table to be defined up front now * Add op count and log sixe to oplog list page * Cache left side toolbar object * Bounds count page start when building list of oplog entrie * Start/end navigation tools * Build rest of entry page while waiting for indexer to load * Consistent naming with other pages * Spacially consolidate fetching code * Hide fetch latency to speed up index generation workers * Extract dashboard structure from zen.js monolith * Fix breadcrumbs after restructuring * Add view link to actions cell of oplogs list * Generator to enumerate names of entries in indexer * Methods for simple traversal of component relations * is() to check if a component is of a certain type * Extend attr() to get and unset a component's attributes * Unsetting all styles of anchor tags was underisrable * Restore page name as id of container element * A tree view of an oplog * Move helper class out to private module scope * Small tweak to use left var that already exists * Changelog update * Updated frontend .zip archive
Diffstat (limited to 'src/zenserver/frontend/html/indexer')
-rw-r--r--src/zenserver/frontend/html/indexer/indexer.js7
-rw-r--r--src/zenserver/frontend/html/indexer/worker.js27
2 files changed, 26 insertions, 8 deletions
diff --git a/src/zenserver/frontend/html/indexer/indexer.js b/src/zenserver/frontend/html/indexer/indexer.js
index 8e5003edf..5bbb7c352 100644
--- a/src/zenserver/frontend/html/indexer/indexer.js
+++ b/src/zenserver/frontend/html/indexer/indexer.js
@@ -48,6 +48,13 @@ class Indexer
if (name.indexOf(needle) >= 0)
yield name;
}
+
+ *enum_names()
+ {
+ for (const page of this._pages)
+ for (const [_, name] of page)
+ yield name;
+ }
}
diff --git a/src/zenserver/frontend/html/indexer/worker.js b/src/zenserver/frontend/html/indexer/worker.js
index 581746d6c..b8183cc6f 100644
--- a/src/zenserver/frontend/html/indexer/worker.js
+++ b/src/zenserver/frontend/html/indexer/worker.js
@@ -21,19 +21,31 @@ export class Message
////////////////////////////////////////////////////////////////////////////////
async function map_id_to_key(project_id, oplog, start, end, page_size, stride)
{
+ if (start >= end)
+ return postMessage(Message.create(Message.MapDone));
+
const uri = "/prj/" + project_id + "/oplog/" + oplog + "/entries";
- while (start < end)
- {
- performance.mark("fetch");
+
+ const fetch_page = async function(index) {
const cbo = new Fetcher()
.resource(uri)
- .param("start", start)
+ .param("start", index)
.param("count", page_size)
.param("fieldfilter", "packagedata,key")
.cbo()
- const entry_count = Math.min(page_size, -(start - end));
- var result = new Array(entry_count);
+ const entry_count = Math.min(page_size, -(index - end));
+ return [await cbo, entry_count];
+ };
+
+ var fetch = fetch_page(start);
+ while (fetch !== undefined)
+ {
+ performance.mark("fetch");
+
+ const [cbo, entry_count] = await fetch;
+ start += stride;
+ fetch = (start < end) ? fetch_page(start) : undefined;
var entries = (await cbo).as_object().find("entries");
if (entries == undefined)
@@ -45,6 +57,7 @@ async function map_id_to_key(project_id, oplog, start, end, page_size, stride)
performance.mark("build");
var count = 0;
+ var result = new Array(entry_count);
for (var entry of entries)
{
if (!entry.is_object())
@@ -84,8 +97,6 @@ async function map_id_to_key(project_id, oplog, start, end, page_size, stride)
count++;
}
- start += stride;
-
if (count == 0)
continue;