var histArray = {}; loadHistory(); function createHTML(hist, i) { let allState = ""; let color = ""; for (let state of hist.State){ if (state.State) { color = `bi-check-circle-fill" style="color:var(--bs-success);"`; } else { color = `bi-dash-circle-fill" style="color:var(--bs-danger);"`; } allState = allState + ``; } let html = ` ${i}. ${hist.Name} ${hist.Addr} ${hist.Port} ${hist.PortName} ${allState} `; return html; } async function loadHistory() { let url = '/api/history'; let histMap = await (await fetch(url)).json(); if (histMap != null) { histArray = Object.values(histMap); } displayArrayData(histArray); } function sortBy(field) { sortByAny(histArray, field); }