Opensearch embed changes

This commit is contained in:
Darren Clarke 2024-11-28 08:27:20 +01:00
parent 130554d86b
commit a8dd53507d
11 changed files with 237 additions and 178 deletions

View file

@ -1,9 +1,10 @@
import { Metadata } from "next";
import { redirect } from "next/navigation";
import { getServerSession } from "app/_lib/authentication";
import { Home } from "@link-stack/leafcutter-ui";
import { getUserVisualizations } from "@link-stack/opensearch-common";
import { LeafcutterWrapper } from "@link-stack/leafcutter-ui";
import { Home } from "./_components/Home";
// import { getServerSession } from "app/_lib/authentication";
// import { Home } from "@link-stack/leafcutter-ui";
// import { getUserVisualizations } from "@link-stack/opensearch-common";
// import { LeafcutterWrapper } from "@link-stack/leafcutter-ui";
export const metadata: Metadata = {
title: "CDR Link - Home",
@ -11,21 +12,31 @@ export const metadata: Metadata = {
export default async function Page() {
const leafcutterEnabled = process.env.LEAFCUTTER_ENABLED === "true";
const dashboardURL = process.env.LEAFCUTTER_DEFAULT_DASHBOARD_URL;
if (!leafcutterEnabled) {
redirect("/overview/recent");
}
/*
const session = await getServerSession();
const {
user: { email },
}: any = session;
const visualizations = await getUserVisualizations(email ?? "none", 20);
*/
let visualizations = [];
/*
try {
visualizations = await getUserVisualizations(email ?? "none", 20);
} catch (e) {
console.error(e.meta);
}
return (
<LeafcutterWrapper>
<Home visualizations={visualizations} showWelcome={false} />
</LeafcutterWrapper>
);
*/
return <Home url={dashboardURL} />;
}