refactor admin navigation; update links to ingest pages and improve loading of data in parallel

This commit is contained in:
ImBenji
2026-04-24 00:08:52 +01:00
parent 16cd61fdf5
commit fc7ea464b3
17 changed files with 292 additions and 67 deletions
+14 -11
View File
@@ -19,7 +19,9 @@ function syncUrl() {
async function loadKnowledge() {
const companyId = document.getElementById("i-company").value;
// fall back to url params when the company dropdown hasn't populated
// yet — lets init fire all api calls in parallel
const companyId = document.getElementById("i-company").value || queryGet("company_id");
const type = document.getElementById("i-type").value;
const sort = document.getElementById("i-sort").value;
@@ -73,18 +75,19 @@ document.addEventListener("DOMContentLoaded", async () => {
loadKnowledge();
};
const ok = await loadIntelStatsRow();
if (!ok) return;
await loadIntelCompanies();
// restore from url (after dropdown is populated so company_id options exist)
// restore non-async inputs from url up-front (company_id is handled
// inside loadIntelCompanies once the dropdown has options)
queryApplyToInputs({
"i-company": "company_id",
"i-type": "type",
"i-sort": "sort",
"i-type": "type",
"i-sort": "sort",
});
knowledgeOffset = parseInt(queryGet("offset"), 10) || 0;
loadKnowledge();
// fire all three calls concurrently — loadKnowledge reads company_id
// from the url when the select isn't populated yet
await Promise.all([
loadIntelStatsRow(),
loadIntelCompanies(),
loadKnowledge(),
]);
});