Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Combine "Variables" & "Data Sources" panels into "Variables & Data Sources" panel (#7459)

Trevor Manzf8e5ec97b81b
diff --git a/frontend/src/components/editor/chrome/panels/error-panel.tsx b/frontend/src/components/editor/chrome/panels/error-panel.tsx
index 4bbdb4cb40..e4058332fb 100644
--- a/frontend/src/components/editor/chrome/panels/error-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/error-panel.tsx
@@ -15,7 +15,7 @@ const ErrorsPanel: React.FC = () => {
}
return (
- <div className="flex flex-col overflow-auto">
+ <div className="flex flex-col h-full overflow-auto">
{errors.map((error) => (
<div key={error.cellId}>
<div className="text-xs font-mono font-semibold bg-muted border-y px-2 py-1">
diff --git a/frontend/src/components/editor/chrome/panels/logs-panel.tsx b/frontend/src/components/editor/chrome/panels/logs-panel.tsx
index 915962d1e3..460ea0f65a 100644
--- a/frontend/src/components/editor/chrome/panels/logs-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/logs-panel.tsx
@@ -36,7 +36,7 @@ const LogsPanel: React.FC = () => {
return (
<>
- <div className="flex flex-row justify-end px-2 py-1">
+ <div className="flex flex-row justify-start px-2 py-1">
<ClearButton dataTestId="clear-logs-button" onClick={clearLogs} />
</div>
<div className="overflow-auto flex-1">
diff --git a/frontend/src/components/editor/chrome/panels/secrets-panel.tsx b/frontend/src/components/editor/chrome/panels/secrets-panel.tsx
index 546ddc94e5..cd2c63e197 100644
--- a/frontend/src/components/editor/chrome/panels/secrets-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/secrets-panel.tsx
@@ -2,6 +2,7 @@
import { CheckIcon, CopyIcon, KeyIcon, PlusIcon } from "lucide-react";
import React from "react";
+import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
import { Spinner } from "@/components/icons/spinner";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
import { Badge } from "@/components/ui/badge";
@@ -59,69 +60,77 @@ const SecretsPanel: React.FC = () => {
}
return (
- <div className="flex flex-col h-full">
- <div className="flex justify-end h-8 border-b">
- <button
- type="button"
- className="float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground"
- onClick={() =>
- openModal(
- <WriteSecretModal
- providerNames={providerNames}
- onSuccess={() => {
- refetch();
- closeModal();
- }}
- onClose={closeModal}
- />,
- )
- }
- >
- <PlusIcon className="h-4 w-4" />
- </button>
- </div>
- <Table className="overflow-auto flex-1 mb-16">
- <TableHeader>
- <TableRow>
- <TableHead>Environment Variable</TableHead>
- <TableHead>Source</TableHead>
- <TableHead />
- </TableRow>
- </TableHeader>
- <TableBody>
- {secretKeyProviders.map((provider) => {
- return provider.keys.map((key) => (
- <TableRow key={`${provider.name}-${key}`} className="group">
- <TableCell>{key}</TableCell>
- <TableCell>
- {provider.provider !== "env" && (
- <Badge variant="outline" className="select-none">
- {provider.name}
- </Badge>
- )}
- </TableCell>
- <TableCell>
- <CopyButton
- ariaLabel={`Copy ${key}`}
- onCopy={async () => {
- await copyToClipboard(`os.environ["${key}"]`);
- toast({
- title: "Copied to clipboard",
- description: `os.environ["${key}"] has been copied to your clipboard.`,
- });
+ <PanelGroup direction="horizontal" className="h-full">
+ <Panel defaultSize={50} minSize={30} maxSize={80}>
+ <div className="flex flex-col h-full">
+ <div className="flex justify-start h-8 border-b">
+ <button
+ type="button"
+ className="border-r px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground"
+ onClick={() =>
+ openModal(
+ <WriteSecretModal
+ providerNames={providerNames}
+ onSuccess={() => {
+ refetch();
+ closeModal();
}}
- className={cn(
- "float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground",
- "invisible group-hover:visible",
- )}
- />
- </TableCell>
+ onClose={closeModal}
+ />,
+ )
+ }
+ >
+ <PlusIcon className="h-4 w-4" />
+ </button>
+ </div>
+ <Table className="overflow-auto flex-1 mb-16">
+ <TableHeader>
+ <TableRow>
+ <TableHead>Environment Variable</TableHead>
+ <TableHead>Source</TableHead>
+ <TableHead />
</TableRow>
- ));
- })}
- </TableBody>
- </Table>
- </div>
+ </TableHeader>
+ <TableBody>
+ {secretKeyProviders.map((provider) => {
+ return provider.keys.map((key) => (
+ <TableRow key={`${provider.name}-${key}`} className="group">
+ <TableCell>{key}</TableCell>
+ <TableCell>
+ {provider.provider !== "env" && (
+ <Badge variant="outline" className="select-none">
+ {provider.name}
+ </Badge>
+ )}
+ </TableCell>
+ <TableCell>
+ <CopyButton
+ ariaLabel={`Copy ${key}`}
+ onCopy={async () => {
+ await copyToClipboard(`os.environ["${key}"]`);
+ toast({
+ title: "Copied to clipboard",
+ description: `os.environ["${key}"] has been copied to your clipboard.`,
+ });
+ }}
+ className={cn(
+ "float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground",
+ "invisible group-hover:visible",
+ )}
+ />
+ </TableCell>
+ </TableRow>
+ ));
+ })}
+ </TableBody>
+ </Table>
+ </div>
+ </Panel>
+ <PanelResizeHandle className="w-1 bg-border hover:bg-primary/50 transition-colors" />
+ <Panel defaultSize={50}>
+ <div />
+ </Panel>
+ </PanelGroup>
);
};
diff --git a/frontend/src/components/editor/chrome/panels/session-panel.tsx b/frontend/src/components/editor/chrome/panels/session-panel.tsx
new file mode 100644
index 0000000000..b71007fbd4
--- /dev/null
+++ b/frontend/src/components/editor/chrome/panels/session-panel.tsx
@@ -0,0 +1,84 @@
+/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtom } from "jotai";
+import { atomWithStorage } from "jotai/utils";
+import { DatabaseIcon, VariableIcon } from "lucide-react";
+import React from "react";
+import { DataSources } from "@/components/datasources/datasources";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/ui/accordion";
+import { Badge } from "@/components/ui/badge";
+import { VariableTable } from "@/components/variables/variables-table";
+import { useCellIds } from "@/core/cells/cells";
+import { useDatasets } from "@/core/datasets/state";
+import { useVariables } from "@/core/variables/state";
+import { jotaiJsonStorage } from "@/utils/storage/jotai";
+
+const openSectionsAtom = atomWithStorage<string[]>(
+ "marimo:session-panel:open-sections",
+ ["variables"],
+ jotaiJsonStorage,
+);
+
+const SessionPanel: React.FC = () => {
+ const variables = useVariables();
+ const cellIds = useCellIds();
+ const datasets = useDatasets();
+ const [openSections, setOpenSections] = useAtom(openSectionsAtom);
+
+ const datasourcesCount = datasets.tables.length;
+ const isDatasourcesOpen = openSections.includes("datasources");
+
+ return (
+ <Accordion
+ type="multiple"
+ value={openSections}
+ onValueChange={setOpenSections}
+ className="flex flex-col h-full overflow-auto"
+ >
+ <AccordionItem value="datasources" className="border-b">
+ <AccordionTrigger className="px-3 py-2 text-xs font-semibold uppercase tracking-wide hover:no-underline">
+ <span className="flex items-center gap-2">
+ <DatabaseIcon className="w-4 h-4" />
+ Data sources
+ {!isDatasourcesOpen && datasourcesCount > 0 && (
+ <Badge
+ variant="secondary"
+ className="ml-1 px-1.5 py-0 text-[10px]"
+ >
+ {datasourcesCount}
+ </Badge>
+ )}
+ </span>
+ </AccordionTrigger>
+ <AccordionContent wrapperClassName="p-0">
+ <DataSources />
+ </AccordionContent>
+ </AccordionItem>
+
+ <AccordionItem value="variables" className="border-b-0">
+ <AccordionTrigger className="px-3 py-2 text-xs font-semibold uppercase tracking-wide hover:no-underline">
+ <span className="flex items-center gap-2">
+ <VariableIcon className="w-4 h-4" />
+ Variables
+ </span>
+ </AccordionTrigger>
+ <AccordionContent wrapperClassName="p-0">
+ {Object.keys(variables).length === 0 ? (
+ <div className="px-3 py-4 text-sm text-muted-foreground">
+ No variables defined
+ </div>
+ ) : (
+ <VariableTable cellIds={cellIds.inOrderIds} variables={variables} />
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+ );
+};
+
+export default SessionPanel;
diff --git a/frontend/src/components/editor/chrome/types.ts b/frontend/src/components/editor/chrome/types.ts
index a7659509da..c5f3aedbff 100644
--- a/frontend/src/components/editor/chrome/types.ts
+++ b/frontend/src/components/editor/chrome/types.ts
@@ -4,11 +4,9 @@ import {
ActivityIcon,
BotIcon,
BoxIcon,
- DatabaseIcon,
DatabaseZapIcon,
FileTextIcon,
FolderTreeIcon,
- FunctionSquareIcon,
KeyRoundIcon,
type LucideIcon,
NetworkIcon,
@@ -17,6 +15,7 @@ import {
SquareDashedBottomCodeIcon,
TerminalSquareIcon,
TextSearchIcon,
+ VariableIcon,
XCircleIcon,
} from "lucide-react";
import { getFeatureFlag } from "@/core/config/feature-flag";
@@ -30,7 +29,6 @@ export type PanelType =
| "packages"
| "documentation"
| "snippets"
- | "datasources"
| "ai"
| "cache";
@@ -67,14 +65,8 @@ export const PANELS: PanelDescriptor[] = [
// what that data is.
{
id: "variables",
- Icon: FunctionSquareIcon,
- tooltip: "Explore variables",
- position: "sidebar",
- },
- {
- id: "datasources",
- Icon: DatabaseIcon,
- tooltip: "Explore data sources",
+ Icon: VariableIcon,
+ tooltip: "Explore variables and data sources",
position: "sidebar",
},
// Every notebook has a package environment that must
diff --git a/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
index 8360e102fe..92b6ba0d77 100644
--- a/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
@@ -10,10 +10,12 @@ import { Footer } from "./footer";
import { Sidebar } from "./sidebar";
import "./app-chrome.css";
import { TooltipProvider } from "@radix-ui/react-tooltip";
+import { useAtomValue } from "jotai";
import { XIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { LazyMount } from "@/components/utils/lazy-mount";
+import { cellErrorCount } from "@/core/cells/cells";
import { getFeatureFlag } from "@/core/config/feature-flag";
import { IfCapability } from "@/core/config/if-capability";
import { cn } from "@/utils/cn";
@@ -21,6 +23,7 @@ import { ErrorBoundary } from "../../boundary/ErrorBoundary";
import { ContextAwarePanel } from "../panels/context-aware-panel/context-aware-panel";
import { useChromeActions, useChromeState } from "../state";
import { DEVELOPER_PANEL_TABS } from "../types";
+import { BackendConnectionStatus } from "./footer-items/backend-status";
import { Minimap } from "./minimap";
import { PanelsWrapper } from "./panels";
import { PendingAICells } from "./pending-ai-cells";
@@ -35,9 +38,7 @@ const LazyAgentPanel = React.lazy(
const LazyDependencyGraphPanel = React.lazy(
() => import("@/components/editor/chrome/panels/dependency-graph-panel"),
);
-const LazyDataSourcesPanel = React.lazy(
- () => import("../panels/datasources-panel"),
-);
+const LazySessionPanel = React.lazy(() => import("../panels/session-panel"));
const LazyDocumentationPanel = React.lazy(
() => import("../panels/documentation-panel"),
);
@@ -54,7 +55,6 @@ const LazyScratchpadPanel = React.lazy(
const LazySecretsPanel = React.lazy(() => import("../panels/secrets-panel"));
const LazySnippetsPanel = React.lazy(() => import("../panels/snippets-panel"));
const LazyTracingPanel = React.lazy(() => import("../panels/tracing-panel"));
-const LazyVariablePanel = React.lazy(() => import("../panels/variable-panel"));
const LazyCachePanel = React.lazy(() => import("../panels/cache-panel"));
export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
@@ -72,6 +72,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
const sidebarRef = React.useRef<ImperativePanelHandle>(null);
const terminalRef = React.useRef<ImperativePanelHandle>(null);
const { aiPanelTab, setAiPanelTab } = useAiPanelTab();
+ const errorCount = useAtomValue(cellErrorCount);
// sync sidebar
useEffect(() => {
@@ -204,11 +205,10 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
<Suspense>
<TooltipProvider>
{selectedPanel === "files" && <LazyFileExplorerPanel />}
- {selectedPanel === "variables" && <LazyVariablePanel />}
+ {selectedPanel === "variables" && <LazySessionPanel />}
{selectedPanel === "dependencies" && <LazyDependencyGraphPanel />}
{selectedPanel === "packages" && <LazyPackagesPanel />}
{selectedPanel === "outline" && <LazyOutlinePanel />}
- {selectedPanel === "datasources" && <LazyDataSourcesPanel />}
{selectedPanel === "documentation" && <LazyDocumentationPanel />}
{selectedPanel === "snippets" && <LazySnippetsPanel />}
{selectedPanel === "ai" && renderAiPanel()}
@@ -281,7 +281,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
{panelResizeHandle}
<div className="flex flex-col h-full">
{/* Panel header with tabs */}
- <div className="flex items-center justify-between border-b px-2 py-1 bg-background shrink-0">
+ <div className="flex items-center justify-between border-b px-2 h-8 bg-background shrink-0">
<Tabs
value={selectedDeveloperPanelTab}
onValueChange={(v) =>
@@ -290,19 +290,31 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
)
}
>
- <TabsList className="h-7 bg-transparent p-0">
+ <TabsList className="bg-transparent p-0 gap-1">
{DEVELOPER_PANEL_TABS.filter((tab) => !tab.hidden).map((tab) => (
<TabsTrigger
key={tab.type}
value={tab.type}
- className="text-xs gap-1.5 px-2 py-1 data-[state=active]:bg-muted"
+ className="text-sm gap-2 px-2 pt-1 pb-0.5 items-center leading-none data-[state=active]:bg-muted"
>
- <tab.Icon className="w-3.5 h-3.5" />
+ {/* Color the Errors icon red when there are errors,
+ so users see it when they open the developer panel */}
+ <tab.Icon
+ className={cn(
+ "w-4 h-4",
+ tab.type === "errors" &&
+ errorCount > 0 &&
+ "text-destructive",
+ )}
+ />
{tab.label}
</TabsTrigger>
))}
</TabsList>
</Tabs>
+ <div className="border-l border-border h-4 mx-1" />
+ <BackendConnectionStatus />
+ <div className="flex-1" />
<Button
size="xs"
variant="text"
@@ -377,7 +389,10 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
<Sidebar />
</TooltipProvider>
{helperPanel}
- <Panel id="app-chrome-body">
+ <Panel
+ id="app-chrome-body"
+ className={cn(isDeveloperPanelOpen && !isSidebarOpen && "border-l")}
+ >
<PanelGroup autoSaveId="marimo:chrome:v1:l1" direction="vertical">
{appBodyPanel}
<IfCapability capability="terminal">{bottomPanel}</IfCapability>
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx b/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx
index 24a2bc8738..dd3486fae2 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx
@@ -1,30 +1,45 @@
/* Copyright 2026 Marimo. All rights reserved. */
-import { useAtomValue } from "jotai";
+import { atom, useAtomValue } from "jotai";
import { startCase } from "lodash-es";
import { AlertCircleIcon, CheckCircle2Icon, PowerOffIcon } from "lucide-react";
import type React from "react";
import { Spinner } from "@/components/icons/spinner";
+import { Tooltip } from "@/components/ui/tooltip";
import { connectionAtom } from "@/core/network/connection";
import { useRuntimeManager } from "@/core/runtime/config";
+import { store } from "@/core/state/jotai";
import { isWasm } from "@/core/wasm/utils";
import { WebSocketState } from "@/core/websocket/types";
import { useAsyncData } from "@/hooks/useAsyncData";
import { useInterval } from "@/hooks/useInterval";
-import { FooterItem } from "../footer-item";
const CHECK_HEALTH_INTERVAL_MS = 30_000;
-export const BackendConnection: React.FC = () => {
+type ConnectionStatus = "healthy" | "unhealthy" | "connecting" | "disconnected";
+
+// Atom to track connection status for use in other components
+export const connectionStatusAtom = atom<ConnectionStatus>("connecting");
+
+export function getConnectionStatus(): ConnectionStatus {
+ return store.get(connectionStatusAtom);
+}
+
+/**
+ * Backend connection status indicator for the developer panel header
+ */
+export const BackendConnectionStatus: React.FC = () => {
const connection = useAtomValue(connectionAtom).state;
const runtime = useRuntimeManager();
const { isFetching, error, data, refetch } = useAsyncData(async () => {
if (connection !== WebSocketState.OPEN) {
+ store.set(connectionStatusAtom, "disconnected");
return;
}
if (isWasm()) {
+ store.set(connectionStatusAtom, "healthy");
return {
isHealthy: true,
lastChecked: new Date(),
@@ -34,12 +49,14 @@ export const BackendConnection: React.FC = () => {
try {
const isHealthy = await runtime.isHealthy();
+ store.set(connectionStatusAtom, isHealthy ? "healthy" : "unhealthy");
return {
isHealthy,
lastChecked: new Date(),
error: undefined,
};
} catch (error) {
+ store.set(connectionStatusAtom, "unhealthy");
return {
isHealthy: false,
lastChecked: new Date(),
@@ -90,8 +107,8 @@ export const BackendConnection: React.FC = () => {
};
return (
- <FooterItem
- tooltip={
+ <Tooltip
+ content={
<div className="text-sm whitespace-pre-line">
{getStatusInfo()}
{connection === WebSocketState.OPEN && (
@@ -101,11 +118,16 @@ export const BackendConnection: React.FC = () => {
)}
</div>
}
- selected={false}
- onClick={refetch}
- data-testid="footer-backend-status"
>
- {getStatusIcon()}
- </FooterItem>
+ <button
+ type="button"
+ onClick={refetch}
+ className="p-1 hover:bg-accent rounded flex items-center gap-1.5 text-xs text-muted-foreground"
+ data-testid="backend-status"
+ >
+ {getStatusIcon()}
+ <span>Kernel</span>
+ </button>
+ </Tooltip>
);
};
diff --git a/frontend/src/components/editor/chrome/wrapper/footer.tsx b/frontend/src/components/editor/chrome/wrapper/footer.tsx
index ca485e5740..c94437e533 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer.tsx
@@ -1,18 +1,18 @@
/* Copyright 2026 Marimo. All rights reserved. */
import { useAtomValue } from "jotai";
-import { TerminalSquareIcon, XCircleIcon } from "lucide-react";
+import { AlertTriangleIcon, XCircleIcon } from "lucide-react";
import type React from "react";
+import { renderShortcut } from "@/components/shortcuts/renderShortcut";
import { Tooltip } from "@/components/ui/tooltip";
import { cellErrorCount } from "@/core/cells/cells";
import { IfCapability } from "@/core/config/if-capability";
import { useHotkey } from "@/hooks/useHotkey";
-import { cn } from "@/utils/cn";
import { ShowInKioskMode } from "../../kiosk-mode";
import { useChromeActions, useChromeState } from "../state";
import { FooterItem } from "./footer-item";
import { AIStatusIcon } from "./footer-items/ai-status";
-import { BackendConnection } from "./footer-items/backend-status";
+import { connectionStatusAtom } from "./footer-items/backend-status";
import { CopilotStatusIcon } from "./footer-items/copilot-status";
import { MachineStats } from "./footer-items/machine-stats";
import { MinimapStatusIcon } from "./footer-items/minimap-status";
@@ -20,9 +20,20 @@ import { RTCStatus } from "./footer-items/rtc-status";
import { RuntimeSettings } from "./footer-items/runtime-settings";
export const Footer: React.FC = () => {
- const { isDeveloperPanelOpen, selectedDeveloperPanelTab } = useChromeState();
- const { toggleDeveloperPanel, openDeveloperPanelTab } = useChromeActions();
+ const { isDeveloperPanelOpen } = useChromeState();
+ const { toggleDeveloperPanel } = useChromeActions();
+
const errorCount = useAtomValue(cellErrorCount);
+ const connectionStatus = useAtomValue(connectionStatusAtom);
+
+ // Show issue count: cell errors + connection issues
+ const hasConnectionIssue =
+ connectionStatus === "unhealthy" || connectionStatus === "disconnected";
+ const issueCount = errorCount + (hasConnectionIssue ? 1 : 0);
+
+ // TODO: Add warning count from diagnostics/linting
+ // This can signal warnings/errors with settings up AI / Copilot etc
+ const warningCount = 0;
useHotkey("global.toggleTerminal", () => {
toggleDeveloperPanel();
@@ -33,30 +44,34 @@ export const Footer: React.FC = () => {
});
return (
- <footer className="h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin">
- <FooterItem
- tooltip="View errors"
- selected={
- isDeveloperPanelOpen && selectedDeveloperPanelTab === "errors"
- }
- onClick={() => openDeveloperPanelTab("errors")}
- data-testid="footer-errors"
- >
- <XCircleIcon
- className={cn("h-5 w-5", errorCount > 0 && "text-destructive")}
- />
- <span className="ml-1 font-mono mt-0.5">{errorCount}</span>
- </FooterItem>
-
+ <footer className="h-10 py-2 bg-background flex items-center text-muted-foreground text-md pl-2 pr-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin">
<IfCapability capability="terminal">
- <FooterItem
- tooltip="Toggle developer panel"
- selected={isDeveloperPanelOpen}
- onClick={() => toggleDeveloperPanel()}
- data-testid="footer-panel"
- >
- <TerminalSquareIcon className="h-5 w-5" />
- </FooterItem>
+ <div className="flex items-center">
+ <div className="flex">
+ <FooterItem
+ tooltip={
+ <span className="flex items-center gap-2">
+ Toggle developer panel{" "}
+ {renderShortcut("global.togglePanel", false)}
+ </span>
+ }
+ selected={isDeveloperPanelOpen}
+ onClick={() => toggleDeveloperPanel()}
+ data-testid="footer-panel"
+ >
+ <div className="flex items-center gap-1">
+ <XCircleIcon
+ className={`w-4 h-4 ${issueCount > 0 ? "text-destructive" : ""}`}
+ />
+ <span>{issueCount}</span>
+ <AlertTriangleIcon
+ className={`w-4 h-4 ml-1 ${warningCount > 0 ? "text-yellow-500" : ""}`}
+ />
+ <span>{warningCount}</span>
+ </div>
+ </FooterItem>
+ </div>
+ </div>
</IfCapability>
<RuntimeSettings />
@@ -82,7 +97,6 @@ export const Footer: React.FC = () => {
<AIStatusIcon />
<CopilotStatusIcon />
<RTCStatus />
- <BackendConnection />
</div>
</footer>
);
diff --git a/frontend/src/components/scratchpad/scratchpad.tsx b/frontend/src/components/scratchpad/scratchpad.tsx
index 558ece682b..0ecea3638a 100644
--- a/frontend/src/components/scratchpad/scratchpad.tsx
+++ b/frontend/src/components/scratchpad/scratchpad.tsx
@@ -4,12 +4,14 @@ import type { EditorView } from "@codemirror/view";
import { useAtom, useAtomValue, useSetAtom } from "jotai";
import {
BetweenHorizontalStartIcon,
+ CircleHelpIcon,
EraserIcon,
HistoryIcon,
PlayIcon,
} from "lucide-react";
import type React from "react";
import { Suspense, useRef, useState } from "react";
+import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
import useEvent from "react-use-event-hook";
import { useCellActions, useNotebook } from "@/core/cells/cells";
import { useLastFocusedCellId } from "@/core/cells/focus";
@@ -120,57 +122,6 @@ export const ScratchPad: React.FC = () => {
const [languageAdapter, setLanguageAdapter] = useState<LanguageAdapterType>();
- const renderBody = () => {
- // We overlay the history on top of the body, instead of removing it,
- // so we don't have to re-render the entire editor and outputs.
- return (
- <>
- <div className="overflow-auto shrink-0 max-h-[40%]">
- <CellEditor
- theme={theme}
- showPlaceholder={false}
- id={cellId}
- code={code}
- config={scratchpadCellConfig}
- status="idle"
- serializedEditorState={null}
- runCell={handleRun}
- userConfig={userConfig}
- editorViewRef={ref}
- setEditorView={(ev) => {
- ref.current = ev;
- }}
- hidden={false}
- showHiddenCode={Functions.NOOP}
- languageAdapter={languageAdapter}
- setLanguageAdapter={setLanguageAdapter}
- />
- </div>
- <div className="flex-1 overflow-auto shrink-0">
- <OutputArea
- allowExpand={false}
- output={output}
- className={CSSClasses.outputArea}
- cellId={cellId}
- stale={false}
- loading={false}
- />
- </div>
- <div className="overflow-auto shrink-0 max-h-[35%]">
- <ConsoleOutput
- consoleOutputs={consoleOutputs}
- className="overflow-auto"
- stale={false}
- cellName={DEFAULT_CELL_NAME}
- onSubmitDebugger={Functions.NOOP}
- cellId={cellId}
- debuggerActive={false}
- />
- </div>
- </>
- );
- };
-
const renderHistory = () => {
if (!historyVisible) {
return null;
@@ -204,74 +155,136 @@ export const ScratchPad: React.FC = () => {
);
};
- return (
- <div
- className="flex flex-col h-full overflow-hidden divide-y"
- id={HTMLCellId.create(cellId)}
- >
- <p className="p-2 text-muted-foreground text-sm">
- Use this scratchpad cell to experiment with code without restrictions on
- variable names. Scratchpad code is ephemeral: variables defined in the
- scratchpad aren't saved to notebook memory, and the code is not saved in
- the notebook file.
- </p>
- <div className="flex items-center shrink-0">
- <Tooltip content={renderShortcut("cell.run")}>
- <Button
- data-testid="scratchpad-run-button"
- onClick={handleRun}
- disabled={historyVisible}
- variant="text"
- // className="bg-(--grass-3) hover:bg-(--grass-4) rounded-none"
- size="xs"
- >
- <PlayIcon color="var(--grass-11)" size={16} />
- </Button>
- </Tooltip>
- <Tooltip content="Clear code and outputs">
+ const renderToolbar = () => (
+ <div className="flex items-center shrink-0 border-b">
+ <Tooltip content={renderShortcut("cell.run")}>
+ <Button
+ data-testid="scratchpad-run-button"
+ onClick={handleRun}
+ disabled={historyVisible}
+ variant="text"
+ size="xs"
+ >
+ <PlayIcon color="var(--grass-11)" size={16} />
+ </Button>
+ </Tooltip>
+ <Tooltip content="Clear code and outputs">
+ <Button
+ disabled={historyVisible}
+ size="xs"
+ variant="text"
+ onClick={handleClearCode}
+ >
+ <EraserIcon size={16} />
+ </Button>
+ </Tooltip>
+ <HideInKioskMode>
+ <Tooltip content="Insert code">
<Button
disabled={historyVisible}
size="xs"
variant="text"
- onClick={handleClearCode}
+ onClick={handleInsertCode}
>
- <EraserIcon size={16} />
+ <BetweenHorizontalStartIcon size={16} />
</Button>
</Tooltip>
- <HideInKioskMode>
- <Tooltip content="Insert code">
- <Button
- disabled={historyVisible}
- size="xs"
- variant="text"
- onClick={handleInsertCode}
- >
- <BetweenHorizontalStartIcon size={16} />
- </Button>
- </Tooltip>
- </HideInKioskMode>
+ </HideInKioskMode>
- {(status === "running" || status === "queued") && (
- <Spinner className="inline" size="small" />
- )}
- <div className="flex-1" />
+ {(status === "running" || status === "queued") && (
+ <Spinner className="inline" size="small" />
+ )}
+ <div className="flex-1" />
- <Tooltip content="Toggle history">
- <Button
- size="xs"
- variant="text"
- className={cn(historyVisible && "bg-(--sky-3) rounded-none")}
- onClick={() => setHistoryVisible(!historyVisible)}
- disabled={history.length === 0}
- >
- <HistoryIcon size={16} />
- </Button>
- </Tooltip>
- </div>
- <div className="flex-1 divide-y relative overflow-hidden flex flex-col">
- {renderBody()}
- {renderHistory()}
- </div>
+ <Tooltip content="Toggle history">
+ <Button
+ size="xs"
+ variant="text"
+ className={cn(historyVisible && "bg-(--sky-3) rounded-none")}
+ onClick={() => setHistoryVisible(!historyVisible)}
+ disabled={history.length === 0}
+ >
+ <HistoryIcon size={16} />
+ </Button>
+ </Tooltip>
+ <Tooltip
+ content={
+ <span className="block max-w-prose">
+ Use this scratchpad to experiment with code without restrictions on
+ variable names. Variables defined here aren't saved to notebook
+ memory, and the code is not saved in the notebook file.
+ </span>
+ }
+ >
+ <Button size="xs" variant="text">
+ <CircleHelpIcon size={16} />
+ </Button>
+ </Tooltip>
+ </div>
+ );
+
+ return (
+ <div
+ className="flex flex-col h-full overflow-hidden"
+ id={HTMLCellId.create(cellId)}
+ >
+ <PanelGroup direction="horizontal" className="h-full">
+ {/* Left side: toolbar + editor */}
+ <Panel defaultSize={40} minSize={20} maxSize={70}>
+ <div className="h-full flex flex-col overflow-hidden relative">
+ {renderToolbar()}
+ <div className="flex-1 overflow-auto">
+ <CellEditor
+ theme={theme}
+ showPlaceholder={false}
+ id={cellId}
+ code={code}
+ config={scratchpadCellConfig}
+ status="idle"
+ serializedEditorState={null}
+ runCell={handleRun}
+ userConfig={userConfig}
+ editorViewRef={ref}
+ setEditorView={(ev) => {
+ ref.current = ev;
+ }}
+ hidden={false}
+ showHiddenCode={Functions.NOOP}
+ languageAdapter={languageAdapter}
+ setLanguageAdapter={setLanguageAdapter}
+ />
+ </div>
+ {renderHistory()}
+ </div>
+ </Panel>
+ <PanelResizeHandle className="w-1 bg-border hover:bg-primary/50 transition-colors" />
+ {/* Right side: outputs */}
+ <Panel defaultSize={60} minSize={20}>
+ <div className="h-full flex flex-col divide-y overflow-hidden">
+ <div className="flex-1 overflow-auto">
+ <OutputArea
+ allowExpand={false}
+ output={output}
+ className={CSSClasses.outputArea}
+ cellId={cellId}
+ stale={false}
+ loading={false}
+ />
+ </div>
+ <div className="overflow-auto shrink-0 max-h-[50%]">
+ <ConsoleOutput
+ consoleOutputs={consoleOutputs}
+ className="overflow-auto"
+ stale={false}
+ cellName={DEFAULT_CELL_NAME}
+ onSubmitDebugger={Functions.NOOP}
+ cellId={cellId}
+ debuggerActive={false}
+ />
+ </div>
+ </div>
+ </Panel>
+ </PanelGroup>
</div>
);
};
diff --git a/frontend/src/components/tracing/tracing.tsx b/frontend/src/components/tracing/tracing.tsx
index de0437842c..dbcf2f342e 100644
--- a/frontend/src/components/tracing/tracing.tsx
+++ b/frontend/src/components/tracing/tracing.tsx
@@ -11,6 +11,7 @@ import {
CircleX,
} from "lucide-react";
import React, { type JSX, Suspense, useEffect, useRef, useState } from "react";
+import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
import { useVegaEmbed } from "react-vega";
import useResizeObserver from "use-resize-observer";
import { compile } from "vega-lite";
@@ -69,44 +70,52 @@ export const Tracing: React.FC = () => {
}
return (
- <div className="py-1 px-2 overflow-y-scroll">
- <div className="flex flex-row justify-end gap-3">
- <div className="flex flex-row gap-1 items-center">
- <label htmlFor="chartPosition" className="text-xs">
- Inline chart
- </label>
- <input
- type="checkbox"
- name="chartPosition"
- data-testid="chartPosition"
- onClick={toggleChartPosition}
- defaultChecked={chartPosition === "sideBySide"}
- className="h-3 cursor-pointer"
- />
- </div>
-
- <ClearButton dataTestId="clear-traces-button" onClick={clearRuns} />
- </div>
-
- <div className="flex flex-col gap-3">
- {newestToOldestRunIds.map((runId: RunId, index: number) => {
- const run = runMap.get(runId);
- if (run) {
- return (
- <TraceBlock
- key={run.runId}
- run={run}
- isExpanded={expandedRuns.get(run.runId)}
- isMostRecentRun={index === 0}
- chartPosition={chartPosition}
- theme={theme}
+ <PanelGroup direction="horizontal" className="h-full">
+ <Panel defaultSize={50} minSize={30} maxSize={80}>
+ <div className="py-1 px-2 overflow-y-scroll h-full">
+ <div className="flex flex-row justify-start gap-3">
+ <div className="flex flex-row gap-1 items-center">
+ <label htmlFor="chartPosition" className="text-xs">
+ Inline chart
+ </label>
+ <input
+ type="checkbox"
+ name="chartPosition"
+ data-testid="chartPosition"
+ onClick={toggleChartPosition}
+ defaultChecked={chartPosition === "sideBySide"}
+ className="h-3 cursor-pointer"
/>
- );
- }
- return null;
- })}
- </div>
- </div>
+ </div>
+
+ <ClearButton dataTestId="clear-traces-button" onClick={clearRuns} />
+ </div>
+
+ <div className="flex flex-col gap-3">
+ {newestToOldestRunIds.map((runId: RunId, index: number) => {
+ const run = runMap.get(runId);
+ if (run) {
+ return (
+ <TraceBlock
+ key={run.runId}
+ run={run}
+ isExpanded={expandedRuns.get(run.runId)}
+ isMostRecentRun={index === 0}
+ chartPosition={chartPosition}
+ theme={theme}
+ />
+ );
+ }
+ return null;
+ })}
+ </div>
+ </div>
+ </Panel>
+ <PanelResizeHandle className="w-1 bg-border hover:bg-primary/50 transition-colors" />
+ <Panel defaultSize={50}>
+ <div />
+ </Panel>
+ </PanelGroup>
);
};