-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
426bb42
commit b2d1e12
Showing
46 changed files
with
1,436 additions
and
1,404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,113 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
|
||
// Base config | ||
extends: ["eslint:recommended", "prettier", "plugin:@next/next/recommended"], | ||
// Base config | ||
extends: ["eslint:recommended", "prettier", "plugin:@next/next/recommended"], | ||
|
||
rules: { | ||
"no-console": "warn", | ||
"react/jsx-curly-brace-presence": [2, { props: "never", children: "never" }], | ||
"react/no-unknown-property": [ | ||
2, | ||
{ | ||
ignore: ["jsx"], | ||
}, | ||
], | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"no-restricted-syntax": [ | ||
"error", | ||
// Ensure import from 'react' is not `useLayoutEffect` | ||
{ | ||
selector: | ||
'ImportDeclaration[source.value="react"] > ImportSpecifier[imported.name="useLayoutEffect"]', | ||
message: "Please use ``useLayoutEffect` from custom hook `useIsomorphicLayoutEffect", | ||
}, | ||
// Ensure import from '*useIsomorphicLayoutEffect' is `useLayoutEffect` to leverage `eslint-plugin-react-hooks` | ||
{ | ||
selector: | ||
'ImportDeclaration[source.value=/useIsomorphicLayoutEffect/] > ImportDefaultSpecifier[local.name!="useLayoutEffect"]', | ||
message: | ||
"Must use `useLayoutEffect` as the name of the import from `*useIsomorphicLayoutEffect` to leverage `eslint-plugin-react-hooks`", | ||
}, | ||
], | ||
}, | ||
rules: { | ||
"no-console": "warn", | ||
"react/jsx-curly-brace-presence": [2, { props: "never", children: "never" }], | ||
"react/no-unknown-property": [ | ||
2, | ||
{ | ||
ignore: ["jsx"], | ||
}, | ||
], | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"no-restricted-syntax": [ | ||
"error", | ||
// Ensure import from 'react' is not `useLayoutEffect` | ||
{ | ||
selector: | ||
'ImportDeclaration[source.value="react"] > ImportSpecifier[imported.name="useLayoutEffect"]', | ||
message: "Please use ``useLayoutEffect` from custom hook `useIsomorphicLayoutEffect", | ||
}, | ||
// Ensure import from '*useIsomorphicLayoutEffect' is `useLayoutEffect` to leverage `eslint-plugin-react-hooks` | ||
{ | ||
selector: | ||
'ImportDeclaration[source.value=/useIsomorphicLayoutEffect/] > ImportDefaultSpecifier[local.name!="useLayoutEffect"]', | ||
message: | ||
"Must use `useLayoutEffect` as the name of the import from `*useIsomorphicLayoutEffect` to leverage `eslint-plugin-react-hooks`", | ||
}, | ||
], | ||
}, | ||
|
||
overrides: [ | ||
// React | ||
{ | ||
files: ["**/*.{js,jsx,ts,tsx}"], | ||
plugins: ["react", "jsx-a11y"], | ||
extends: [ | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:react-hooks/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
formComponents: ["Form", "ValidatedForm"], | ||
linkComponents: [ | ||
{ name: "Link", linkAttribute: "to" }, | ||
{ name: "NavLink", linkAttribute: "to" }, | ||
], | ||
"import/resolver": { | ||
typescript: {}, | ||
}, | ||
}, | ||
overrides: [ | ||
// React | ||
{ | ||
files: ["**/*.{js,jsx,ts,tsx}"], | ||
plugins: ["react", "jsx-a11y"], | ||
extends: [ | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:react-hooks/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
// shadcn | ||
{ | ||
files: ["**/components/ui/*.tsx"], | ||
rules: { | ||
"react/prop-types": "off", | ||
"react-refresh/only-export-components": "off", | ||
}, | ||
formComponents: ["Form", "ValidatedForm"], | ||
linkComponents: [ | ||
{ name: "Link", linkAttribute: "to" }, | ||
{ name: "NavLink", linkAttribute: "to" }, | ||
], | ||
"import/resolver": { | ||
typescript: {}, | ||
}, | ||
}, | ||
}, | ||
// shadcn | ||
{ | ||
files: ["**/components/ui/*.tsx"], | ||
rules: { | ||
"react/prop-types": "off", | ||
"react-refresh/only-export-components": "off", | ||
}, | ||
}, | ||
|
||
// Typescript | ||
{ | ||
files: ["**/*.{ts,tsx}"], | ||
plugins: ["@typescript-eslint", "import"], | ||
parser: "@typescript-eslint/parser", | ||
settings: { | ||
"import/internal-regex": "^~/", | ||
"import/resolver": { | ||
node: { | ||
extensions: [".ts", ".tsx"], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
], | ||
// Typescript | ||
{ | ||
files: ["**/*.{ts,tsx}"], | ||
plugins: ["@typescript-eslint", "import"], | ||
parser: "@typescript-eslint/parser", | ||
settings: { | ||
"import/internal-regex": "^~/", | ||
"import/resolver": { | ||
node: { | ||
extensions: [".ts", ".tsx"], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
], | ||
}, | ||
|
||
// Node | ||
{ | ||
files: [".eslintrc.js"], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; | ||
// Node | ||
{ | ||
files: [".eslintrc.js"], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ const config = { | |
tailwindFunctions: ["cn"], | ||
}; | ||
|
||
module.exports = config; | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,51 @@ | ||
"use client" | ||
"use client"; | ||
|
||
import {ColumnDef} from "@tanstack/table-core"; | ||
import {EndpointActivityDAO} from "@/app/domain/dao/endpointActivity"; | ||
import {DataTableColumnHeader} from "@/components/custom/data-table-column-header"; | ||
import {useEffect, useState} from "react"; | ||
import { ColumnDef } from "@tanstack/table-core"; | ||
import { EndpointActivityDAO } from "@/app/domain/dao/endpointActivity"; | ||
import { DataTableColumnHeader } from "@/components/custom/data-table-column-header"; | ||
import { useEffect, useState } from "react"; | ||
|
||
export const endpointActivityColumns: ColumnDef<EndpointActivityDAO>[] = [ | ||
{ | ||
accessorKey: "date", | ||
header: ({ column }) => ( | ||
<DataTableColumnHeader column={column} title="Timestamp" /> | ||
), | ||
cell: ({ row }) => { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const [date, setDate] = useState("") | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
useEffect(() => { | ||
const d = row.getValue("date") as Date; | ||
setDate(d.toLocaleString()) | ||
}, [row]) | ||
return <div className="text-left">{date}</div> | ||
}, | ||
{ | ||
accessorKey: "date", | ||
header: ({ column }) => <DataTableColumnHeader column={column} title="Timestamp" />, | ||
cell: ({ row }) => { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const [date, setDate] = useState(""); | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
useEffect(() => { | ||
const d = row.getValue("date") as Date; | ||
setDate(d.toLocaleString()); | ||
}, [row]); | ||
return <div className="text-left">{date}</div>; | ||
}, | ||
{ | ||
accessorKey: "service", | ||
header: ({ column }) => ( | ||
<DataTableColumnHeader column={column} title="Service" /> | ||
), | ||
cell: ({ row }) => { | ||
return <div className="text-center">{row.getValue("service")}</div> | ||
}, | ||
}, | ||
{ | ||
accessorKey: "service", | ||
header: ({ column }) => <DataTableColumnHeader column={column} title="Service" />, | ||
cell: ({ row }) => { | ||
return <div className="text-center">{row.getValue("service")}</div>; | ||
}, | ||
{ | ||
accessorKey: "version", | ||
header: ({ column }) => ( | ||
<DataTableColumnHeader column={column} title="Version" /> | ||
), | ||
cell: ({ row }) => { | ||
return <div className="text-center">{row.getValue("version")}</div> | ||
}, | ||
}, | ||
{ | ||
accessorKey: "version", | ||
header: ({ column }) => <DataTableColumnHeader column={column} title="Version" />, | ||
cell: ({ row }) => { | ||
return <div className="text-center">{row.getValue("version")}</div>; | ||
}, | ||
{ | ||
accessorKey: "endpoint", | ||
header: ({ column }) => ( | ||
<DataTableColumnHeader column={column} title="Endpoint" /> | ||
), | ||
cell: ({ row }) => { | ||
return <div className="text-left">{row.getValue("endpoint")}</div> | ||
}, | ||
}, | ||
{ | ||
accessorKey: "endpoint", | ||
header: ({ column }) => <DataTableColumnHeader column={column} title="Endpoint" />, | ||
cell: ({ row }) => { | ||
return <div className="text-left">{row.getValue("endpoint")}</div>; | ||
}, | ||
{ | ||
accessorKey: "type", | ||
header: ({ column }) => ( | ||
<DataTableColumnHeader column={column} title="RequestType" /> | ||
), | ||
cell: ({ row }) => { | ||
return <div className="text-center">{row.getValue("type")}</div> | ||
}, | ||
}, | ||
{ | ||
accessorKey: "type", | ||
header: ({ column }) => <DataTableColumnHeader column={column} title="RequestType" />, | ||
cell: ({ row }) => { | ||
return <div className="text-center">{row.getValue("type")}</div>; | ||
}, | ||
] | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
import {Menu} from "@/components/custom/menu"; | ||
import {DataTable} from "@/components/custom/data-table"; | ||
import {endpointActivityColumns} from "@/app/admin/columns"; | ||
import { Menu } from "@/components/custom/menu"; | ||
import { DataTable } from "@/components/custom/data-table"; | ||
import { endpointActivityColumns } from "@/app/admin/columns"; | ||
import applicationContainer from "@/app/server/applicationContainer"; | ||
|
||
export default async function Admin() { | ||
const metricsService = applicationContainer.getMetricsService(); | ||
const data = await metricsService.getEndpointActivity(); | ||
return ( | ||
<div className="m-5 text-center"> | ||
<div className="pb-5"> | ||
<Menu/> | ||
</div> | ||
<div className="pb-5"> | ||
<DataTable title="Endpoint Activity" description="Time series of all endpoint activities" columns={endpointActivityColumns} data={data} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
const metricsService = applicationContainer.getMetricsService(); | ||
const data = await metricsService.getEndpointActivity(); | ||
return ( | ||
<div className="m-5 text-center"> | ||
<div className="pb-5"> | ||
<Menu /> | ||
</div> | ||
<div className="pb-5"> | ||
<DataTable | ||
title="Endpoint Activity" | ||
description="Time series of all endpoint activities" | ||
columns={endpointActivityColumns} | ||
data={data} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import NextAuth from "next-auth" | ||
import NextAuth from "next-auth"; | ||
import GithubProvider from "next-auth/providers/github"; | ||
|
||
const providers = [ | ||
GithubProvider({ | ||
clientId: process.env.GITHUB_ID as string, | ||
clientSecret: process.env.GITHUB_SECRET as string, | ||
}), | ||
] | ||
GithubProvider({ | ||
clientId: process.env.GITHUB_ID as string, | ||
clientSecret: process.env.GITHUB_SECRET as string, | ||
}), | ||
]; | ||
|
||
const authOptions = { | ||
providers: providers, | ||
providers: providers, | ||
}; | ||
|
||
const handler = NextAuth(authOptions) | ||
const handler = NextAuth(authOptions); | ||
|
||
export { handler as GET, handler as POST} | ||
export { handler as GET, handler as POST }; |
Oops, something went wrong.