🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(dashboard): include dashboards in cmdk menu (#6889)
Steffen Schmitza11e7ddfee1f
diff --git a/web/src/features/command-k-menu/CommandMenu.tsx b/web/src/features/command-k-menu/CommandMenu.tsxindex d7d5ac743d..6152f4c09f 100644--- a/web/src/features/command-k-menu/CommandMenu.tsx+++ b/web/src/features/command-k-menu/CommandMenu.tsx@@ -18,6 +18,7 @@ import { useCommandMenu } from "@/src/features/command-k-menu/CommandMenuProvideimport { useProjectSettingsPages } from "@/src/pages/project/[projectId]/settings";import { useOrganizationSettingsPages } from "@/src/pages/organization/[organizationId]/settings";import { useQueryProjectOrOrganization } from "@/src/features/projects/hooks";+import { api } from "@/src/utils/api";export function CommandMenu({mainNavigation,@@ -81,6 +82,32 @@ export function CommandMenu({!item.url.includes("["), // no dynamic routes without inserted values);+ const dashboardsQuery = api.dashboard.allDashboards.useQuery(+ {+ projectId: project?.id ?? "",+ orderBy: {+ column: "updatedAt",+ order: "DESC",+ },+ limit: 100,+ },+ {+ enabled: open && Boolean(project?.id),+ },+ );++ const dashboardItems =+ dashboardsQuery.data?.dashboards.map((d) => ({+ title: `Dashboard > ${d.name}`,+ url: `/project/${project?.id}/dashboards/${d.id}`,+ keywords: [+ "dashboard",+ d.name.toLowerCase(),+ (d.description ?? "").toLowerCase(),+ ],+ active: router.query.dashboardId === d.id,+ })) ?? [];+useEffect(() => {const down = (e: KeyboardEvent) => {if (e.key === "k" && (e.metaKey || e.ctrlKey)) {@@ -164,6 +191,32 @@ export function CommandMenu({</CommandGroup></>)}+ {dashboardItems.length > 0 && (+ <>+ <CommandSeparator />+ <CommandGroup heading="Dashboards">+ {dashboardItems.map((item) => (+ <CommandItem+ key={item.url}+ value={item.title}+ keywords={item.keywords}+ disabled={item.active}+ onSelect={() => {+ router.push(item.url);+ capture("cmd_k_menu:navigated", {+ type: "dashboard",+ title: item.title,+ url: item.url,+ });+ setOpen(false);+ }}+ >+ {item.title}+ </CommandItem>+ ))}+ </CommandGroup>+ </>+ )}{projectSettingsItems.length > 0 && (<><CommandSeparator />