This commit is contained in:
tree 2023-07-12 17:33:38 +00:00
rodič a46f39184c
revize db6ddaf889
2 změnil soubory, kde provedl 9 přidání a 8 odebrání

Zobrazit soubor

@ -472,14 +472,14 @@ router
perf(ctx);
})
.get("/plc/:host", async (ctx) => {
const item = ats.ecosystem.data['plc-directories'].find((f) =>
const item = ats.ecosystem.data["plc-directories"].find((f) =>
f.url === `https://${ctx.params.host}`
);
if (!item) {
return ctx.response.code = 404;
}
Object.assign(item, await prepareObject("plc", item));
ctx.response.body = item;
ctx.response.body = item;
perf(ctx);
})
.get("/_metrics", async (ctx) => {

Zobrazit soubor

@ -7,7 +7,7 @@
export let data;
function tableMap({ val, key, row }) {
console.log({ key, val });
//console.log({ key, val });
if (key === 'world') {
val = `<span class="badge variant-filled bg-ats-fed-${row.federation} dark:bg-ats-fed-${row.federation} opacity-70 text-white dark:text-black ucfirst">${row.federation}</span>`;
}
@ -25,8 +25,9 @@
val += ` <div class="text-xs inline-block ml-2">(+${formatNumber(row.pdsCount)})</div>`;
}
}
if (key === 'time') {
val = row.lastUpdate ? `<span class="text-xs">${dateDistance(row.lastUpdate)} ago</a>` : '-';
if (key === 'lastUpdate') {
//val = row.lastUpdate ? : '-';
val = val ? `<span class="text-xs">${dateDistance(val)} ago</span>` : '-';
}
if (key === 'url_raw') {
val = `/plc/${row.host}`;
@ -34,13 +35,13 @@
return val;
}
const sourceData = data.plcs.sort((x, y) => (x.didsCount > y.didsCount ? -1 : 1));
const tableSimple = {
$: sourceData = data.plcs.sort((x, y) => (x.didsCount > y.didsCount ? -1 : 1));
$: tableSimple = {
// A list of heading labels.
head: ['Federation', 'Host', 'DIDs', 'PDS', 'Last mod'],
body: customTableMapper(
sourceData,
['world', 'host', 'didsCount', 'pdsCount', 'time'],
['world', 'host', 'didsCount', 'pdsCount', 'lastUpdate'],
tableMap
),
meta: customTableMapper(sourceData, ['id', 'url_raw'], tableMap)