mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-01 00:06:38 +00:00
🚧 create blueprint page
This commit is contained in:
9
src/app/[orgId]/settings/blueprints/create/page.tsx
Normal file
9
src/app/[orgId]/settings/blueprints/create/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import type { Metadata } from "next";
|
||||||
|
|
||||||
|
export interface CreateBlueprintPageProps {
|
||||||
|
params: Promise<{ orgId: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function CreateBlueprintPage(props: CreateBlueprintPageProps) {
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import BlueprintsTable, { type BlueprintRow } from "@app/components/BlueprintsTable";
|
import BlueprintsTable, {
|
||||||
|
type BlueprintRow
|
||||||
|
} from "@app/components/BlueprintsTable";
|
||||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
import { internal } from "@app/lib/api";
|
import { internal } from "@app/lib/api";
|
||||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
@@ -6,35 +8,35 @@ import OrgProvider from "@app/providers/OrgProvider";
|
|||||||
import { ListBlueprintsResponse } from "@server/routers/blueprints";
|
import { ListBlueprintsResponse } from "@server/routers/blueprints";
|
||||||
import { GetOrgResponse } from "@server/routers/org";
|
import { GetOrgResponse } from "@server/routers/org";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
|
import { Metadata } from "next";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { cache } from "react";
|
import { cache } from "react";
|
||||||
|
|
||||||
|
|
||||||
type BluePrintsPageProps = {
|
type BluePrintsPageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
searchParams: Promise<{ view?: string }>;
|
searchParams: Promise<{ view?: string }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "Blueprint"
|
||||||
|
};
|
||||||
|
|
||||||
export default async function BluePrintsPage(props: BluePrintsPageProps) {
|
export default async function BluePrintsPage(props: BluePrintsPageProps) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
|
|
||||||
let blueprints: BlueprintRow[] = [];
|
let blueprints: BlueprintRow[] = [];
|
||||||
try {
|
try {
|
||||||
const res = await internal.get<
|
const res = await internal.get<AxiosResponse<ListBlueprintsResponse>>(
|
||||||
AxiosResponse<ListBlueprintsResponse>
|
`/org/${params.orgId}/blueprints`,
|
||||||
>(`/org/${params.orgId}/blueprints`, await authCookieHeader());
|
await authCookieHeader()
|
||||||
|
);
|
||||||
|
|
||||||
blueprints = res.data.data.blueprints
|
blueprints = res.data.data.blueprints;
|
||||||
console.log({
|
|
||||||
...res.data.data
|
|
||||||
})
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let org = null;
|
let org = null;
|
||||||
try {
|
try {
|
||||||
const getOrg = cache(async () =>
|
const getOrg = cache(async () =>
|
||||||
@@ -49,21 +51,15 @@ export default async function BluePrintsPage(props: BluePrintsPageProps) {
|
|||||||
redirect(`/${params.orgId}`);
|
redirect(`/${params.orgId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!org) {
|
|
||||||
}
|
|
||||||
|
|
||||||
const t = await getTranslations();
|
const t = await getTranslations();
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<OrgProvider org={org}>
|
||||||
<OrgProvider org={org}>
|
<SettingsSectionTitle
|
||||||
<SettingsSectionTitle
|
title={t("blueprints")}
|
||||||
title={t("blueprints")}
|
description={t("blueprintsDescription")}
|
||||||
description={t("blueprintsDescription")}
|
/>
|
||||||
/>
|
<BlueprintsTable blueprints={blueprints} orgId={params.orgId} />
|
||||||
<BlueprintsTable blueprints={blueprints} orgId={params.orgId} />
|
</OrgProvider>
|
||||||
</OrgProvider>
|
);
|
||||||
</>
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,25 +1,15 @@
|
|||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
import {
|
|
||||||
Combine,
|
|
||||||
KeyRound,
|
|
||||||
LinkIcon,
|
|
||||||
Settings,
|
|
||||||
Users,
|
|
||||||
Waypoints,
|
|
||||||
Workflow
|
|
||||||
} from "lucide-react";
|
|
||||||
import { verifySession } from "@app/lib/auth/verifySession";
|
import { verifySession } from "@app/lib/auth/verifySession";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { internal } from "@app/lib/api";
|
import { internal } from "@app/lib/api";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { ListOrgsResponse } from "@server/routers/org";
|
import { ListUserOrgsResponse } from "@server/routers/org";
|
||||||
import { GetOrgResponse, ListUserOrgsResponse } from "@server/routers/org";
|
|
||||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
import { cache } from "react";
|
import { cache } from "react";
|
||||||
import { GetOrgUserResponse } from "@server/routers/user";
|
import { GetOrgUserResponse } from "@server/routers/user";
|
||||||
import UserProvider from "@app/providers/UserProvider";
|
import UserProvider from "@app/providers/UserProvider";
|
||||||
import { Layout } from "@app/components/Layout";
|
import { Layout } from "@app/components/Layout";
|
||||||
import { SidebarNavItem, SidebarNavProps } from "@app/components/SidebarNav";
|
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { pullEnv } from "@app/lib/pullEnv";
|
import { pullEnv } from "@app/lib/pullEnv";
|
||||||
import { orgNavSections } from "@app/app/navigation";
|
import { orgNavSections } from "@app/app/navigation";
|
||||||
@@ -27,7 +17,10 @@ import { orgNavSections } from "@app/app/navigation";
|
|||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `Settings - ${process.env.BRANDING_APP_NAME || "Pangolin"}`,
|
title: {
|
||||||
|
template: `%s - ${process.env.BRANDING_APP_NAME || "Pangolin"}`,
|
||||||
|
default: `Settings - ${process.env.BRANDING_APP_NAME || "Pangolin"}`
|
||||||
|
},
|
||||||
description: ""
|
description: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,7 +79,11 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<UserProvider user={user}>
|
<UserProvider user={user}>
|
||||||
<Layout orgId={params.orgId} orgs={orgs} navItems={orgNavSections(env.flags.enableClients)}>
|
<Layout
|
||||||
|
orgId={params.orgId}
|
||||||
|
orgs={orgs}
|
||||||
|
navItems={orgNavSections(env.flags.enableClients)}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</Layout>
|
</Layout>
|
||||||
</UserProvider>
|
</UserProvider>
|
||||||
|
|||||||
Reference in New Issue
Block a user