diff --git a/web/src/app/app/layout.tsx b/web/src/app/app/layout.tsx index cdf2367a3..f7df92e04 100644 --- a/web/src/app/app/layout.tsx +++ b/web/src/app/app/layout.tsx @@ -7,7 +7,6 @@ import { ClientRedirect } from '../../components/ui/layouts/ClientRedirect'; import { LayoutClient } from './layoutClient'; import { prefetchGetMyUserInfo } from '@/api/buster_rest'; import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; -import path from 'path'; export const dynamic = 'force-dynamic'; diff --git a/web/src/app/embed/dashboards/[dashboardId]/page.tsx b/web/src/app/embed/dashboards/[dashboardId]/page.tsx new file mode 100644 index 000000000..f02ead15e --- /dev/null +++ b/web/src/app/embed/dashboards/[dashboardId]/page.tsx @@ -0,0 +1,7 @@ +export default function EmbedDashboardsPage({ + params: { dashboardId } +}: { + params: { dashboardId: string }; +}) { + return
EmbedDashboardsPage {dashboardId}
; +} diff --git a/web/src/app/embed/layout.tsx b/web/src/app/embed/layout.tsx new file mode 100644 index 000000000..8b87c5fac --- /dev/null +++ b/web/src/app/embed/layout.tsx @@ -0,0 +1,13 @@ +import { GlobalErrorComponent } from '@/components/features/errors/GlobalErrorComponent'; +import { BusterReactQueryProvider } from '@/context/BusterReactQuery/BusterReactQueryAndApi'; +import { BusterPosthogProvider } from '@/context/Posthog'; + +export default async function EmbedLayout({ children }: { children: React.ReactNode }) { + return ( + + + {children} + + + ); +} diff --git a/web/src/app/embed/metrics/[metricId]/page.tsx b/web/src/app/embed/metrics/[metricId]/page.tsx new file mode 100644 index 000000000..ec9a05741 --- /dev/null +++ b/web/src/app/embed/metrics/[metricId]/page.tsx @@ -0,0 +1,7 @@ +export default function EmbedMetricsPage({ + params: { metricId } +}: { + params: { metricId: string }; +}) { + return
EmbedMetricsPage {metricId}
; +} diff --git a/web/src/middleware.ts b/web/src/middleware.ts index 23349a1d6..c77cef29d 100644 --- a/web/src/middleware.ts +++ b/web/src/middleware.ts @@ -11,7 +11,8 @@ export async function middleware(request: NextRequest) { const performUserCheck = !isPublicPage(request); cspPolicyMiddleware(request); nextPathnameMiddleware(request, supabaseResponse); - if (performUserCheck && !user && !request.nextUrl.pathname.includes('/test/')) { + + if (performUserCheck && !user) { return NextResponse.redirect( new URL(createBusterRoute({ route: BusterRoutes.AUTH_LOGIN }), process.env.NEXT_PUBLIC_URL) ); diff --git a/web/src/middleware/publicPageMiddleware.ts b/web/src/middleware/publicPageMiddleware.ts index 899186f55..f18eb388e 100644 --- a/web/src/middleware/publicPageMiddleware.ts +++ b/web/src/middleware/publicPageMiddleware.ts @@ -1,4 +1,5 @@ import { BusterAuthRoutes } from '@/routes/busterRoutes/busterAuthRoutes'; +import { BusterEmbedRoutes } from '@/routes/busterRoutes/busterEmbedRoutes'; import { BusterRoutes, createPathnameToBusterRoute } from '@/routes/busterRoutes/busterRoutes'; import { NextRequest } from 'next/server'; @@ -13,6 +14,7 @@ const publicPages: BusterRoutes[] = [ BusterRoutes.APP_METRIC_ID, BusterRoutes.APP_DASHBOARD_ID, BusterRoutes.APP_DASHBOARD_METRICS_ID, + ...Object.values(BusterEmbedRoutes), ...Object.values(BusterAuthRoutes) ]; diff --git a/web/src/routes/busterRoutes/busterEmbedRoutes.ts b/web/src/routes/busterRoutes/busterEmbedRoutes.ts new file mode 100644 index 000000000..e307d27d3 --- /dev/null +++ b/web/src/routes/busterRoutes/busterEmbedRoutes.ts @@ -0,0 +1,15 @@ +export enum BusterEmbedRoutes { + EMBED_METRIC_ID = '/embed/metrics/:metricId', + EMBED_DASHBOARD_ID = '/embed/dashboards/:dashboardId' +} + +export type BusterEmbedRoutesWithArgs = { + [BusterEmbedRoutes.EMBED_METRIC_ID]: { + route: BusterEmbedRoutes.EMBED_METRIC_ID; + metricId: string; + }; + [BusterEmbedRoutes.EMBED_DASHBOARD_ID]: { + route: BusterEmbedRoutes.EMBED_DASHBOARD_ID; + dashboardId: string; + }; +}; diff --git a/web/src/routes/busterRoutes/busterRoutes.ts b/web/src/routes/busterRoutes/busterRoutes.ts index 5a5d8a32c..864660b04 100644 --- a/web/src/routes/busterRoutes/busterRoutes.ts +++ b/web/src/routes/busterRoutes/busterRoutes.ts @@ -1,5 +1,6 @@ import { BusterAppRoutes, BusterAppRoutesWithArgs } from './busterAppRoutes'; import { BusterAuthRoutes, BusterAuthRoutesWithArgs } from './busterAuthRoutes'; +import { BusterEmbedRoutes, BusterEmbedRoutesWithArgs } from './busterEmbedRoutes'; import { BusterSettingsRoutes, BusterSettingsRoutesWithArgs } from './busterSettingsRoutes'; export enum BusterRootRoutes { @@ -14,6 +15,7 @@ export const BusterRoutes = { ...BusterAppRoutes, ...BusterAuthRoutes, ...BusterSettingsRoutes, + ...BusterEmbedRoutes, ...BusterRootRoutes }; @@ -21,11 +23,13 @@ export type BusterRoutes = | BusterAppRoutes | BusterAuthRoutes | BusterSettingsRoutes + | BusterEmbedRoutes | BusterRootRoutes; export type BusterRoutesWithArgs = BusterRootRoutesWithArgs & BusterAuthRoutesWithArgs & BusterAppRoutesWithArgs & + BusterEmbedRoutesWithArgs & BusterSettingsRoutesWithArgs; export type BusterRoutesWithArgsRoute = BusterRoutesWithArgs[BusterRoutes];