Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(pam): polish query panel UI — resize handle overlap, info tab color, status bar, contrast improvements

bernie-gabeeed5eb70f
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index cd39fc920c..b8ad2e0cde 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -12,6 +12,7 @@
"@casl/react": "^4.0.0",
"@codemirror/commands": "^6.10.3",
"@codemirror/lang-sql": "^6.10.0",
+ "@codemirror/language": "^6.12.3",
"@codemirror/state": "^6.6.0",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.41.0",
@@ -30,6 +31,7 @@
"@headlessui/react": "^1.7.19",
"@hookform/resolvers": "^3.9.1",
"@lexical/react": "^0.29.0",
+ "@lezer/highlight": "^1.2.3",
"@lottiefiles/dotlottie-react": "^0.12.0",
"@lottiefiles/dotlottie-web": "^0.38.2",
"@octokit/rest": "^21.0.2",
@@ -67,6 +69,9 @@
"@types/dagre": "^0.7.52",
"@types/nprogress": "^0.2.3",
"@ucast/mongo2js": "^1.3.4",
+ "@uiw/codemirror-theme-aura": "^4.25.9",
+ "@uiw/codemirror-theme-dracula": "^4.25.9",
+ "@uiw/codemirror-theme-tokyo-night": "^4.25.9",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.12.0",
"@xterm/xterm": "^5.5.0",
@@ -7212,6 +7217,61 @@
"@ucast/mongo": "^2.4.0"
}
},
+ "node_modules/@uiw/codemirror-theme-aura": {
+ "version": "4.25.9",
+ "resolved": "https://registry.npmjs.org/@uiw/codemirror-theme-aura/-/codemirror-theme-aura-4.25.9.tgz",
+ "integrity": "sha512-cJyInS81wh0lWYs1XDiyFSxCCXrJ+4qifBsDHSYELdLgbnr441T3Kr6a9lyUobtL4DZVaIaCKE9rajrFdJIeAw==",
+ "license": "MIT",
+ "dependencies": {
+ "@uiw/codemirror-themes": "4.25.9"
+ },
+ "funding": {
+ "url": "https://jaywcjlove.github.io/#/sponsor"
+ }
+ },
+ "node_modules/@uiw/codemirror-theme-dracula": {
+ "version": "4.25.9",
+ "resolved": "https://registry.npmjs.org/@uiw/codemirror-theme-dracula/-/codemirror-theme-dracula-4.25.9.tgz",
+ "integrity": "sha512-0VTnpPCHPc+7LqYsQOX6nvW32XiiT+O6kJjReUbV7Eio3vPHsb+b9P4DKhz4AAvIIYMxmHkMuautHKuWktFXSg==",
+ "license": "MIT",
+ "dependencies": {
+ "@uiw/codemirror-themes": "4.25.9"
+ },
+ "funding": {
+ "url": "https://jaywcjlove.github.io/#/sponsor"
+ }
+ },
+ "node_modules/@uiw/codemirror-theme-tokyo-night": {
+ "version": "4.25.9",
+ "resolved": "https://registry.npmjs.org/@uiw/codemirror-theme-tokyo-night/-/codemirror-theme-tokyo-night-4.25.9.tgz",
+ "integrity": "sha512-NkSqguMpzRjsRBbTIfOrGS35tQkE3K8AAetZHlbRZC7fnI52RreZ11X41cOYrc/Dapt8xqUPlhlvclymGFgy8g==",
+ "license": "MIT",
+ "dependencies": {
+ "@uiw/codemirror-themes": "4.25.9"
+ },
+ "funding": {
+ "url": "https://jaywcjlove.github.io/#/sponsor"
+ }
+ },
+ "node_modules/@uiw/codemirror-themes": {
+ "version": "4.25.9",
+ "resolved": "https://registry.npmjs.org/@uiw/codemirror-themes/-/codemirror-themes-4.25.9.tgz",
+ "integrity": "sha512-DAHKb/L9ELwjY4nCf/MP/mIllHOn4GQe7RR4x8AMJuNeh9nGRRoo1uPxrxMmUL/bKqe6kDmDbIZ2AlhlqyIJuw==",
+ "license": "MIT",
+ "dependencies": {
+ "@codemirror/language": "^6.0.0",
+ "@codemirror/state": "^6.0.0",
+ "@codemirror/view": "^6.0.0"
+ },
+ "funding": {
+ "url": "https://jaywcjlove.github.io/#/sponsor"
+ },
+ "peerDependencies": {
+ "@codemirror/language": ">=6.0.0",
+ "@codemirror/state": ">=6.0.0",
+ "@codemirror/view": ">=6.0.0"
+ }
+ },
"node_modules/@ungap/structured-clone": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 6115fa5ade..8dc247137e 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -24,6 +24,7 @@
"@casl/react": "^4.0.0",
"@codemirror/commands": "^6.10.3",
"@codemirror/lang-sql": "^6.10.0",
+ "@codemirror/language": "^6.12.3",
"@codemirror/state": "^6.6.0",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.41.0",
@@ -42,6 +43,7 @@
"@headlessui/react": "^1.7.19",
"@hookform/resolvers": "^3.9.1",
"@lexical/react": "^0.29.0",
+ "@lezer/highlight": "^1.2.3",
"@lottiefiles/dotlottie-react": "^0.12.0",
"@lottiefiles/dotlottie-web": "^0.38.2",
"@octokit/rest": "^21.0.2",
@@ -79,6 +81,9 @@
"@types/dagre": "^0.7.52",
"@types/nprogress": "^0.2.3",
"@ucast/mongo2js": "^1.3.4",
+ "@uiw/codemirror-theme-aura": "^4.25.9",
+ "@uiw/codemirror-theme-dracula": "^4.25.9",
+ "@uiw/codemirror-theme-tokyo-night": "^4.25.9",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.12.0",
"@xterm/xterm": "^5.5.0",
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx b/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx
index 1254e9523d..3b2b2ae10e 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx
+++ b/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx
@@ -416,7 +416,7 @@ export const PamDataExplorerPage = () => {
className={cn(
"flex shrink-0 items-center gap-1.5 border-b-2 px-4 py-2 text-xs font-medium transition-colors",
activeTabId === BROWSE_TAB_ID
- ? "border-primary text-mineshaft-100"
+ ? "border-info text-mineshaft-100"
: "border-transparent text-mineshaft-400 hover:text-mineshaft-200"
)}
>
@@ -434,7 +434,7 @@ export const PamDataExplorerPage = () => {
className={cn(
"group flex shrink-0 cursor-pointer items-center gap-1 border-b-2 px-3 py-2 text-xs font-medium transition-colors",
activeTabId === tab.id
- ? "border-primary text-mineshaft-100"
+ ? "border-info text-mineshaft-100"
: "border-transparent text-mineshaft-400 hover:text-mineshaft-200"
)}
>
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx
index 1bb7103a1a..bebd975908 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx
+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
+import { GripHorizontalIcon } from "lucide-react";
import { cn } from "@app/components/v3/utils";
@@ -8,6 +9,11 @@ import { QueryResultsTable } from "./QueryResultsTable";
import { QueryToolbar } from "./QueryToolbar";
import { SqlEditor } from "./SqlEditor";
+function getRowLabel(rowCount: number, isTruncated: boolean): string {
+ if (isTruncated) return `Showing 1,000 of ${rowCount.toLocaleString()} rows`;
+ return `${rowCount} row${rowCount !== 1 ? "s" : ""}`;
+}
+
type QueryResult = {
rows: Record<string, unknown>[];
fields: FieldInfo[];
@@ -111,8 +117,6 @@ export function QueryPanel({
<div className="flex h-full w-full flex-col overflow-hidden">
<QueryToolbar
isRunning={isRunning}
- result={result}
- error={error}
isInTransaction={isInTransaction}
hasSelection={hasSelection}
onRun={handleRun}
@@ -124,7 +128,11 @@ export function QueryPanel({
ref={containerRef}
className={cn("flex flex-1 flex-col overflow-hidden", isDragging && "select-none")}
>
- <div ref={editorPaneRef} className="min-h-0 overflow-hidden">
+ <div
+ ref={editorPaneRef}
+ className="min-h-0 overflow-hidden"
+ style={{ backgroundColor: "#16181a" }}
+ >
<SqlEditor
value={tab.sql}
onChange={onSqlChange}
@@ -138,23 +146,48 @@ export function QueryPanel({
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div
- className={cn(
- "h-1 shrink-0 cursor-row-resize bg-mineshaft-600 transition-colors hover:bg-primary/50",
- isDragging && "bg-primary/50"
- )}
+ className="group relative z-10 h-0 shrink-0 cursor-row-resize"
onMouseDown={(e) => {
e.preventDefault();
setIsDragging(true);
}}
- />
-
- <div className="min-h-0 flex-1 overflow-hidden bg-bunker-800">
- <QueryResultsTable
- result={result}
- error={error}
- isRunning={isRunning}
- tableDetail={tableDetail}
+ >
+ <div
+ className={cn(
+ "absolute inset-x-0 top-0 h-px bg-mineshaft-600 transition-colors group-hover:bg-mineshaft-400",
+ isDragging && "bg-mineshaft-400"
+ )}
/>
+ <div
+ className={cn(
+ "absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-sm bg-mineshaft-600 px-2 text-mineshaft-300 transition-colors group-hover:bg-mineshaft-500 group-hover:text-mineshaft-100",
+ isDragging && "bg-mineshaft-500 text-mineshaft-100"
+ )}
+ >
+ <GripHorizontalIcon className="size-3" />
+ </div>
+ </div>
+
+ <div className="relative z-0 flex min-h-0 flex-1 flex-col overflow-hidden bg-bunker-800">
+ <div className="min-h-0 flex-1 overflow-hidden">
+ <QueryResultsTable
+ result={result}
+ error={error}
+ isRunning={isRunning}
+ tableDetail={tableDetail}
+ />
+ </div>
+ {!isRunning && result && !error && (
+ <div className="flex shrink-0 items-center border-t border-mineshaft-600 px-3 py-1">
+ <span className="text-xs text-mineshaft-400">
+ {result.rowCount != null
+ ? getRowLabel(result.rowCount, result.isTruncated)
+ : result.command}
+ {" · "}
+ {result.executionTimeMs}ms
+ </span>
+ </div>
+ )}
</div>
</div>
</div>
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryResultsTable.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryResultsTable.tsx
index dd4d0e89b0..9ed82f2db1 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryResultsTable.tsx
+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryResultsTable.tsx
@@ -123,7 +123,7 @@ export function QueryResultsTable({ result, error, isRunning, tableDetail }: Pro
if (!result) {
return (
<div className="flex h-full items-center justify-center">
- <p className="text-sm text-mineshaft-500">Run a query to see results</p>
+ <p className="text-sm text-mineshaft-300">Run a query to see results</p>
</div>
);
}
@@ -155,7 +155,7 @@ export function QueryResultsTable({ result, error, isRunning, tableDetail }: Pro
return (
<div className="flex h-full flex-col items-center justify-center gap-2">
- <span className="rounded bg-mineshaft-700 px-3 py-1.5 font-mono text-sm text-mineshaft-200">
+ <span className="rounded border-2 border-mineshaft-500 bg-mineshaft-700 px-3 py-1.5 font-mono text-sm text-mineshaft-200">
{message}
{isMutation && <span className="ml-2 text-mineshaft-400">· No rows returned</span>}
</span>
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx
index 874d713a13..c02c9396e3 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx
+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx
@@ -4,22 +4,8 @@ import { Button } from "@app/components/v3/generic/Button";
const isMac = typeof navigator !== "undefined" && navigator.userAgent.includes("Mac");
-function getRowLabel(rowCount: number, isTruncated: boolean): string {
- if (isTruncated) return `Showing 1,000 of ${rowCount.toLocaleString()} rows`;
- return `${rowCount} row${rowCount !== 1 ? "s" : ""}`;
-}
-
-type QueryResult = {
- rowCount: number | null;
- isTruncated: boolean;
- command: string;
- executionTimeMs: number;
-};
-
type Props = {
isRunning: boolean;
- result: QueryResult | null;
- error: string | null;
isInTransaction: boolean;
hasSelection: boolean;
onRun: () => void;
@@ -30,8 +16,6 @@ type Props = {
export function QueryToolbar({
isRunning,
- result,
- error,
isInTransaction,
hasSelection,
onRun,
@@ -40,7 +24,7 @@ export function QueryToolbar({
onCancel
}: Props) {
return (
- <div className="flex shrink-0 items-center gap-3 border-b border-mineshaft-600 bg-mineshaft-800 px-3 py-1.5">
+ <div className="flex shrink-0 items-center gap-3 border-b border-mineshaft-600 bg-bunker-800 px-3 py-1.5">
<Button
size="xs"
onClick={() => onRun()}
@@ -65,7 +49,7 @@ export function QueryToolbar({
</span>
<Button
size="xs"
- variant="outline"
+ variant="success"
onClick={onCommit}
isDisabled={isRunning}
className="gap-1.5"
@@ -85,15 +69,6 @@ export function QueryToolbar({
</Button>
</>
)}
- {!isRunning && result && !error && (
- <span className="ml-auto text-xs text-mineshaft-400">
- {result.rowCount != null
- ? getRowLabel(result.rowCount, result.isTruncated)
- : result.command}
- {" · "}
- {result.executionTimeMs}ms
- </span>
- )}
</div>
);
}
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/SqlEditor.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/SqlEditor.tsx
index 1b7b8d1980..658fc1c85e 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/components/SqlEditor.tsx
+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/SqlEditor.tsx
@@ -1,9 +1,55 @@
import { useEffect, useRef } from "react";
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
import { PostgreSQL, sql } from "@codemirror/lang-sql";
+import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
import { EditorState } from "@codemirror/state";
-import { oneDark } from "@codemirror/theme-one-dark";
import { EditorView, keymap, type ViewUpdate } from "@codemirror/view";
+import { tags } from "@lezer/highlight";
+
+const infisicalTheme = EditorView.theme({
+ "&": { height: "100%", fontSize: "13px", backgroundColor: "#16181a" },
+ "&.cm-editor": { backgroundColor: "#16181a" },
+ ".cm-scroller": {
+ overflow: "auto",
+ fontFamily: "ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace",
+ backgroundColor: "#16181a"
+ },
+ ".cm-content": { padding: "8px 0", caretColor: "#e0ed34", backgroundColor: "#16181a" },
+ ".cm-line": { backgroundColor: "transparent" },
+ ".cm-gutters": {
+ backgroundColor: "#16181a",
+ borderRight: "1px solid #2b2c30",
+ color: "#707174"
+ },
+ ".cm-lineNumbers .cm-gutterElement": { padding: "0 12px 0 8px" },
+ ".cm-activeLine": { backgroundColor: "rgba(45, 47, 51, 0.5)" },
+ ".cm-activeLineGutter": { backgroundColor: "rgba(45, 47, 51, 0.5)" },
+ ".cm-cursor": { borderLeftColor: "#e0ed34" },
+ ".cm-selectionBackground": { backgroundColor: "#2d2f33 !important" },
+ "&.cm-focused .cm-selectionBackground": { backgroundColor: "#2d2f33 !important" },
+ ".cm-matchingBracket": { backgroundColor: "#323439", color: "#e0ed34 !important" }
+});
+
+const infisicalHighlight = HighlightStyle.define(
+ [
+ { tag: tags.keyword, color: "#63b0bd", fontWeight: "600" },
+ { tag: tags.string, color: "#29b866" },
+ { tag: tags.number, color: "#f39c12" },
+ { tag: tags.comment, color: "#707174", fontStyle: "italic" },
+ { tag: tags.operator, color: "#adaeb0" },
+ { tag: tags.punctuation, color: "#adaeb0" },
+ { tag: tags.separator, color: "#adaeb0" },
+ { tag: tags.bracket, color: "#adaeb0" },
+ { tag: tags.name, color: "#ebebeb" },
+ { tag: tags.function(tags.name), color: "#63b0bd" },
+ { tag: tags.typeName, color: "#f39c12" },
+ { tag: tags.bool, color: "#63b0bd" },
+ { tag: tags.null, color: "#707174" },
+ { tag: tags.special(tags.string), color: "#29b866" },
+ { tag: tags.invalid, color: "#e74c3c" }
+ ],
+ { all: { color: "#ebebeb" } }
+);
type Props = {
value: string;
@@ -55,15 +101,8 @@ export function SqlEditor({
...defaultKeymap
]),
sql({ dialect: PostgreSQL }),
- oneDark,
- EditorView.theme({
- "&": { height: "100%", fontSize: "13px" },
- ".cm-scroller": {
- overflow: "auto",
- fontFamily: "ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace"
- },
- ".cm-content": { padding: "8px 0" }
- }),
+ infisicalTheme,
+ syntaxHighlighting(infisicalHighlight),
EditorView.updateListener.of((update: ViewUpdate) => {
if (update.docChanged) {
const doc = update.state.doc.toString();