This commit is contained in:
Darren Clarke 2024-03-17 12:58:25 +01:00
parent f62c9f064d
commit b8c6e893ff
43 changed files with 4721 additions and 1807 deletions

View file

@ -1,6 +1,11 @@
"use client";
import { FC } from "react";
import { ZammadWrapper } from "./ZammadWrapper";
import { OpenSearchWrapper } from "leafcutter-common";
export const Home: FC = () => <ZammadWrapper path="#dashboard" hideSidebar />;
export const Home: FC = () => (
<OpenSearchWrapper
url="/app/dashboards#/view/c39012d0-eb7a-11ed-8e00-17d7d50cd7b2?embed=true&tenant=global"
marginTop="0"
/>
);

View file

@ -6,10 +6,5 @@ export const metadata: Metadata = {
};
export default function Page() {
return (
<iframe src="/opensearch/app/dashboards?security_tenant=global#/view/722b74f0-b882-11e8-a6d9-e546fe2bba5f?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!f%2Cvalue%3A900000)%2Ctime%3A(from%3Anow-7d%2Cto%3Anow))&hide-filter-bar=true"
height="1000"
width="1200"
></iframe>
);
return <Home />;
}

View file

@ -29,32 +29,16 @@ const checkRewrites = async (request: NextRequestWithAuth) => {
const labelStudioURL = process.env.LABEL_STUDIO_URL ?? "http://label-studio:8080";
const { token } = request.nextauth;
const headers = { 'X-Forwarded-User': token?.email?.toLowerCase() };
console.log ({ pathname: request.nextUrl.pathname});
console.log({ pathname: request.nextUrl.pathname });
if (request.nextUrl.pathname.startsWith('/api/v1/configuration/account') ||
request.nextUrl.pathname.startsWith('/api/v1/restapiinfo') ||
request.nextUrl.pathname.startsWith('/api/v1/auth') ||
request.nextUrl.pathname.startsWith('/api/core') ||
request.nextUrl.pathname.startsWith('/api/dataconnections') ||
request.nextUrl.pathname.startsWith('/api/v1/multitenancy') ||
request.nextUrl.pathname.startsWith('/api/ism') ||
request.nextUrl.pathname.startsWith('/node_modules') ||
request.nextUrl.pathname.startsWith('/translations') || request.nextUrl.pathname.startsWith('/6867') || request.nextUrl.pathname.startsWith('/ui') || request.nextUrl.pathname.startsWith('/bootstrap')) {
const headers = {
'x-proxy-user': "admin",
'x-proxy-roles': "all_access",
// 'X-Forwarded-For': "link"
};
return rewriteURL(request, `${linkBaseURL}`, opensearchURL, headers);
}
else if (request.nextUrl.pathname.startsWith('/opensearch')) {
if (request.nextUrl.pathname.startsWith('/opensearch')) {
const headers = {
'x-proxy-user': "admin",
'x-proxy-roles': "all_access",
// 'X-Forwarded-For': "link"
};
return rewriteURL(request, `${linkBaseURL}/opensearch`, opensearchURL, headers);
}else if (request.nextUrl.pathname.startsWith('/metamigo')) {
} else if (request.nextUrl.pathname.startsWith('/metamigo')) {
return rewriteURL(request, `${linkBaseURL}/metamigo`, metamigoURL);
} else if (request.nextUrl.pathname.startsWith('/label-studio')) {
return rewriteURL(request, `${linkBaseURL}/label-studio`, labelStudioURL);

View file

@ -39,7 +39,8 @@
"sharp": "^0.33.2",
"swr": "^2.2.5",
"tss-react": "^4.9.4",
"twilio-client": "^1.15.1"
"twilio-client": "^1.15.1",
"ui": "*"
},
"devDependencies": {
"@babel/core": "^7.24.0",

View file

@ -0,0 +1,14 @@
import NextAuth from "next-auth"
import GoogleProvider from "next-auth/providers/google"
import { KyselyAdapter } from "@auth/kysely-adapter"
import { db } from "./database";
export const authOptions = NextAuth({
adapter: KyselyAdapter(db),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
}),
],
})

View file

