Update Link->Leafcutter integration
This commit is contained in:
parent
baa1b32737
commit
495e8338b9
31 changed files with 239 additions and 343 deletions
|
|
@ -1,11 +1,10 @@
|
|||
import { GetServerSideProps, GetServerSidePropsContext } from "next";
|
||||
import { useTranslate } from "react-polyglot";
|
||||
import Head from "next/head";
|
||||
import Image from "next/image";
|
||||
import Image from "next/legacy/image";
|
||||
import Link from "next/link";
|
||||
import { Grid, Container, Box, Button } from "@mui/material";
|
||||
import { Layout } from "components/Layout";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
import { useAppContext } from "components/AppProvider";
|
||||
import { PageHeader } from "components/PageHeader";
|
||||
import { AboutFeature } from "components/AboutFeature";
|
||||
|
|
@ -166,7 +165,3 @@ const About = () => {
|
|||
};
|
||||
|
||||
export default About;
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => checkAuth(context);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { Box, Grid } from "@mui/material";
|
|||
import { useCookies } from "react-cookie";
|
||||
import { getTemplates } from "lib/opensearch";
|
||||
import { Layout } from "components/Layout";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
import { useAppContext } from "components/AppProvider";
|
||||
import { PageHeader } from "components/PageHeader";
|
||||
import { VisualizationBuilder } from "components/VisualizationBuilder";
|
||||
|
|
@ -75,13 +74,7 @@ export default Create;
|
|||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => {
|
||||
const res: any = await checkAuth(context);
|
||||
const templates = await getTemplates(100);
|
||||
|
||||
if (res.redirect) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res.props.templates = await getTemplates(100);
|
||||
|
||||
return res;
|
||||
return { props: { templates } };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import Head from "next/head";
|
||||
import { GetServerSideProps, GetServerSidePropsContext } from "next";
|
||||
import { useTranslate } from "react-polyglot";
|
||||
import { Box, Grid } from "@mui/material";
|
||||
import { Layout } from "components/Layout";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
import { PageHeader } from "components/PageHeader";
|
||||
import { Question } from "components/Question";
|
||||
import { useAppContext } from "components/AppProvider";
|
||||
|
|
@ -104,7 +102,3 @@ const FAQ = () => {
|
|||
};
|
||||
|
||||
export default FAQ;
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => checkAuth(context);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { useEffect } from "react";
|
||||
import { NextPage, GetServerSideProps, GetServerSidePropsContext } from "next";
|
||||
import { useRouter } from "next/router";
|
||||
import { getSession } from "next-auth/react";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
|
@ -8,7 +9,6 @@ import { Grid, Button } from "@mui/material";
|
|||
import { useTranslate } from "react-polyglot";
|
||||
import { useCookies } from "react-cookie";
|
||||
import { Layout } from "components/Layout";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
import { getUserVisualizations } from "lib/opensearch";
|
||||
import { Welcome } from "components/Welcome";
|
||||
import { WelcomeDialog } from "components/WelcomeDialog";
|
||||
|
|
@ -111,15 +111,10 @@ export default MyVisualizations;
|
|||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => {
|
||||
const res: any = await checkAuth(context);
|
||||
|
||||
if (res.redirect) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res.props.visualizations = await getUserVisualizations(
|
||||
res.props.session.user.email,
|
||||
const session = (await getSession(context)) ?? null;
|
||||
const visualizations = await getUserVisualizations(
|
||||
session?.user?.email ?? "none",
|
||||
20
|
||||
);
|
||||
return res;
|
||||
return { props: { visualizations } };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import Head from "next/head";
|
||||
import { NextPage } from "next";
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import Image from "next/legacy/image";
|
||||
import { Box, Grid, Container, IconButton } from "@mui/material";
|
||||
import { Apple as AppleIcon, Google as GoogleIcon } from "@mui/icons-material";
|
||||
import { useTranslate } from "react-polyglot";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { GetServerSideProps, GetServerSidePropsContext } from "next";
|
|||
// import { Client } from "@opensearch-project/opensearch";
|
||||
import { RawDataViewer } from "components/RawDataViewer";
|
||||
import { VisualizationDetail } from "components/VisualizationDetail";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
// import { createVisualization } from "lib/opensearch";
|
||||
|
||||
interface PreviewProps {
|
||||
|
|
@ -25,16 +24,12 @@ const Preview: FC<PreviewProps> = ({
|
|||
);
|
||||
|
||||
export default Preview;
|
||||
|
||||
/*
|
||||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => {
|
||||
const res: any = await checkAuth(context);
|
||||
|
||||
if (res.redirect) {
|
||||
return res;
|
||||
}
|
||||
/*
|
||||
|
||||
const {
|
||||
visualizationID,
|
||||
searchQuery,
|
||||
|
|
@ -104,6 +99,8 @@ export const getServerSideProps: GetServerSideProps = async (
|
|||
}));
|
||||
console.log({ data: res.props.data });
|
||||
console.log(res.props.data[0]);
|
||||
*/
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import Head from "next/head";
|
|||
import { Grid, Box } from "@mui/material";
|
||||
import { useTranslate } from "react-polyglot";
|
||||
import { Layout } from "components/Layout";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
import { getTrends } from "lib/opensearch";
|
||||
import { PageHeader } from "components/PageHeader";
|
||||
import { VisualizationCard } from "components/VisualizationCard";
|
||||
|
|
@ -81,12 +80,7 @@ export default Trends;
|
|||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => {
|
||||
const res: any = await checkAuth(context);
|
||||
if (res.redirect) {
|
||||
return res;
|
||||
}
|
||||
const visualizations = await getTrends(25);
|
||||
|
||||
res.props.visualizations = await getTrends(25);
|
||||
|
||||
return res;
|
||||
return { props: { visualizations } };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { Client } from "@opensearch-project/opensearch";
|
|||
import Head from "next/head";
|
||||
import { Layout } from "components/Layout";
|
||||
import { VisualizationDetail } from "components/VisualizationDetail";
|
||||
import { checkAuth } from "lib/checkAuth";
|
||||
|
||||
type VisualizationProps = {
|
||||
visualization: any;
|
||||
|
|
@ -24,12 +23,6 @@ export default Visualization;
|
|||
export const getServerSideProps: GetServerSideProps = async (
|
||||
context: GetServerSidePropsContext
|
||||
) => {
|
||||
const res: any = await checkAuth(context);
|
||||
|
||||
if (res.redirect) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const { visualizationID } = context.query;
|
||||
|
||||
const node = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
|
||||
|
|
@ -51,7 +44,7 @@ export const getServerSideProps: GetServerSideProps = async (
|
|||
(hit: any) => hit._id.split(":")[1] === visualizationID[0]
|
||||
);
|
||||
const hit = hits[0];
|
||||
res.props.visualization = {
|
||||
const visualization = {
|
||||
id: hit._id.split(":")[1],
|
||||
title: hit._source.visualization.title,
|
||||
description: hit._source.visualization.description,
|
||||
|
|
@ -60,5 +53,5 @@ export const getServerSideProps: GetServerSideProps = async (
|
|||
}?embed=true`,
|
||||
};
|
||||
|
||||
return res;
|
||||
return { props: { visualization } };
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue