Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(pam): show truncation in toolbar when query results exceed 1,000 rows
Bernie Gandincaec88a9231f
diff --git a/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts b/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.tsindex 5dbe9a5413..0d40c36b63 100644--- a/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts+++ b/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts@@ -238,12 +238,15 @@ export const handlePostgresSession = async (const executionTimeMs = Math.round(performance.now() - startTime);const MAX_ROWS = 1000;const result = Array.isArray(rawResult) ? rawResult[rawResult.length - 1] : rawResult;+ const allRows = result.rows ?? [];+ const isTruncated = allRows.length > MAX_ROWS;sendResponse({type: PostgresServerMessageType.QueryResult,id: message.id,- rows: (result.rows ?? []).slice(0, MAX_ROWS),+ rows: allRows.slice(0, MAX_ROWS),fields: (result.fields ?? []).map((f) => ({ name: f.name })),rowCount: result.rowCount,+ isTruncated,command: result.command ?? "",executionTimeMs});diff --git a/backend/src/ee/services/pam-web-access/pam-postgres-ws-types.ts b/backend/src/ee/services/pam-web-access/pam-postgres-ws-types.tsindex ff82eedfb8..4456b46250 100644--- a/backend/src/ee/services/pam-web-access/pam-postgres-ws-types.ts+++ b/backend/src/ee/services/pam-web-access/pam-postgres-ws-types.ts@@ -139,6 +139,7 @@ const QueryResultResponseSchema = CorrelatedBaseSchema.extend({})),rowCount: z.number().nullable(),+ isTruncated: z.boolean(),command: z.string(),executionTimeMs: z.number()});diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsxindex 366f817776..e901ba7535 100644--- a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryPanel.tsx@@ -12,6 +12,7 @@ type QueryResult = {rows: Record<string, unknown>[];fields: FieldInfo[];rowCount: number | null;+ isTruncated: boolean;command: string;executionTimeMs: number;};diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsxindex 0764898c62..fcb34b53e1 100644--- a/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/QueryToolbar.tsx@@ -6,6 +6,7 @@ const isMac = typeof navigator !== "undefined" && navigator.userAgent.includes("type QueryResult = {rowCount: number | null;+ isTruncated: boolean;command: string;executionTimeMs: number;};@@ -83,7 +84,9 @@ export function QueryToolbar({{!isRunning && result && !error && (<span className="ml-auto text-xs text-mineshaft-400">{result.rowCount != null- ? `${result.rowCount} row${result.rowCount !== 1 ? "s" : ""}`+ ? result.isTruncated+ ? `Showing 1,000 of ${result.rowCount.toLocaleString()} rows`+ : `${result.rowCount} row${result.rowCount !== 1 ? "s" : ""}`: result.command}{" · "}{result.executionTimeMs}msdiff --git a/frontend/src/pages/pam/PamDataExplorerPage/data-explorer-types.ts b/frontend/src/pages/pam/PamDataExplorerPage/data-explorer-types.tsindex 435da716ec..98151f05a6 100644--- a/frontend/src/pages/pam/PamDataExplorerPage/data-explorer-types.ts+++ b/frontend/src/pages/pam/PamDataExplorerPage/data-explorer-types.ts@@ -16,6 +16,7 @@ export type DataExplorerServerMessage =rows: Record<string, unknown>[];fields: FieldInfo[];rowCount: number | null;+ isTruncated: boolean;command: string;executionTimeMs: number;}diff --git a/frontend/src/pages/pam/PamDataExplorerPage/use-data-explorer-session.ts b/frontend/src/pages/pam/PamDataExplorerPage/use-data-explorer-session.tsindex 396919a811..c28c630068 100644--- a/frontend/src/pages/pam/PamDataExplorerPage/use-data-explorer-session.ts+++ b/frontend/src/pages/pam/PamDataExplorerPage/use-data-explorer-session.ts@@ -406,6 +406,7 @@ export const useDataExplorerSession = ({rows: Record<string, unknown>[];fields: FieldInfo[];rowCount: number | null;+ isTruncated: boolean;command: string;executionTimeMs: number;}> => {@@ -417,6 +418,7 @@ export const useDataExplorerSession = ({rows: resp.rows,fields: resp.fields,rowCount: resp.rowCount,+ isTruncated: resp.isTruncated,command: resp.command,executionTimeMs: resp.executionTimeMs};