watchyourlan/internal/web/public/js/hist-html.js
2024-08-24 21:15:10 +07:00

20 lines
No EOL
608 B
JavaScript

function getHistHTML(hist) {
let html = '', col, title;
for (let h of hist) {
if (h.Now != 0) {
col = `fill:var(--bs-success);stroke:var(--bs-primary);`;
} else {
col = `fill:var(--bs-gray-500);stroke:var(--bs-primary);`;
}
title = `title="Date: ${h.Date}\nIface: ${h.Iface}\nIP: ${h.IP}\nKnown: ${h.Known}"`;
html = html + `<i ${title}><svg width="10" height="20">
<rect width="10" height="20" style="${col}"/>
Sorry, your browser does not support inline SVG.
</svg></i>`;
}
return html;
}