refactor admin navigation; update links to ingest pages and improve loading of data in parallel
This commit is contained in:
@@ -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(),
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user