Skip to content

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

add a new alert to show pending requests

adilson28ce27f272d5
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index bc4e6e4044..4cc78de4fc 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -6,7 +6,7 @@ import { DragDropProvider, DragEndEvent, DragOverlay } from "@dnd-kit/react";
import { isSortable } from "@dnd-kit/react/sortable";
import { arrayMove } from "@dnd-kit/sortable";
import { useQueryClient } from "@tanstack/react-query";
-import { useNavigate, useParams, useRouter, useSearch } from "@tanstack/react-router";
+import { Link, useNavigate, useParams, useRouter, useSearch } from "@tanstack/react-router";
import { AxiosError } from "axios";
import {
ChevronDownIcon,
@@ -99,7 +99,8 @@ import {
ProjectPermissionSub,
useProject,
useProjectPermission,
- useSubscription
+ useSubscription,
+ useUser
} from "@app/context";
import {
ProjectPermissionCommitsActions,
@@ -153,6 +154,10 @@ import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";
import { useImportDopplerSecrets, useImportVaultSecrets } from "@app/hooks/api/migration";
import { ExternalMigrationImportStatus } from "@app/hooks/api/migration/types";
import { ProjectType, ProjectVersion } from "@app/hooks/api/projects/types";
+import {
+ useGetSecretApprovalRequestCount,
+ useGetSecretApprovalRequests
+} from "@app/hooks/api/secretApprovalRequest";
import { useUpdateFolderBatch } from "@app/hooks/api/secretFolders/queries";
import { PendingAction, TUpdateFolderBatchDTO } from "@app/hooks/api/secretFolders/types";
import { TSecretImport } from "@app/hooks/api/secretImports/types";
@@ -294,6 +299,19 @@ const OverviewPageContent = () => {
const { permission } = useProjectPermission();
const tableRef = useRef<HTMLDivElement>(null);
const { currentProject, projectId } = useProject();
+ const { user } = useUser();
+ const { data: approvalCount } = useGetSecretApprovalRequestCount({ projectId });
+ const pendingApprovalsCount = approvalCount?.open ?? 0;
+ const { data: openApprovalRequests } = useGetSecretApprovalRequests({
+ projectId,
+ status: "open",
+ limit: 100,
+ options: { enabled: pendingApprovalsCount > 0 }
+ });
+ const canApproveAny =
+ openApprovalRequests?.approvals?.some((req) =>
+ req.policy?.approvers?.some((a) => a.userId === user.id)
+ ) ?? false;
const isProjectV3 = currentProject?.version === ProjectVersion.V3;
const projectSlug = currentProject?.slug as string;
const [searchFilter, setSearchFilter] = useState("");
@@ -2619,6 +2637,28 @@ const OverviewPageContent = () => {
</div>
</CardHeader>
<CardContent>
+ {pendingApprovalsCount > 0 && (
+ <Alert variant="info" className="mb-6 py-1.5">
+ <AlertTitle className="flex items-center gap-3">
+ <InfoIcon className="size-4 shrink-0 text-info" />
+ <span>
+ {pendingApprovalsCount} secret change request
+ {pendingApprovalsCount === 1 ? "" : "s"} pending approval
+ {!canApproveAny && " waiting for a reviewer"}
+ </span>
+ {canApproveAny && (
+ <Link
+ to="/organizations/$orgId/projects/secret-management/$projectId/approval"
+ params={{ orgId, projectId }}
+ search={{ selectedTab: "approval-requests", requestId: "" }}
+ className="ml-auto text-white underline-offset-2 hover:underline"
+ >
+ Review
+ </Link>
+ )}
+ </AlertTitle>
+ </Alert>
+ )}
{isSingleEnvView &&
hasPathPolicies &&
// eslint-disable-next-line no-nested-ternary