Skip to content

Commit

Permalink
clean up clients typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasf committed Mar 14, 2022
1 parent 4de07e6 commit f727a03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
10 changes: 2 additions & 8 deletions assets/static/clients.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions ts/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ interface Row {
out_rate: number;
name: string;
ip: string;
manufacturer: string;
}

var orderBy = "ip";
Expand All @@ -23,16 +24,9 @@ const fmtRate = function (bytes: number, decimals = 2): string {
return `${v} ${sizes[i]}/s`;
};

const hwaddrPrefix = (hwaddr: string) => {
if (!hwaddr) {
return "";
}
return hwaddr.substring(0, 8);
};

const updateData = async () => {
const resp = await fetch(`/v1/stats/?order_by=${orderBy}`);
const data = await resp.json();
const data: Array<Row> = await resp.json();

const el = document.createElement("tbody");
const header = document.createElement("tr");
Expand Down Expand Up @@ -66,7 +60,7 @@ const updateData = async () => {

updateData();

const t = setInterval(async function () {
setInterval(async function () {
if (document.getSelection()?.type !== "Range") {
if (!document.hidden) {
await updateData();
Expand Down

0 comments on commit f727a03

Please sign in to comment.