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
feat(agent-vault): paginate the variables list
Scott Wilson562ed5d2de84
diff --git a/backend/e2e-test/routes/v1/agent-vault.spec.ts b/backend/e2e-test/routes/v1/agent-vault.spec.tsindex c58a9cdf5f..1a60acfd62 100644--- a/backend/e2e-test/routes/v1/agent-vault.spec.ts+++ b/backend/e2e-test/routes/v1/agent-vault.spec.ts@@ -1305,6 +1305,44 @@ describe("Agent Vault V1 Router", async () => {expect((await inject("PATCH", `${variablesUrl}/${first.id}`, { key: "TOKEN" })).statusCode).toBe(200);});+ test("the list pages, searches, and sorts by how many services use each variable", async () => {+ const bundle = await createAccessBundle("variables-list");+ await createVariable({ key: "ALPHA_TOKEN", value: "a" });+ await createVariable({ key: "BETA_TOKEN", value: "b" });+ await createVariable({ key: "GAMMA_KEY", value: "g" });+ const createService = async (body: Record<string, unknown>) =>+ expect((await inject("POST", servicesUrl(bundle.id), body)).statusCode).toBe(200);+ // Two fields of one service count as one service.+ await createService({+ name: "both-fields",+ hostPattern: "both-fields.example.com",+ credential: { type: "bearer", value: "{{GAMMA_KEY}}" },+ customHeaders: [{ name: "X-Gamma", value: "{{GAMMA_KEY}}" }]+ });+ await createService({+ name: "gamma-and-beta",+ hostPattern: "gamma-and-beta.example.com",+ credential: { type: "basic", username: "{{BETA_TOKEN}}", password: "{{GAMMA_KEY}}" }+ });++ const list = async (query: string) => {+ const res = await inject("GET", `${variablesUrl}?${query}`);+ expect(res.statusCode).toBe(200);+ const body = JSON.parse(res.payload) as { variables: { key: string }[]; totalCount: number };+ return { keys: body.variables.map((variable) => variable.key), totalCount: body.totalCount };+ };++ expect(await list("limit=2")).toEqual({ keys: ["ALPHA_TOKEN", "BETA_TOKEN"], totalCount: 3 });+ expect(await list("limit=2&offset=2")).toEqual({ keys: ["GAMMA_KEY"], totalCount: 3 });+ expect(await list("search=token")).toEqual({ keys: ["ALPHA_TOKEN", "BETA_TOKEN"], totalCount: 2 });+ expect(await list("search=%25")).toEqual({ keys: [], totalCount: 0 });+ expect(await list("orderBy=usedBy&orderDirection=desc")).toEqual({+ keys: ["GAMMA_KEY", "BETA_TOKEN", "ALPHA_TOKEN"],+ totalCount: 3+ });+ expect((await inject("GET", `${variablesUrl}?limit=101`)).statusCode).toBe(422);+ });+test("services in different bundles share a variable, and each resolves it", async () => {const first = await createAccessBundle("variables-shared-first");const second = await createAccessBundle("variables-shared-second");diff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-variable-router.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-variable-router.tsindex 92ae2a0782..916f9541a1 100644--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-variable-router.ts+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-variable-router.ts@@ -12,6 +12,7 @@ import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";import { actorContext } from "./agent-vault-router-fns";import {+ agentVaultListQuery,AgentVaultVariableKeySchema,AgentVaultVariableSchema,AgentVaultVariableValueSchema@@ -27,16 +28,25 @@ export const registerAgentVaultVariableRouter = async (server: FastifyZodProvideoperationId: "listAgentVaultVariables",description: "List the variables in Agent Vault",tags: [ApiDocsTags.AgentVaultVariables],- response: { 200: z.object({ variables: AgentVaultVariableSchema.array() }) }+ querystring: z.object({+ orderBy: z.enum(["key", "usedBy"]).default("key").describe(AGENT_VAULT.VARIABLE.orderBy),+ orderDirection: z.enum(["asc", "desc"]).default("asc").describe(AGENT_VAULT.VARIABLE.orderDirection),+ ...agentVaultListQuery(AGENT_VAULT.VARIABLE)+ }),+ response: {+ 200: z.object({+ variables: AgentVaultVariableSchema.array(),+ totalCount: z.number().describe(AGENT_VAULT.VARIABLE.totalCount)+ })+ }},onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.OAUTH]),- handler: async (req) => {- const variables = await server.services.agentVaultVariable.listVariables({+ handler: async (req) =>+ server.services.agentVaultVariable.listVariables({projectId: req.internalAgentVaultProjectId,- ctx: actorContext(req)- });- return { variables };- }+ ctx: actorContext(req),+ ...req.query+ })});server.route({diff --git a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-dal.ts b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-dal.tsindex 73894c93b0..a96e7ee828 100644--- a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-dal.ts+++ b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-dal.ts@@ -3,6 +3,7 @@ import { Knex } from "knex";import { TDbClient } from "@app/db";import { TableName, TAgentVaultVariables } from "@app/db/schemas";import { DatabaseError } from "@app/lib/errors";+import { sanitizeSqlLikeString } from "@app/lib/fn/string";import { ormify } from "@app/lib/knex";export type TAgentVaultVariableDALFactory = ReturnType<typeof agentVaultVariableDALFactory>;@@ -10,6 +11,17 @@ export type TAgentVaultVariableDALFactory = ReturnType<typeof agentVaultVariable// accessBundleId is left over from bundle-scoped variables and no longer read, so it stays off every row.export type TAgentVaultVariable = Omit<TAgentVaultVariables, "accessBundleId">;+export type TAgentVaultVariableOrderBy = "key" | "usedBy";++export type TFindAgentVaultVariablesDTO = {+ projectId: string;+ search?: string;+ orderBy: TAgentVaultVariableOrderBy;+ orderDirection: "asc" | "desc";+ limit: number;+ offset: number;+};+export type TAgentVaultVariableValueRow = Pick<TAgentVaultVariables, "id" | "encryptedValue">;export type TAgentVaultVariableUser = {@@ -28,15 +40,52 @@ export const agentVaultVariableDALFactory = (db: TDbClient) => {const columns = VARIABLE_COLUMNS.map((column) => `${TableName.AgentVaultVariable}.${column}`);- // Reads the primary even without a tx, so a variable created a moment ago is always listed.- const findByProjectId = async (projectId: string, tx?: Knex): Promise<TAgentVaultVariable[]> => {+ // Reads the primary even without a tx, so a variable created a moment ago is always listed. usedBy counts the+ // services that use a variable, each once however many of its fields do.+ const findForList = async (+ { projectId, search, orderBy, orderDirection, limit, offset }: TFindAgentVaultVariablesDTO,+ tx?: Knex+ ): Promise<{ variables: TAgentVaultVariable[]; totalCount: number }> => {try {- return (await (tx || db)(TableName.AgentVaultVariable)- .where({ projectId })- .orderBy("key", "asc")- .select(columns)) as TAgentVaultVariable[];+ const conn = tx || db;++ const applyFilters = (query: Knex.QueryBuilder) => {+ void query.where(`${TableName.AgentVaultVariable}.projectId`, projectId);+ if (search) {+ void query.whereILike(`${TableName.AgentVaultVariable}.key`, `%${sanitizeSqlLikeString(search)}%`);+ }+ return query;+ };++ const countResult = (await applyFilters(conn(TableName.AgentVaultVariable))+ .count(`${TableName.AgentVaultVariable}.id as count`)+ .first()) as { count: string } | undefined;+ const totalCount = parseInt(countResult?.count || "0", 10);++ const usageCounts = conn(TableName.AgentVaultServiceVariableReference)+ .select("variableId")+ .countDistinct("serviceId as count")+ .groupBy("variableId")+ .as("uc");++ const pageQuery = applyFilters(conn(TableName.AgentVaultVariable))+ .leftJoin(usageCounts, function joinUsageCount() {+ this.on(db.raw(`uc."variableId" = ??.id`, [TableName.AgentVaultVariable]));+ })+ .limit(limit)+ .offset(offset)+ .select(columns);++ if (orderBy === "usedBy") {+ void pageQuery.orderByRaw(`COALESCE(uc.count, 0) ${orderDirection === "desc" ? "DESC" : "ASC"}`);+ void pageQuery.orderBy(`${TableName.AgentVaultVariable}.key`, "asc");+ } else {+ void pageQuery.orderBy(`${TableName.AgentVaultVariable}.key`, orderDirection);+ }++ return { variables: (await pageQuery) as TAgentVaultVariable[], totalCount };} catch (error) {- throw new DatabaseError({ error, name: "Find agent vault variables" });+ throw new DatabaseError({ error, name: "List agent vault variables" });}};@@ -173,7 +222,7 @@ export const agentVaultVariableDALFactory = (db: TDbClient) => {return {...orm,- findByProjectId,+ findForList,findKeysByProjectId,findByIdInProject,findByKeyInProject,diff --git a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.tsindex d38b7dce67..82b9aca58e 100644--- a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts+++ b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts@@ -24,6 +24,7 @@ import {import {TAgentVaultVariableUsedBy,TCreateVariableDTO,+ TListVariablesDTO,TUpdateVariableDTO,TVariableByIdDTO} from "./agent-vault-variable-types";@@ -84,13 +85,13 @@ export const agentVaultVariableServiceFactory = ({: `The variable '${key}' is used by the services ${names}. Remove it from those services before deleting it.`;};- const listVariables = async (dto: TAgentVaultProjectScoped) => {- await assertCanManageVariables(dto);+ const listVariables = async ({ projectId, ctx, ...query }: TListVariablesDTO) => {+ await assertCanManageVariables({ projectId, ctx });- const variables = await agentVaultVariableDAL.findByProjectId(dto.projectId);+ const { variables, totalCount } = await agentVaultVariableDAL.findForList({ projectId, ...query });const users = await agentVaultVariableDAL.findUsers(variables.map((variable) => variable.id));- return variables.map((variable) => projectVariable(variable, users));+ return { variables: variables.map((variable) => projectVariable(variable, users)), totalCount };};const createVariable = async ({ key, value, ...rest }: TCreateVariableDTO) => {diff --git a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-types.ts b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-types.tsindex b7e65ee749..852e6541ec 100644--- a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-types.ts+++ b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-types.ts@@ -1,4 +1,7 @@import { TAgentVaultProjectScoped } from "../agent-vault-access-bundle/agent-vault-access-bundle-types";+import { TFindAgentVaultVariablesDTO } from "./agent-vault-variable-dal";++export type TListVariablesDTO = TAgentVaultProjectScoped & Omit<TFindAgentVaultVariablesDTO, "projectId">;export type TCreateVariableDTO = TAgentVaultProjectScoped & { key: string; value: string };diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 2203b5dcd8..db8e45a5ee 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -4464,6 +4464,12 @@ export const AGENT_VAULT = {value: "The value the proxy puts in place of each `{{KEY}}`.",updateValue: "The value the proxy puts in place of each `{{KEY}}`. Omit to keep the stored value.",revealedValue: "The variable's value.",+ orderBy: "What to sort variables by: key, or usedBy for how many services use each one.",+ orderDirection: "Which way to sort: asc or desc.",+ search: "Match variables whose key contains this text.",+ limit: "The maximum number of variables to return.",+ offset: "How many variables to skip.",+ totalCount: "How many variables match the search, across every page.",usedBy:"The services that use this variable, across every access bundle, ordered by access bundle name and then service name. A variable in use can't be deleted.",usedById: "The ID of a service that uses this variable.",diff --git a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsxindex af08da9397..18d3e75575 100644--- a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx+++ b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx@@ -27,7 +27,7 @@ import {AgentVaultCredentialType,AgentVaultVariableReferenceField,useCreateAgentVaultService,- useListAgentVaultVariables,+ useListAllAgentVaultVariables,useUpdateAgentVaultService} from "@app/hooks/api/agentVault";import {@@ -156,7 +156,7 @@ export const ServiceSheet = ({const createService = useCreateAgentVaultService();const updateService = useUpdateAgentVaultService();- const { data: variables } = useListAgentVaultVariables(isOpen);+ const { data: variables } = useListAllAgentVaultVariables(isOpen);const variableKeys = useMemo(() => variables?.map((variable) => variable.key), [variables]);const storedKeys = useMemo(() => storedVariableKeys(service), [service]);// One dialog for every field. The request settles once the dialog has closed, not when the variable isdiff --git a/frontend/src/hooks/api/agentVault/mutations.tsx b/frontend/src/hooks/api/agentVault/mutations.tsxindex 3814a0f389..2e25e3e554 100644--- a/frontend/src/hooks/api/agentVault/mutations.tsx+++ b/frontend/src/hooks/api/agentVault/mutations.tsx@@ -414,7 +414,7 @@ export const useCreateAgentVaultVariable = () => {onSuccess: (variable) => {// Listed before the refetch lands, so a reference to it that was just inserted reads as known.queryClient.setQueryData<TAgentVaultVariable[]>(- agentVaultKeys.variables(currentOrg.id),+ agentVaultKeys.allVariables(currentOrg.id),(prev) => (prev ? [...prev, variable].sort((a, b) => a.key.localeCompare(b.key)) : prev));return invalidateVariables(queryClient, currentOrg.id);diff --git a/frontend/src/hooks/api/agentVault/queries.tsx b/frontend/src/hooks/api/agentVault/queries.tsxindex 1339b2db77..eb1d6a0ba8 100644--- a/frontend/src/hooks/api/agentVault/queries.tsx+++ b/frontend/src/hooks/api/agentVault/queries.tsx@@ -37,7 +37,8 @@ import {TListAgentVaultAccessBundlesDTO,TListAgentVaultMembersDTO,TListAgentVaultProxiesDTO,- TListAgentVaultSessionsDTO+ TListAgentVaultSessionsDTO,+ TListAgentVaultVariablesDTO} from "./types";export const fetchAgentVaultProjectId = async () => {@@ -89,6 +90,9 @@ export const agentVaultKeys = {params?: Omit<TListAgentVaultMembersDTO, "actorType">) => [...agentVaultKeys.accessBundleMembers(orgId, accessBundleId), "available", params] as const,variables: (orgId: string) => [...agentVaultKeys.all(orgId), "variables"] as const,+ variableList: (orgId: string, params: TListAgentVaultVariablesDTO) =>+ [...agentVaultKeys.variables(orgId), "list", params] as const,+ allVariables: (orgId: string) => [...agentVaultKeys.variables(orgId), "all"] as const,members: (orgId: string) => [...agentVaultKeys.all(orgId), "members"] as const,memberList: (orgId: string, params?: TListAgentVaultMembersDTO) =>[...agentVaultKeys.members(orgId), params] as const,@@ -527,16 +531,48 @@ export const useGetAgentVaultSessionLogs = (};};-export const useListAgentVaultVariables = (enabled = true) => {+type TAgentVaultVariablePage = { variables: TAgentVaultVariable[]; totalCount: number };++const fetchAgentVaultVariables = async (params: TListAgentVaultVariablesDTO) => {+ const { data } = await apiRequest.get<TAgentVaultVariablePage>("/api/v1/agent-vault/variables", {+ params+ });+ return data;+};++export const useListAgentVaultVariables = (params: TListAgentVaultVariablesDTO = {}) => {+ const { currentOrg } = useOrganization();++ return useQuery({+ queryKey: agentVaultKeys.variableList(currentOrg.id, params),+ queryFn: () => fetchAgentVaultVariables(params),+ placeholderData: (prev) => prev+ });+};++const ALL_VARIABLES_PAGE_SIZE = 100;++// Every variable, sorted by key, for suggesting and checking references, which need the whole set. The product+// caps how many there can be, so this is a handful of pages at most.+export const useListAllAgentVaultVariables = (enabled = true) => {const { currentOrg } = useOrganization();return useQuery({- queryKey: agentVaultKeys.variables(currentOrg.id),+ queryKey: agentVaultKeys.allVariables(currentOrg.id),queryFn: async () => {- const { data } = await apiRequest.get<{ variables: TAgentVaultVariable[] }>(- "/api/v1/agent-vault/variables"- );- return data.variables;+ const variables: TAgentVaultVariable[] = [];+ let totalCount = Infinity;+ while (variables.length < totalCount) {+ // eslint-disable-next-line no-await-in-loop+ const page = await fetchAgentVaultVariables({+ limit: ALL_VARIABLES_PAGE_SIZE,+ offset: variables.length+ });+ variables.push(...page.variables);+ totalCount = page.totalCount;+ if (page.variables.length < ALL_VARIABLES_PAGE_SIZE) break;+ }+ return variables;},enabled});diff --git a/frontend/src/hooks/api/agentVault/types.ts b/frontend/src/hooks/api/agentVault/types.tsindex a789c26c9e..e330bd93f8 100644--- a/frontend/src/hooks/api/agentVault/types.ts+++ b/frontend/src/hooks/api/agentVault/types.ts@@ -138,6 +138,14 @@ export type TListAgentVaultAccessBundlesDTO = Omit<TListAgentVaultProxiesDTO, "oorderBy?: "name" | "serviceCount" | "createdAt";};+export type TListAgentVaultVariablesDTO = {+ search?: string;+ orderBy?: "key" | "usedBy";+ orderDirection?: "asc" | "desc";+ limit?: number;+ offset?: number;+};+export type TListAgentVaultMembersDTO = {actorType?: AgentVaultMemberType;search?: string;diff --git a/frontend/src/pages/agent-vault/AgentVaultVariablesPage/components/VariablesCard.tsx b/frontend/src/pages/agent-vault/AgentVaultVariablesPage/components/VariablesCard.tsxindex e50f72ac11..961e943baf 100644--- a/frontend/src/pages/agent-vault/AgentVaultVariablesPage/components/VariablesCard.tsx+++ b/frontend/src/pages/agent-vault/AgentVaultVariablesPage/components/VariablesCard.tsx@@ -1,4 +1,4 @@-import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";+import { useEffect, useLayoutEffect, useRef, useState } from "react";import {ChevronDownIcon,CopyIcon,@@ -35,6 +35,7 @@ import {InputGroup,InputGroupAddon,InputGroupInput,+ Pagination,Skeleton,Table,TableBody,@@ -47,8 +48,15 @@ import {TooltipTrigger} from "@app/components/v3";import { MAX_VARIABLES, toVariableReference } from "@app/helpers/agentVaultVariables";+import {+ getUserTablePreference,+ PreferenceKey,+ setUserTablePreference+} from "@app/helpers/userTablePreferences";+import { useDebounce, useResetPageHelper } from "@app/hooks";import {useListAgentVaultVariables,+ useListAllAgentVaultVariables,useRevealAgentVaultVariableValue} from "@app/hooks/api/agentVault";import { TAgentVaultVariable } from "@app/hooks/api/agentVault/types";@@ -194,32 +202,39 @@ const TruncatedKey = ({ value }: { value: string }) => {};export const VariablesCard = () => {- const { data: variables = [], isPending } = useListAgentVaultVariables();const revealValue = useRevealAgentVaultVariableValue();const [search, setSearch] = useState("");+ const [debouncedSearch] = useDebounce(search);const [sortColumn, setSortColumn] = useState(SortColumn.Key);const [sortDirection, setSortDirection] = useState<"ascending" | "descending">("ascending");+ const [page, setPage] = useState(1);+ const [perPage, setPerPage] = useState(() =>+ getUserTablePreference("agentVaultVariablesTable", PreferenceKey.PerPage, 20)+ );const [isFormOpen, setIsFormOpen] = useState(false);const [variableToEdit, setVariableToEdit] = useState<TAgentVaultVariable | null>(null);const [variableToDelete, setVariableToDelete] = useState<TAgentVaultVariable | null>(null);const [revealed, setRevealed] = useState<Record<string, string>>({});const [revealingId, setRevealingId] = useState<string | null>(null);- const displayed = useMemo(() => {- const term = search.trim().toLowerCase();- const filtered = variables.filter((variable) => variable.key.toLowerCase().includes(term));-- const compare = (a: TAgentVaultVariable, b: TAgentVaultVariable) =>- sortColumn === SortColumn.UsedBy- ? a.usedBy.length - b.usedBy.length || a.key.localeCompare(b.key)- : a.key.localeCompare(b.key);-- const ordered = [...filtered].sort(compare);- return sortDirection === "ascending" ? ordered : ordered.reverse();- }, [variables, search, sortColumn, sortDirection]);+ const searchTerm = debouncedSearch.trim();+ const { data, isPending } = useListAgentVaultVariables({+ search: searchTerm || undefined,+ orderBy: sortColumn,+ orderDirection: sortDirection === "ascending" ? "asc" : "desc",+ limit: perPage,+ offset: (page - 1) * perPage+ });+ const displayed = data?.variables ?? [];+ const totalCount = data?.totalCount ?? 0;+ useResetPageHelper({ totalCount, offset: (page - 1) * perPage, setPage });++ // The dialog checks a new key against every key, which no single page holds.+ const { data: allVariables } = useListAllAgentVaultVariables(isFormOpen);const handleSort = (column: SortColumn, direction: "ascending" | "descending" | "none") => {+ setPage(1);if (direction === "none") {setSortColumn(SortColumn.Key);setSortDirection("ascending");@@ -281,7 +296,9 @@ export const VariablesCard = () => {}};- const isAtLimit = variables.length >= MAX_VARIABLES;+ const hasVariables = totalCount > 0 || Boolean(searchTerm);+ // A search narrows totalCount, so only an unfiltered count says whether the cap is reached.+ const isAtLimit = !searchTerm && totalCount >= MAX_VARIABLES;const openForm = (variable: TAgentVaultVariable | null) => {setVariableToEdit(variable);@@ -325,7 +342,7 @@ export const VariablesCard = () => {</CardAction></CardHeader>- {variables.length > 0 && (+ {hasVariables && (<CardContent><InputGroup><InputGroupAddon>@@ -333,7 +350,10 @@ export const VariablesCard = () => {</InputGroupAddon><InputGroupInputvalue={search}- onChange={(e) => setSearch(e.target.value)}+ onChange={(e) => {+ setSearch(e.target.value);+ setPage(1);+ }}placeholder="Search variables..."/></InputGroup>@@ -345,12 +365,12 @@ export const VariablesCard = () => {<Empty className="border"><EmptyHeader><EmptyTitle>- {variables.length === 0 ? "No variables yet" : "No variables match your search"}+ {hasVariables ? "No variables match your search" : "No variables yet"}</EmptyTitle><EmptyDescription>- {variables.length === 0- ? "Add a variable to use one value across services in any access bundle."- : "Try a different search term."}+ {hasVariables+ ? "Try a different search term."+ : "Add a variable to use one value across services in any access bundle."}</EmptyDescription></EmptyHeader></Empty>@@ -453,11 +473,27 @@ export const VariablesCard = () => {</Table>)}+ {totalCount > 0 && (+ <CardContent className="-mt-5 pt-0">+ <Pagination+ count={totalCount}+ page={page}+ perPage={perPage}+ onChangePage={setPage}+ onChangePerPage={(newPerPage) => {+ setPerPage(newPerPage);+ setPage(1);+ setUserTablePreference("agentVaultVariablesTable", PreferenceKey.PerPage, newPerPage);+ }}+ />+ </CardContent>+ )}+<VariableFormDialogisOpen={isFormOpen}onOpenChange={setIsFormOpen}variable={variableToEdit}- existingKeys={variables.map((variable) => variable.key)}+ existingKeys={allVariables?.map((variable) => variable.key) ?? []}/><DeleteVariableDialog