-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/unkeyed/unkey into eng-1292…
…-blog-json-syntax-highlighting-doesnt-work
- Loading branch information
Showing
16 changed files
with
426 additions
and
35 deletions.
There are no files selected for viewing
22 changes: 12 additions & 10 deletions
22
.github/workflows/lint.yaml → .github/workflows/autofix.ci.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
apps/dashboard/app/(app)/@breadcrumb/authorization/[...path]/page.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
apps/dashboard/app/(app)/@breadcrumb/authorization/permissions/[permissionId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton"; | ||
import { getTenantId } from "@/lib/auth"; | ||
import { db } from "@/lib/db"; | ||
import { unstable_cache as cache } from "next/cache"; | ||
import { Suspense } from "react"; | ||
export const dynamic = "force-dynamic"; | ||
export const runtime = "edge"; | ||
|
||
type PageProps = { | ||
params: { permissionId: string }; | ||
}; | ||
|
||
async function AsyncPageBreadcrumb(props: PageProps) { | ||
const getPermissionById = cache(async (permissionId: string) => | ||
db.query.permissions.findFirst({ | ||
where: (table, { eq }) => eq(table.id, permissionId), | ||
}), | ||
); | ||
|
||
const permissions = await getPermissionById(props.params.permissionId); | ||
if (!permissions) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href="/authorization">Authorization</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href="/authorization/permissions">Permissions</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>{permissions.name}</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
} | ||
|
||
export default function PageBreadcrumb(props: PageProps) { | ||
return ( | ||
<Suspense fallback={<BreadcrumbSkeleton levels={2} />}> | ||
<AsyncPageBreadcrumb {...props} /> | ||
</Suspense> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
apps/dashboard/app/(app)/@breadcrumb/authorization/permissions/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
export default function PageBreadcrumb() { | ||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>Authorization</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>Permissions</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
} |
60 changes: 60 additions & 0 deletions
60
apps/dashboard/app/(app)/@breadcrumb/authorization/roles/[roleId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton"; | ||
import { getTenantId } from "@/lib/auth"; | ||
import { db } from "@/lib/db"; | ||
import { unstable_cache as cache } from "next/cache"; | ||
import { Suspense } from "react"; | ||
export const dynamic = "force-dynamic"; | ||
export const runtime = "edge"; | ||
|
||
type PageProps = { | ||
params: { roleId: string }; | ||
}; | ||
|
||
async function AsyncPageBreadcrumb(props: PageProps) { | ||
const getWorkspaceByRoleId = cache( | ||
async (roleId: string) => | ||
await db.query.roles.findFirst({ | ||
where: (table, { eq }) => eq(table.id, roleId), | ||
}), | ||
); | ||
|
||
const role = await getWorkspaceByRoleId(props.params.roleId); | ||
if (!role) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href="/authorization">Authorization</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href="/authorization/roles">Roles</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>{role.name}</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
} | ||
|
||
export default function PageBreadcrumb(props: PageProps) { | ||
return ( | ||
<Suspense fallback={<BreadcrumbSkeleton levels={2} />}> | ||
<AsyncPageBreadcrumb {...props} /> | ||
</Suspense> | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
apps/dashboard/app/(app)/@breadcrumb/authorization/roles/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
export default function PageBreadcrumb() { | ||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>Authorization</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>Roles</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
} |
4 changes: 0 additions & 4 deletions
4
apps/dashboard/app/(app)/@breadcrumb/ratelimits/[...path]/page.tsx
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
apps/dashboard/app/(app)/@breadcrumb/ratelimits/[namespaceId]/logs/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton"; | ||
import { db } from "@/lib/db"; | ||
import { unstable_cache as cache } from "next/cache"; | ||
import { Suspense } from "react"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
export const runtime = "edge"; | ||
|
||
type PageProps = { | ||
params: { namespaceId: string }; | ||
}; | ||
|
||
async function AsyncPageBreadcrumb(props: PageProps) { | ||
const getNamespaceById = cache(async (namespaceId: string) => | ||
db.query.ratelimitNamespaces.findFirst({ | ||
where: (table, { eq, and, isNull }) => | ||
and(eq(table.id, namespaceId), isNull(table.deletedAt)), | ||
}), | ||
); | ||
|
||
const namespace = await getNamespaceById(props.params.namespaceId); | ||
if (!namespace) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href="/ratelimits">Ratelimits</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href={`/ratelimits/${props.params.namespaceId}`}> | ||
{namespace.name} | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>Logs</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
} | ||
|
||
export default function PageBreadcrumb(props: PageProps) { | ||
return ( | ||
<Suspense fallback={<BreadcrumbSkeleton levels={3} />}> | ||
<AsyncPageBreadcrumb {...props} /> | ||
</Suspense> | ||
); | ||
} |
62 changes: 62 additions & 0 deletions
62
apps/dashboard/app/(app)/@breadcrumb/ratelimits/[namespaceId]/overrides/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton"; | ||
import { db } from "@/lib/db"; | ||
import { unstable_cache as cache } from "next/cache"; | ||
import { Suspense } from "react"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
export const runtime = "edge"; | ||
|
||
type PageProps = { | ||
params: { namespaceId: string }; | ||
}; | ||
|
||
async function AsyncPageBreadcrumb(props: PageProps) { | ||
const getNamespaceById = cache(async (namespaceId: string) => | ||
db.query.ratelimitNamespaces.findFirst({ | ||
where: (table, { eq, and, isNull }) => | ||
and(eq(table.id, namespaceId), isNull(table.deletedAt)), | ||
}), | ||
); | ||
|
||
const namespace = await getNamespaceById(props.params.namespaceId); | ||
if (!namespace) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href="/ratelimits">Ratelimits</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink href={`/ratelimits/${props.params.namespaceId}`}> | ||
{namespace.name} | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage>Overrides</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
} | ||
|
||
export default function PageBreadcrumb(props: PageProps) { | ||
return ( | ||
<Suspense fallback={<BreadcrumbSkeleton levels={3} />}> | ||
<AsyncPageBreadcrumb {...props} /> | ||
</Suspense> | ||
); | ||
} |
Oops, something went wrong.