utils cleanup, initial static generation

This commit is contained in:
Ben Phelps 2022-09-26 12:04:37 +03:00
parent ec8700f3e9
commit e1a3a82f75
86 changed files with 279 additions and 261 deletions

View file

@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
import Widget from "components/services/widgets/widget";
import Block from "components/services/widgets/block";
import { formatProxyUrl } from "utils/api-helpers";
import { formatProxyUrl } from "utils/proxy/api-helpers";
export default function Component({ service }) {
const { t } = useTranslation();
@ -30,11 +30,13 @@ export default function Component({ service }) {
const yesterday = new Date(Date.now()).setHours(-24);
const loginsLast24H = loginsData.reduce(
(total, current) => current.x_cord >= yesterday ? total + current.y_cord : total
, 0);
(total, current) => (current.x_cord >= yesterday ? total + current.y_cord : total),
0
);
const failedLoginsLast24H = failedLoginsData.reduce(
(total, current) => current.x_cord >= yesterday ? total + current.y_cord : total
, 0);
(total, current) => (current.x_cord >= yesterday ? total + current.y_cord : total),
0
);
return (
<Widget>

View file

@ -1,18 +1,18 @@
import credentialedProxyHandler from "utils/proxies/credentialed";
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/v3/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
"users": {
endpoint: "core/users?page_size=1"
users: {
endpoint: "core/users?page_size=1",
},
"login": {
endpoint: "events/events/per_month/?action=login&query={}"
login: {
endpoint: "events/events/per_month/?action=login&query={}",
},
"login_failed": {
endpoint: "events/events/per_month/?action=login_failed&query={}"
login_failed: {
endpoint: "events/events/per_month/?action=login_failed&query={}",
},
},
};