Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0306efc
fix: nested route stlye
ogzhanolguncu Mar 24, 2025
0a63a80
chore: run fmt
ogzhanolguncu Mar 24, 2025
688cdb5
feat: organize and improve sidebar
ogzhanolguncu Mar 24, 2025
269987b
feat: add proper nesting
ogzhanolguncu Mar 24, 2025
b3e10eb
fix: loading issue
ogzhanolguncu Mar 24, 2025
e217396
fix: truncate issue
ogzhanolguncu Mar 24, 2025
0f638c8
feat: add static routes
ogzhanolguncu Mar 24, 2025
0889226
feat: add ratelimit to navbar
ogzhanolguncu Mar 24, 2025
ad4f0f4
fix: small ui issues
ogzhanolguncu Mar 24, 2025
c6a0ddf
Merge branch 'main' of github.com:unkeyed/unkey into add-new-nested-r…
ogzhanolguncu Mar 24, 2025
c72b399
chore: remove comments
ogzhanolguncu Mar 24, 2025
ae91abd
chore: fmt
ogzhanolguncu Mar 24, 2025
7edc851
fix: ui improvements
ogzhanolguncu Mar 25, 2025
ad31ef1
[autofix.ci] apply automated fixes
autofix-ci[bot] Mar 25, 2025
da88337
fix: show nested routes on parent click
ogzhanolguncu Mar 25, 2025
0f9c56b
fix: remove unused db query
ogzhanolguncu Mar 27, 2025
31903d7
Merge branch 'main' of https://github.com/unkeyed/unkey into add-new-…
chronark Mar 31, 2025
5371d13
Merge branch 'main' into add-new-nested-routes
chronark Apr 1, 2025
2d7239f
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 1, 2025
4e45de9
Merge branch 'main' into add-new-nested-routes
ogzhanolguncu Apr 7, 2025
cdf5b64
Merge branch 'main' into add-new-nested-routes
ogzhanolguncu Apr 7, 2025
5dc0af9
fix: type issue
ogzhanolguncu Apr 7, 2025
efabd52
fix: revalidation issue
ogzhanolguncu Apr 7, 2025
c6da336
fix: ui issues
ogzhanolguncu Apr 7, 2025
59d5c5f
fix: show loader only if that item has Icon
ogzhanolguncu Apr 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/dashboard/app/(app)/apis/_components/api-list-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Props = {
};

export const ApiListCard = ({ api }: Props) => {
const { timeseries, isLoading, isError } = useFetchVerificationTimeseries(api.keyspaceId);
const { timeseries, isError } = useFetchVerificationTimeseries(api.keyspaceId);

const passed = timeseries?.reduce((acc, crr) => acc + crr.success, 0) ?? 0;
const blocked = timeseries?.reduce((acc, crr) => acc + crr.error, 0) ?? 0;
Expand All @@ -26,7 +26,8 @@ export const ApiListCard = ({ api }: Props) => {
chart={
<StatsTimeseriesBarChart
data={timeseries}
isLoading={isLoading}
// INFO: Causing too much lag when there are too many Charts. We'll try to optimize this in the future.
isLoading={false}
isError={isError}
config={{
success: {
Expand Down
43 changes: 42 additions & 1 deletion apps/dashboard/app/(app)/apis/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export async function fetchApiOverview({
.where(and(eq(schema.apis.workspaceId, workspaceId), isNull(schema.apis.deletedAtM)));
const total = Number(totalResult[0]?.count || 0);

// Updated query to include keyAuth and fetch actual keys
const query = db.query.apis.findMany({
where: (table, { and, eq, isNull, gt }) => {
const conditions = [eq(table.workspaceId, workspaceId), isNull(table.deletedAtM)];
Expand All @@ -30,8 +31,23 @@ export async function fetchApiOverview({
with: {
keyAuth: {
columns: {
id: true, // Include the keyspace ID
sizeApprox: true,
},
with: {
keys: {
Comment thread
ogzhanolguncu marked this conversation as resolved.
Outdated
limit: 10,
columns: {
id: true,
name: true,
createdAtM: true,
},
where: (keysTable, { isNull }) => {
return isNull(keysTable.deletedAtM);
},
orderBy: (keysTable, { desc }) => [desc(keysTable.createdAtM)],
},
},
},
},
orderBy: (table, { asc }) => [asc(table.id)],
Expand All @@ -44,7 +60,32 @@ export async function fetchApiOverview({
const nextCursor =
hasMore && apiItems.length > 0 ? { id: apiItems[apiItems.length - 1].id } : undefined;

const apiList = await apiItemsWithApproxKeyCounts(apiItems);
// Transform the data to include key information
const apiList = await Promise.all(
apiItems.map(async (api) => {
const keyspaceId = api.keyAuth?.id || null;

// Transform the keys data for the new keyDetails field
const keyDetails =
api.keyAuth?.keys?.map((key) => ({
id: key.id,
name: key.name,
})) || [];

return {
id: api.id,
name: api.name,
keyspaceId,
keyDetails,
// Include count for backward compatibility
keys: [
{
count: api.keyAuth?.sizeApprox || 0,
},
],
};
}),
);

return {
apiList,
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppSidebar } from "@/components/app-sidebar";
import { AppSidebar } from "@/components/navigation/sidebar/app-sidebar";
import { SidebarMobile } from "@/components/navigation/sidebar/sidebar-mobile";
import { SidebarProvider } from "@/components/ui/sidebar";
import { getTenantId } from "@/lib/auth";
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/(app)/settings/root-keys/new/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const Client: React.FC<Props> = ({ apis }) => {
}
}}
>
<DialogContent className="flex flex-col max-sm:w-full bg-grayA-1 border-gray-4">
<DialogContent className="flex flex-col max-sm:w-full dark:bg-grayA-1 border-gray-4 bg-white">
<DialogHeader>
<DialogTitle>Your API Key</DialogTitle>
<DialogDescription className="w-fit text-accent-10">
Expand Down
Loading