Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions core/schemas/bifrost.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const (
FileRetrieveRequest RequestType = "file_retrieve"
FileDeleteRequest RequestType = "file_delete"
FileContentRequest RequestType = "file_content"
UnknownRequest RequestType = "unknown"
)

// BifrostContextKey is a type for context keys used in Bifrost.
Expand Down
84 changes: 42 additions & 42 deletions ui/app/clientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,52 @@ import { useEffect } from "react";
import { toast, Toaster } from "sonner";

function AppContent({ children }: { children: React.ReactNode }) {
const { data: bifrostConfig, error, isLoading } = useGetCoreConfigQuery({});
const { data: bifrostConfig, error, isLoading } = useGetCoreConfigQuery({});

useEffect(() => {
if (error) {
toast.error(getErrorMessage(error));
}
}, [error]);
useEffect(() => {
if (error) {
toast.error(getErrorMessage(error));
}
}, [error]);

return (
<WebSocketProvider>
<SidebarProvider>
<Sidebar />
<div className="dark:bg-card custom-scrollbar my-[1rem] h-[calc(100dvh-2rem)] w-full overflow-auto rounded-tl-md rounded-bl-md border border-gray-200 bg-white dark:border-zinc-800">
<main className="custom-scrollbar relative mx-auto flex flex-col overflow-y-hidden p-4">
{isLoading ? <FullPageLoader /> : <FullPage config={bifrostConfig}>{children}</FullPage>}
</main>
</div>
</SidebarProvider>
</WebSocketProvider>
);
return (
<WebSocketProvider>
<SidebarProvider>
<Sidebar />
<div className="dark:bg-card custom-scrollbar my-[1rem] h-[calc(100dvh-2rem)] w-full overflow-auto rounded-tl-md rounded-bl-md border border-gray-200 bg-white dark:border-zinc-800">
<main className="custom-scrollbar relative mx-auto flex flex-col overflow-y-hidden p-4">
{isLoading ? <FullPageLoader /> : <FullPage config={bifrostConfig}>{children}</FullPage>}
</main>
</div>
</SidebarProvider>
</WebSocketProvider>
);
}

function FullPage({config, children}: {config: BifrostConfig|undefined, children: React.ReactNode}) {
const pathname = usePathname();
if (config && config.is_db_connected) {
return children
}
if (config && config.is_logs_connected && pathname.startsWith("/workspace/logs")) {
return children;
}
return <NotAvailableBanner />
function FullPage({ config, children }: { config: BifrostConfig | undefined; children: React.ReactNode }) {
const pathname = usePathname();
if (config && config.is_db_connected) {
return children;
}
if (config && config.is_logs_connected && pathname.startsWith("/workspace/logs")) {
return children;
}
return <NotAvailableBanner />;
}

export function ClientLayout({ children }: { children: React.ReactNode }) {
return (
<ProgressProvider>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<Toaster />
<ReduxProvider>
<NuqsAdapter>
<RbacProvider>
<AppContent>{children}</AppContent>
</RbacProvider>
</NuqsAdapter>
</ReduxProvider>
</ThemeProvider>
</ProgressProvider>
);
}
return (
<ProgressProvider>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<Toaster />
<ReduxProvider>
<NuqsAdapter>
<RbacProvider>
<AppContent>{children}</AppContent>
</RbacProvider>
</NuqsAdapter>
</ReduxProvider>
</ThemeProvider>
</ProgressProvider>
);
}
13 changes: 5 additions & 8 deletions ui/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ import moment from "moment";
import { useTheme } from "next-themes";
import Image from "next/image";
import Link from "next/link";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { usePathname, useRouter } from "next/navigation";
import { useQueryState } from "nuqs";
import { useEffect, useMemo, useState } from "react";
import { ThemeToggle } from "./themeToggle";
import { Badge } from "./ui/badge";
Expand Down Expand Up @@ -160,7 +161,6 @@ const SidebarItemView = ({
onToggle,
pathname,
router,
searchParams,
}: {
item: SidebarItem;
isActive: boolean;
Expand All @@ -171,16 +171,15 @@ const SidebarItemView = ({
onToggle?: () => void;
pathname: string;
router: ReturnType<typeof useRouter>;
searchParams: ReturnType<typeof useSearchParams>;
}) => {
const hasSubItems = "subItems" in item && item.subItems && item.subItems.length > 0;
const currentTab = searchParams.get("tab");
const [currentConfigTab] = useQueryState("tab");
const isAnySubItemActive =
hasSubItems &&
item.subItems?.some((subItem) => {
// For query param based subitems, check if tab matches
if (subItem.queryParam) {
return pathname === subItem.url && currentTab === subItem.queryParam;
return pathname === subItem.url && currentConfigTab === subItem.queryParam;
}
// For path based subitems, check if pathname starts with url
return pathname.startsWith(subItem.url);
Expand Down Expand Up @@ -244,7 +243,7 @@ const SidebarItemView = ({
{item.subItems?.map((subItem: SidebarItem) => {
// For query param based subitems, check if tab matches
const isSubItemActive = subItem.queryParam
? pathname === subItem.url && currentTab === subItem.queryParam
? pathname === subItem.url && currentConfigTab === subItem.queryParam
: pathname.startsWith(subItem.url);
const SubItemIcon = subItem.icon;
return (
Expand Down Expand Up @@ -316,7 +315,6 @@ const compareVersions = (v1: string, v2: string): number => {
export default function AppSidebar() {
const pathname = usePathname();
const router = useRouter();
const searchParams = useSearchParams();
const [mounted, setMounted] = useState(false);
const [expandedItems, setExpandedItems] = useState<Set<string>>(new Set());
const [areCardsEmpty, setAreCardsEmpty] = useState(false);
Expand Down Expand Up @@ -737,7 +735,6 @@ export default function AppSidebar() {
onToggle={() => toggleItem(item.title)}
pathname={pathname}
router={router}
searchParams={searchParams}
/>
);
})}
Expand Down
4 changes: 2 additions & 2 deletions ui/components/ui/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const alertVariants = cva(
variants: {
variant: {
default: "bg-card text-card-foreground",
destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
destructive:
"border-red-200/30 bg-red-50/30 text-red-900 dark:border-red-800/30 dark:bg-red-950/30 dark:text-red-100 [&>svg]:text-red-600 dark:[&>svg]:text-red-400 *:data-[slot=alert-description]:text-red-700 dark:*:data-[slot=alert-description]:text-red-300",
info: "border-blue-200/30 bg-blue-50/30 text-blue-900 dark:border-blue-800/30 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-400 *:data-[slot=alert-description]:text-blue-700 dark:*:data-[slot=alert-description]:text-blue-300",
},
},
Expand Down Expand Up @@ -40,4 +41,3 @@ function AlertDescription({ className, ...props }: React.ComponentProps<"div">)
}

export { Alert, AlertDescription, AlertTitle };

Loading