@ -0,0 +1,62 @@
import { PostgresDialect } from "kysely";
import { Pool } from "pg";
import { KyselyAuth } from "@auth/kysely-adapter";
import { CamelCasePlugin } from "kysely";
import type { GeneratedAlways } from "kysely";
interface Database {
User: {
id: GeneratedAlways<string>;
name: string | null;
email: string;
emailVerified: Date | null;
image: string | null;
};
Account: {
id: GeneratedAlways<string>;
userId: string;
type: string;
provider: string;
providerAccountId: string;
refresh_token: string | null;
access_token: string | null;
expires_at: number | null;
token_type: string | null;
scope: string | null;
id_token: string | null;
session_state: string | null;
};
Session: {
id: GeneratedAlways<string>;
userId: string;
sessionToken: string;
expires: Date;
};
VerificationToken: {
identifier: string;
token: string;
expires: Date;
};
WhatsAppBot: {
id: GeneratedAlways<string>;
userId: string;
phone: string;
password: string;
};
}
export const db = new KyselyAuth<Database>({
dialect: new PostgresDialect({
pool: new Pool({
host: process.env.DATABASE_HOST,
database: process.env.DATABASE_NAME,
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
}),
}),
plugins: [new CamelCasePlugin()],
});

View file

@ -0,0 +1,6 @@
import NextAuth from "next-auth";
import { authOptions } from "@/app/_lib/authentication";
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };

View file

@ -1,7 +1,7 @@
"use client";
import { GridColDef } from "@mui/x-data-grid-pro";
import { List } from "@/app/_components/List";
import { List } from "ui";
export default function Page() {
const columns: GridColDef[] = [

View file

@ -1,7 +1,7 @@
"use client";
import { GridColDef } from "@mui/x-data-grid-pro";
import { List } from "@/app/_components/List";
import { List } from "ui";
export default function Page() {
const columns: GridColDef[] = [

View file

@ -1,7 +1,7 @@
"use client";
import { GridColDef } from "@mui/x-data-grid-pro";
import { List } from "@/app/_components/List";
import { List } from "ui";
export default function Page() {
const columns: GridColDef[] = [

View file

@ -1,7 +1,7 @@
"use client";
import { GridColDef } from "@mui/x-data-grid-pro";
import { List } from "@/app/_components/List";
import { List } from "ui";
export default function Page() {
const columns: GridColDef[] = [

View file

@ -1,7 +1,7 @@
"use client";
import { GridColDef } from "@mui/x-data-grid-pro";
import { List } from "@/app/_components/List";
import { List } from "ui";
export default function Page() {
const columns: GridColDef[] = [

View file

@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
transpilePackages: ["ui"]
};
export default nextConfig;

View file

@ -9,37 +9,40 @@
"lint": "next lint"
},
"dependencies": {
"@auth/kysely-adapter": "^0.6.0",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.4",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.168",
"@mui/material": "^5",
"@mui/material-nextjs": "^5.15.11",
"@mui/x-data-grid-pro": "^6.19.6",
"@mui/x-date-pickers-pro": "^6.19.7",
"date-fns": "^3.5.0",
"kysely": "^0.27.3",
"leafcutter-common": "*",
"kysely": "^0.26.1",
"material-ui-popup-state": "^5.0.10",
"mui-chips-input": "^2.1.4",
"next": "14.1.3",
"next-auth": "^4.24.7",
"pg": "^8.11.3",
"react": "18.2.0",
"react-cookie": "^7.1.0",
"react-digit-input": "^2.1.0",
"react-dom": "18.2.0",
"react-polyglot": "^0.7.2",
"react-qr-code": "^2.0.12",
"react-timer-hook": "^3.0.7",
"tss-react": "^4.9.4"
"tss-react": "^4.9.4",
"ui": "*"
},
"devDependencies": {
"@types/node": "^20",
"@types/pg": "^8.11.2",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.1.3",
"typescript": "^5"
"typescript": "^5",
"ts-config": "*"
}
}

View file

@ -6,7 +6,7 @@
"author": "Abel Luck <abel@guardianproject.info>",
"license": "AGPL-3.0-or-later",
"dependencies": {
"graphile-worker": "^0.13.0",
"graphile-worker": "^0.16.4",
"html-to-text": "^9.0.5",
"node-fetch": "^3",
"pg-promise": "^11.5.4",
@ -14,6 +14,7 @@
"twilio": "^5.0.1"
},
"devDependencies": {
"ts-config": "*",
"@babel/core": "7.24.0",
"@babel/preset-env": "7.24.0",
"@babel/preset-typescript": "7.23.3",