mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-04 18:29:21 +02:00
Configurable tab title and disable flag for keys
This commit is contained in:
@@ -76,6 +76,11 @@ export default async function KeysPage(props: KeysPageProps) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const env = pullEnv();
|
||||
if (env.flags.disableVirtualApiKeysUi) {
|
||||
redirect(`/${orgId}`);
|
||||
}
|
||||
|
||||
let keysData: ListMyVirtualApiKeysResponse | null = null;
|
||||
try {
|
||||
const res = await internal.get<
|
||||
@@ -90,7 +95,6 @@ export default async function KeysPage(props: KeysPageProps) {
|
||||
redirect(`/${orgId}`);
|
||||
}
|
||||
|
||||
const env = pullEnv();
|
||||
const primaryOrg = orgs.find((o) => o.orgId === orgId)?.isPrimaryOrg;
|
||||
const isAdminOrOwner = Boolean(overview?.isAdmin || overview?.isOwner);
|
||||
|
||||
@@ -106,6 +110,7 @@ export default async function KeysPage(props: KeysPageProps) {
|
||||
showSidebar={false}
|
||||
launcherMode
|
||||
showViewAsAdmin={isAdminOrOwner}
|
||||
env={env}
|
||||
>
|
||||
<UserVirtualApiKeys orgId={orgId} initialData={keysData} />
|
||||
</Layout>
|
||||
|
||||
@@ -83,6 +83,7 @@ export default async function OrgPage(props: OrgPageProps) {
|
||||
showSidebar={false}
|
||||
launcherMode
|
||||
showViewAsAdmin={isAdminOrOwner}
|
||||
env={env}
|
||||
>
|
||||
{overview && launcherData ? (
|
||||
<ResourceLauncher
|
||||
|
||||
@@ -30,9 +30,15 @@ import { normalizePostAuthPath } from "@server/lib/normalizePostAuthPath";
|
||||
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Resource Access"
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const env = pullEnv();
|
||||
const title =
|
||||
env.branding.resourceAuthPage?.titleText ||
|
||||
env.branding.appName ||
|
||||
"Resource Access";
|
||||
|
||||
return { title };
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
|
||||
+10
-6
@@ -53,17 +53,21 @@ export type OrgNavSectionsOptions = {
|
||||
};
|
||||
|
||||
// Merged from 'user-management-and-resources' branch
|
||||
export const orgLangingNavItems: SidebarNavItem[] = [
|
||||
export const orgLangingNavItems = (env?: Env): SidebarNavItem[] => [
|
||||
{
|
||||
title: "sidebarAccount",
|
||||
href: "/{orgId}",
|
||||
icon: <LayoutGrid className="size-4 flex-none" />
|
||||
},
|
||||
{
|
||||
title: "sidebarMyApiKeys",
|
||||
href: "/{orgId}/keys",
|
||||
icon: <KeyRound className="size-4 flex-none" />
|
||||
}
|
||||
...(!env?.flags.disableVirtualApiKeysUi
|
||||
? [
|
||||
{
|
||||
title: "sidebarMyApiKeys",
|
||||
href: "/{orgId}/keys",
|
||||
icon: <KeyRound className="size-4 flex-none" />
|
||||
}
|
||||
]
|
||||
: [])
|
||||
];
|
||||
|
||||
export const orgNavSections = (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { cn } from "@app/lib/cn";
|
||||
import { ListUserOrgsResponse } from "@server/routers/org";
|
||||
import { Env } from "@app/lib/types/env";
|
||||
import {
|
||||
orgLangingNavItems,
|
||||
type CommandBarNavSection,
|
||||
@@ -25,6 +26,7 @@ interface LayoutProps {
|
||||
defaultSidebarCollapsed?: boolean;
|
||||
launcherMode?: boolean;
|
||||
showViewAsAdmin?: boolean;
|
||||
env?: Env;
|
||||
}
|
||||
|
||||
export async function Layout({
|
||||
@@ -38,7 +40,8 @@ export async function Layout({
|
||||
showTopBar = true,
|
||||
defaultSidebarCollapsed = false,
|
||||
launcherMode = false,
|
||||
showViewAsAdmin = false
|
||||
showViewAsAdmin = false,
|
||||
env
|
||||
}: LayoutProps) {
|
||||
const allCookies = await cookies();
|
||||
const sidebarStateCookie = allCookies.get("pangolin-sidebar-state")?.value;
|
||||
@@ -49,7 +52,7 @@ export async function Layout({
|
||||
(sidebarStateCookie !== "expanded" && defaultSidebarCollapsed);
|
||||
|
||||
const launcherNavItems: SidebarNavItem[] = launcherMode
|
||||
? orgLangingNavItems
|
||||
? orgLangingNavItems(env)
|
||||
: [];
|
||||
|
||||
return (
|
||||
|
||||
@@ -70,6 +70,10 @@ export function pullEnv(): Env {
|
||||
: false,
|
||||
disableEnterpriseFeatures:
|
||||
process.env.DISABLE_ENTERPRISE_FEATURES === "true"
|
||||
? true
|
||||
: false,
|
||||
disableVirtualApiKeysUi:
|
||||
process.env.FLAGS_DISABLE_VIRTUAL_API_KEYS_UI === "true"
|
||||
? true
|
||||
: false
|
||||
},
|
||||
|
||||
@@ -36,6 +36,7 @@ export type Env = {
|
||||
usePangolinDns: boolean;
|
||||
disableProductHelpBanners: boolean;
|
||||
disableEnterpriseFeatures: boolean;
|
||||
disableVirtualApiKeysUi: boolean;
|
||||
};
|
||||
branding: {
|
||||
appName?: string;
|
||||
|
||||
Reference in New Issue
Block a user