Skip to content

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

remove old PAM frontend

x032205e7427f1390af
diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts
index 5e0df4a210..468192c8f8 100644
--- a/frontend/src/const/routes.ts
+++ b/frontend/src/const/routes.ts
@@ -397,46 +397,17 @@ export const ROUTE_PATHS = Object.freeze({
)
},
Pam: {
- ResourcesPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/resources/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/"
- ),
- SettingsPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/settings",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings"
- ),
SessionsPage: setRoute(
"/organizations/$orgId/projects/pam/$projectId/sessions",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/"
),
- ApprovalRequestDetailPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId"
- ),
PamSessionByIDPage: setRoute(
"/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId"
),
- PamResourceByIDPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId"
- ),
- PamAccountByIDPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId"
- ),
PamAccountAccessPage: setRoute(
"/organizations/$orgId/pam/accounts/$accountType/$accountId/access",
"/_authenticate/_inject-org-details/organizations/$orgId/pam/accounts/$accountType/$accountId/access"
- ),
-
- DiscoveryPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/discovery",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/"
- ),
- PamDiscoveryByIDPage: setRoute(
- "/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId"
)
},
Public: {
diff --git a/frontend/src/helpers/project.ts b/frontend/src/helpers/project.ts
index b2a73bb1bd..01d634390f 100644
--- a/frontend/src/helpers/project.ts
+++ b/frontend/src/helpers/project.ts
@@ -117,7 +117,7 @@ export const getProjectHomePage = (type: ProjectType, environments: ProjectEnv[]
case ProjectType.SecretScanning:
return `/organizations/$orgId/projects/${type}/$projectId/data-sources` as const;
case ProjectType.PAM:
- return `/organizations/$orgId/projects/${type}/$projectId/resources` as const;
+ return `/organizations/$orgId/projects/${type}/$projectId/sessions` as const;
default:
return `/organizations/$orgId/projects/${type}/$projectId/overview` as const;
}
diff --git a/frontend/src/hooks/api/pam/enums.ts b/frontend/src/hooks/api/pam/enums.ts
index dd8b5dcb95..be581dbf1c 100644
--- a/frontend/src/hooks/api/pam/enums.ts
+++ b/frontend/src/hooks/api/pam/enums.ts
@@ -1,4 +1,3 @@
-// Resources
export enum PamResourceType {
Postgres = "postgres",
MySQL = "mysql",
@@ -20,11 +19,12 @@ export enum PamResourceType {
Windows = "windows"
}
-export enum PamResourceOrderBy {
- Name = "name"
+export enum SessionChannelType {
+ Terminal = "terminal",
+ Exec = "exec",
+ Sftp = "sftp"
}
-// Sessions
export enum PamSessionStatus {
Starting = "starting",
Active = "active",
@@ -32,13 +32,6 @@ export enum PamSessionStatus {
Terminated = "terminated"
}
-export enum SessionChannelType {
- Terminal = "terminal",
- Exec = "exec",
- Sftp = "sftp"
-}
-
-// Account types
export enum PamAccountType {
SSH = "ssh",
Postgres = "postgres",
@@ -53,7 +46,6 @@ export enum PamAccountType {
ActiveDirectory = "active-directory"
}
-// Accounts
export enum PamAccountOrderBy {
Name = "name"
}
@@ -62,10 +54,3 @@ export enum PamAccountView {
Flat = "flat",
Nested = "nested"
}
-
-export enum PamAccountRotationStatus {
- Rotating = "rotating",
- Success = "success",
- PartialSuccess = "partial-success",
- Failed = "failed"
-}
diff --git a/frontend/src/hooks/api/pam/maps.ts b/frontend/src/hooks/api/pam/maps.ts
index e8e5e4f5ed..1f1148164b 100644
--- a/frontend/src/hooks/api/pam/maps.ts
+++ b/frontend/src/hooks/api/pam/maps.ts
@@ -23,11 +23,3 @@ export const PAM_RESOURCE_TYPE_MAP: Record<
[PamResourceType.AwsIam]: { name: "AWS IAM", image: "Amazon Web Services.png" },
[PamResourceType.Windows]: { name: "Windows Server", image: "Windows.png" }
};
-
-const PAM_ROTATION_SUPPORTED_RESOURCE_TYPES = new Set([
- PamResourceType.Postgres,
- PamResourceType.Windows
-]);
-
-export const isPamRotationSupported = (resourceType: PamResourceType) =>
- PAM_ROTATION_SUPPORTED_RESOURCE_TYPES.has(resourceType);
diff --git a/frontend/src/hooks/api/pam/mutations.tsx b/frontend/src/hooks/api/pam/mutations.tsx
index 80663b9d0d..c359600d56 100644
--- a/frontend/src/hooks/api/pam/mutations.tsx
+++ b/frontend/src/hooks/api/pam/mutations.tsx
@@ -2,408 +2,15 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { gatewayPoolsQueryKeys } from "../gateway-pools/queries";
import { pamKeys } from "./queries";
import {
- TCreatePamAccountDTO,
- TCreatePamAccountPolicyDTO,
TCreatePamFolderDTO,
- TCreatePamResourceDTO,
- TCreatePamRotationRuleDTO,
- TDeletePamAccountDTO,
- TDeletePamAccountPolicyDTO,
TDeletePamFolderDTO,
- TDeletePamResourceDTO,
- TDeletePamRotationRuleDTO,
- TPamAccount,
- TPamAccountPolicy,
TPamFolder,
- TPamResource,
- TPamRotationRule,
TPamSession,
- TReorderPamRotationRulesDTO,
- TUpdatePamAccountDTO,
- TUpdatePamAccountPolicyDTO,
- TUpdatePamFolderDTO,
- TUpdatePamResourceDTO,
- TUpdatePamRotationRuleDTO
+ TUpdatePamFolderDTO
} from "./types";
-// Resources
-export const useCreatePamResource = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceType, ...params }: TCreatePamResourceDTO) => {
- const { data } = await apiRequest.post<{ resource: TPamResource }>(
- `/api/v1/pam/resources/${resourceType}`,
- params
- );
-
- return data.resource;
- },
- onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listResources({ projectId }) });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useUpdatePamResource = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceId, resourceType, ...params }: TUpdatePamResourceDTO) => {
- const { data } = await apiRequest.patch<{ resource: TPamResource }>(
- `/api/v1/pam/resources/${resourceType}/${resourceId}`,
- params
- );
-
- return data.resource;
- },
- onSuccess: ({ projectId }, { resourceId, resourceType }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listResources({ projectId }) });
- queryClient.invalidateQueries({
- queryKey: pamKeys.getResource(resourceType, resourceId)
- });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useDeletePamResource = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceId, resourceType }: TDeletePamResourceDTO) => {
- const { data } = await apiRequest.delete<{ resource: TPamResource }>(
- `/api/v1/pam/resources/${resourceType}/${resourceId}`
- );
-
- return data.resource;
- },
- onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listResources({ projectId }) });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-// Favorites
-export type TSetPamResourceFavoriteDTO = {
- projectId: string;
- resourceId: string;
- isFavorite: boolean;
-};
-
-export const useSetPamResourceFavorite = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ projectId, resourceId, isFavorite }: TSetPamResourceFavoriteDTO) => {
- await apiRequest.put("/api/v1/pam/resources/favorites", {
- projectId,
- resourceId,
- isFavorite
- });
- },
- onMutate: async ({ projectId, resourceId, isFavorite }) => {
- await queryClient.cancelQueries({ queryKey: pamKeys.listResources({ projectId }) });
-
- const previousQueries = queryClient.getQueriesData<{
- resources: TPamResource[];
- totalCount: number;
- }>({
- queryKey: pamKeys.listResources({ projectId })
- });
-
- queryClient.setQueriesData<{ resources: TPamResource[]; totalCount: number }>(
- { queryKey: pamKeys.listResources({ projectId }) },
- (old) => {
- if (!old) return old;
- return {
- ...old,
- resources: old.resources.map((r) => (r.id === resourceId ? { ...r, isFavorite } : r))
- };
- }
- );
-
- return { previousQueries };
- },
- onError: (_err, _vars, context) => {
- context?.previousQueries.forEach(([queryKey, data]) => {
- queryClient.setQueryData(queryKey, data);
- });
- },
- onSettled: (_data, _err, { projectId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listResources({ projectId }) });
- }
- });
-};
-
-// Accounts
-export const useCreatePamAccount = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ parentType, ...params }: TCreatePamAccountDTO) => {
- const { data } = await apiRequest.post<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${parentType}`,
- params
- );
-
- return data.account;
- },
- onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listAccounts({ projectId }) });
- }
- });
-};
-
-export const useUpdatePamAccount = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ parentType, accountId, ...params }: TUpdatePamAccountDTO) => {
- const { data } = await apiRequest.patch<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${parentType}/${accountId}`,
- params
- );
-
- return data.account;
- },
- onSuccess: ({ projectId }, { accountId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listAccounts({ projectId }) });
- queryClient.invalidateQueries({ queryKey: pamKeys.getAccount(accountId) });
- }
- });
-};
-
-export const useDeletePamAccount = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ parentType, accountId }: TDeletePamAccountDTO) => {
- const { data } = await apiRequest.delete<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${parentType}/${accountId}`
- );
-
- return data.account;
- },
- onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.listAccounts({ projectId }) });
- }
- });
-};
-
-export type TAccessPamAccountDTO = {
- accountId: string;
- resourceName: string;
- accountName: string;
- projectId: string;
- duration: string;
- reason?: string;
-};
-
-export type TAccessPamAccountResponse = {
- sessionId: string;
- resourceType: string;
- metadata?: Record<string, string | undefined>;
- // AWS IAM credentials (raw STS) -- usable directly by the AWS CLI
- // and exchangeable for a federated console URL via /sessions/:id/aws-console-url
- accessKeyId?: string;
- secretAccessKey?: string;
- sessionToken?: string;
- expiresAt?: string;
- // Gateway-resource fields (Postgres, MySQL, etc.)
- relayClientCertificate?: string;
- relayClientPrivateKey?: string;
- relayServerCertificateChain?: string;
- gatewayClientCertificate?: string;
- gatewayClientPrivateKey?: string;
- gatewayServerCertificateChain?: string;
- relayHost?: string;
-};
-
-export const useAccessPamAccount = () => {
- return useMutation({
- mutationFn: async ({
- accountId,
- resourceName,
- accountName,
- projectId,
- duration,
- reason
- }: TAccessPamAccountDTO) => {
- const { data } = await apiRequest.post<TAccessPamAccountResponse>(
- "/api/v1/pam/accounts/access",
- {
- accountId,
- resourceName,
- accountName,
- projectId,
- duration,
- reason
- }
- );
-
- return data;
- }
- });
-};
-
-export type TGetAwsIamConsoleUrlDTO = {
- sessionId: string;
- projectId: string;
- accessKeyId: string;
- secretAccessKey: string;
- sessionToken: string;
-};
-
-export const useGetAwsIamConsoleUrl = () => {
- return useMutation({
- mutationFn: async ({
- sessionId,
- projectId,
- accessKeyId,
- secretAccessKey,
- sessionToken
- }: TGetAwsIamConsoleUrlDTO) => {
- const { data } = await apiRequest.post<{ consoleUrl: string }>(
- `/api/v1/pam/accounts/sessions/${sessionId}/aws-console-url`,
- { projectId, accessKeyId, secretAccessKey, sessionToken }
- );
- return data;
- }
- });
-};
-
-// Account Dependencies
-export const useTogglePamAccountDependency = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({
- accountId,
- dependencyId,
- isRotationSyncEnabled
- }: {
- accountId: string;
- dependencyId: string;
- isRotationSyncEnabled: boolean;
- }) => {
- const { data } = await apiRequest.patch(
- `/api/v1/pam/accounts/${accountId}/dependencies/${dependencyId}`,
- { isRotationSyncEnabled }
- );
-
- return data.dependency;
- },
- onSuccess: (_, { accountId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.accountDependencies(accountId) });
- queryClient.invalidateQueries({ queryKey: pamKeys.allResourceDependencies() });
- }
- });
-};
-
-export const useDeletePamAccountDependency = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({
- accountId,
- dependencyId
- }: {
- accountId: string;
- dependencyId: string;
- }) => {
- const { data } = await apiRequest.delete(
- `/api/v1/pam/accounts/${accountId}/dependencies/${dependencyId}`
- );
-
- return data.dependency;
- },
- onSuccess: (_, { accountId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.accountDependencies(accountId) });
- queryClient.invalidateQueries({ queryKey: pamKeys.allResourceDependencies() });
- }
- });
-};
-
-// Rotation Rules
-export const useCreatePamRotationRule = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceId, ...params }: TCreatePamRotationRuleDTO) => {
- const { data } = await apiRequest.post<{ rule: TPamRotationRule }>(
- `/api/v1/pam/resources/${resourceId}/rotation-rules`,
- params
- );
- return data.rule;
- },
- onSuccess: (_, { resourceId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.rotationRules(resourceId) });
- }
- });
-};
-
-export const useUpdatePamRotationRule = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceId, ruleId, ...params }: TUpdatePamRotationRuleDTO) => {
- const { data } = await apiRequest.patch<{ rule: TPamRotationRule }>(
- `/api/v1/pam/resources/${resourceId}/rotation-rules/${ruleId}`,
- params
- );
- return data.rule;
- },
- onSuccess: (_, { resourceId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.rotationRules(resourceId) });
- }
- });
-};
-
-export const useDeletePamRotationRule = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceId, ruleId }: TDeletePamRotationRuleDTO) => {
- const { data } = await apiRequest.delete<{ rule: TPamRotationRule }>(
- `/api/v1/pam/resources/${resourceId}/rotation-rules/${ruleId}`
- );
- return data.rule;
- },
- onSuccess: (_, { resourceId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.rotationRules(resourceId) });
- }
- });
-};
-
-export const useReorderPamRotationRules = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ resourceId, ruleIds }: TReorderPamRotationRulesDTO) => {
- const { data } = await apiRequest.put<{ rules: TPamRotationRule[] }>(
- `/api/v1/pam/resources/${resourceId}/rotation-rules/reorder`,
- { ruleIds }
- );
- return data.rules;
- },
- onSuccess: (_, { resourceId }) => {
- queryClient.invalidateQueries({ queryKey: pamKeys.rotationRules(resourceId) });
- }
- });
-};
-
-// Manual Rotation
-export const useManualRotateAccount = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ accountId }: { accountId: string }) => {
- const { data } = await apiRequest.post<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${accountId}/rotate`
- );
- return data.account;
- },
- onSuccess: (account) => {
- queryClient.setQueryData(pamKeys.getAccount(account.id), account);
- queryClient.invalidateQueries({
- queryKey: pamKeys.listAccounts({ projectId: account.projectId })
- });
- }
- });
-};
-
// Folders
export const useCreatePamFolder = () => {
const queryClient = useQueryClient();
@@ -468,54 +75,3 @@ export const useTerminatePamSession = () => {
}
});
};
-
-// Account Policies
-export const useCreatePamAccountPolicy = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async (params: TCreatePamAccountPolicyDTO) => {
- const { data } = await apiRequest.post<{ policy: TPamAccountPolicy }>(
- "/api/v1/pam/account-policies",
- params
- );
-
- return data.policy;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamKeys.accountPolicy() });
- }
- });
-};
-
-export const useUpdatePamAccountPolicy = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ policyId, ...params }: TUpdatePamAccountPolicyDTO) => {
- const { data } = await apiRequest.patch<{ policy: TPamAccountPolicy }>(
- `/api/v1/pam/account-policies/${policyId}`,
- params
- );
-
- return data.policy;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamKeys.accountPolicy() });
- }
- });
-};
-
-export const useDeletePamAccountPolicy = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ policyId }: TDeletePamAccountPolicyDTO) => {
- const { data } = await apiRequest.delete<{ policy: TPamAccountPolicy }>(
- `/api/v1/pam/account-policies/${policyId}`
- );
-
- return data.policy;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamKeys.accountPolicy() });
- }
- });
-};
diff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsx
index c903e5867f..0517d9a714 100644
--- a/frontend/src/hooks/api/pam/queries.tsx
+++ b/frontend/src/hooks/api/pam/queries.tsx
@@ -3,48 +3,12 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { TPamResourceOption } from "./types/resource-options";
-import { PamResourceType } from "./enums";
-import {
- TListPamAccountsDTO,
- TListPamResourcesDTO,
- TPamAccount,
- TPamAccountDependency,
- TPamAccountPolicy,
- TPamResource,
- TPamResourceDependency,
- TPamRotationRule,
- TPamSession,
- TPamSessionLogsPage
-} from "./types";
+import { TListPamAccountsDTO, TPamAccount, TPamSession, TPamSessionLogsPage } from "./types";
export const pamKeys = {
all: ["pam"] as const,
- resource: () => [...pamKeys.all, "resource"] as const,
account: () => [...pamKeys.all, "account"] as const,
- accountPolicy: () => [...pamKeys.all, "account-policy"] as const,
session: () => [...pamKeys.all, "session"] as const,
- listResourceOptions: () => [...pamKeys.resource(), "options"] as const,
- listResources: ({ projectId, ...params }: TListPamResourcesDTO) => [
- ...pamKeys.resource(),
- "list",
- projectId,
- params
- ],
- getResource: (resourceType: string, resourceId: string) => [
- ...pamKeys.resource(),
- "get",
- resourceType,
- resourceId
- ],
- listRelatedResources: (resourceId: string) => [...pamKeys.resource(), "related", resourceId],
- allResourceDependencies: () => [...pamKeys.resource(), "dependencies"] as const,
- resourceDependencies: (resourceType: string, resourceId: string) => [
- ...pamKeys.resource(),
- "dependencies",
- resourceType,
- resourceId
- ],
listAccounts: ({ projectId, ...params }: TListPamAccountsDTO) => [
...pamKeys.account(),
"list",
@@ -52,136 +16,8 @@ export const pamKeys = {
params
],
getAccount: (accountId: string) => [...pamKeys.account(), "get", accountId],
- accountDependencies: (accountId: string) => [...pamKeys.account(), "dependencies", accountId],
- rotationRules: (resourceId: string) => [...pamKeys.resource(), "rotation-rules", resourceId],
- listAccountPolicies: (projectId: string, search?: string) => [
- ...pamKeys.accountPolicy(),
- "list",
- projectId,
- { search }
- ],
getSession: (sessionId: string) => [...pamKeys.session(), "get", sessionId],
- getSessionLogs: (sessionId: string) => [...pamKeys.session(), "logs", sessionId],
- listSessions: (projectId: string) => [...pamKeys.session(), "list", projectId],
- aiInsightsModels: () => [...pamKeys.all, "ai-insights-models"] as const
-};
-
-export type TPamAiInsightsModel = { connectionApp: string; id: string; label: string };
-
-export const useGetPamAiInsightsModels = () => {
- return useQuery({
- queryKey: pamKeys.aiInsightsModels(),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ models: TPamAiInsightsModel[] }>(
- "/api/v1/pam/resources/ai-insights/models"
- );
-
- return data.models;
- }
- });
-};
-
-// Resources
-export const useListPamResourceOptions = (
- options?: Omit<
- UseQueryOptions<
- TPamResourceOption[],
- unknown,
- TPamResourceOption[],
- ReturnType<typeof pamKeys.listResourceOptions>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamKeys.listResourceOptions(),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ resourceOptions: TPamResourceOption[] }>(
- "/api/v1/pam/resources/options"
- );
-
- return data.resourceOptions;
- },
- ...options
- });
-};
-
-type TListPamResourcesResponse = {
- resources: TPamResource[];
- totalCount: number;
-};
-
-export const useListPamResources = (
- params: TListPamResourcesDTO,
- options?: Omit<
- UseQueryOptions<
- TListPamResourcesResponse,
- unknown,
- TListPamResourcesResponse,
- ReturnType<typeof pamKeys.listResources>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamKeys.listResources(params),
- queryFn: async () => {
- const { metadataFilter, filterResourceTypes, ...rest } = params;
- const { data } = await apiRequest.post<TListPamResourcesResponse>(
- "/api/v1/pam/resources/search",
- {
- ...rest,
- metadata: metadataFilter,
- filterResourceTypes: filterResourceTypes
- ?.split(",")
- .map((s) => s.trim())
- .filter(Boolean)
- }
- );
-
- return data;
- },
- placeholderData: (prev) => prev,
- ...options
- });
-};
-
-export const useGetPamResourceById = (
- resourceType?: PamResourceType,
- resourceId?: string,
- options?: Omit<
- UseQueryOptions<TPamResource, unknown, TPamResource, ReturnType<typeof pamKeys.getResource>>,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamKeys.getResource(resourceType || "", resourceId || ""),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ resource: TPamResource }>(
- `/api/v1/pam/resources/${resourceType}/${resourceId}`
- );
-
- return data.resource;
- },
- enabled: !!resourceId && !!resourceType && (options?.enabled ?? true),
- ...options
- });
-};
-
-export const useGetPamResourceDependencies = (
- resourceType?: PamResourceType,
- resourceId?: string
-) => {
- return useQuery({
- queryKey: pamKeys.resourceDependencies(resourceType || "", resourceId || ""),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ dependencies: TPamResourceDependency[] }>(
- `/api/v1/pam/resources/${resourceType}/${resourceId}/dependencies`
- );
- return data.dependencies;
- },
- enabled: !!resourceType && !!resourceId
- });
+ listSessions: (projectId: string) => [...pamKeys.session(), "list", projectId]
};
// Accounts
@@ -205,21 +41,9 @@ export const useListPamAccounts = (
return useQuery({
queryKey: pamKeys.listAccounts(params),
queryFn: async () => {
- const { metadataFilter, filterResourceIds, filterDomainIds, ...rest } = params;
const { data } = await apiRequest.post<TListPamAccountsResponse>(
"/api/v1/pam/accounts/search",
- {
- ...rest,
- metadata: metadataFilter,
- filterResourceIds: filterResourceIds
- ?.split(",")
- .map((s) => s.trim())
- .filter(Boolean),
- filterDomainIds: filterDomainIds
- ?.split(",")
- .map((s) => s.trim())
- .filter(Boolean)
- }
+ params
);
return data;
@@ -248,42 +72,6 @@ export const useGetPamAccountById = (
});
};
-export const useGetPamAccountDependencies = (accountId?: string) => {
- return useQuery({
- queryKey: pamKeys.accountDependencies(accountId!),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ dependencies: TPamAccountDependency[] }>(
- `/api/v1/pam/accounts/${accountId}/dependencies`
- );
- return data.dependencies;
- },
- enabled: !!accountId
- });
-};
-
-export type TPamAccountCredentialsResponse = {
- credentials: Record<string, unknown>;
- resourceType: string;
- accountId: string;
- accountName: string;
- resourceName: string;
- projectId: string;
-};
-
-// Rotation Rules
-export const useGetPamRotationRules = (resourceId?: string) => {
- return useQuery({
- queryKey: pamKeys.rotationRules(resourceId!),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ rules: TPamRotationRule[] }>(
- `/api/v1/pam/resources/${resourceId}/rotation-rules`
- );
- return data.rules;
- },
- enabled: !!resourceId
- });
-};
-
// Sessions
export const useGetPamSessionById = (
sessionId: string,
@@ -310,8 +98,6 @@ const LOGS_BATCH_FETCH_SIZE = 100;
const LOGS_EVENT_PAGE_SIZE = 1000;
const LOGS_POLL_INTERVAL_MS = 5000;
-// Fetch batches until we have at least targetEventCount new events or no more batches remain.
-// Returns the accumulated logs and updated cursor.
const fetchUntilEventTarget = async (
sessionId: string,
startCursor: number,
@@ -386,14 +172,13 @@ export const useGetPamSessionLogs = (sessionId: string, isActive: boolean, enabl
setHasMore(data.hasMore);
}
} catch {
- // ignore transient errors — next tick will retry
+ // ignore transient errors
}
}, LOGS_POLL_INTERVAL_MS);
return () => clearInterval(interval);
}, [sessionId, isActive, enabled]);
- // Load more: fetch the next LOGS_EVENT_PAGE_SIZE events (completed sessions only)
const loadMore = async () => {
setIsLoadingMore(true);
try {
@@ -433,31 +218,3 @@ export const useListPamSessions = (
...options
});
};
-
-// Account Policies
-export const useListPamAccountPolicies = (
- projectId: string,
- search?: string,
- options?: Omit<
- UseQueryOptions<
- TPamAccountPolicy[],
- unknown,
- TPamAccountPolicy[],
- ReturnType<typeof pamKeys.listAccountPolicies>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamKeys.listAccountPolicies(projectId, search),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ policies: TPamAccountPolicy[] }>(
- "/api/v1/pam/account-policies",
- { params: { projectId, search } }
- );
-
- return data.policies;
- },
- ...options
- });
-};
diff --git a/frontend/src/hooks/api/pam/recording-config/index.ts b/frontend/src/hooks/api/pam/recording-config/index.ts
deleted file mode 100644
index 177955438b..0000000000
--- a/frontend/src/hooks/api/pam/recording-config/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from "./mutations";
-export * from "./queries";
-export * from "./types";
diff --git a/frontend/src/hooks/api/pam/recording-config/mutations.tsx b/frontend/src/hooks/api/pam/recording-config/mutations.tsx
deleted file mode 100644
index 790389f5bc..0000000000
--- a/frontend/src/hooks/api/pam/recording-config/mutations.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import { pamRecordingConfigKeys } from "./queries";
-import { TPamRecordingConfig, TUpsertPamRecordingConfigDTO } from "./types";
-
-export const useUpsertPamRecordingConfig = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ projectId, ...body }: TUpsertPamRecordingConfigDTO) => {
- const { data } = await apiRequest.post<{
- config: TPamRecordingConfig;
- corsProbeUrl: string | null;
- }>(`/api/v1/pam/projects/${projectId}/recording-config`, body);
- return data;
- },
- onSuccess: async (_data, vars) => {
- await queryClient.invalidateQueries({
- queryKey: pamRecordingConfigKeys.byProject(vars.projectId)
- });
- }
- });
-};
-
-export const useDeletePamRecordingConfig = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ projectId }: { projectId: string }) => {
- const { data } = await apiRequest.delete<{ ok: true }>(
- `/api/v1/pam/projects/${projectId}/recording-config`
- );
- return data;
- },
- onSuccess: async (_data, vars) => {
- await queryClient.invalidateQueries({
- queryKey: pamRecordingConfigKeys.byProject(vars.projectId)
- });
- }
- });
-};
diff --git a/frontend/src/hooks/api/pam/recording-config/queries.tsx b/frontend/src/hooks/api/pam/recording-config/queries.tsx
deleted file mode 100644
index dae0c12e4e..0000000000
--- a/frontend/src/hooks/api/pam/recording-config/queries.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import { TPamRecordingConfig } from "./types";
-
-export const pamRecordingConfigKeys = {
- all: ["pam", "recording-config"] as const,
- byProject: (projectId: string) =>
- [...pamRecordingConfigKeys.all, "by-project", projectId] as const
-};
-
-export const useGetPamRecordingConfig = (projectId: string, enabled = true) =>
- useQuery({
- queryKey: pamRecordingConfigKeys.byProject(projectId),
- enabled: Boolean(projectId) && enabled,
- queryFn: async () => {
- const { data } = await apiRequest.get<{ config: TPamRecordingConfig | null }>(
- `/api/v1/pam/projects/${projectId}/recording-config`
- );
- return data.config;
- }
- });
diff --git a/frontend/src/hooks/api/pam/recording-config/types.ts b/frontend/src/hooks/api/pam/recording-config/types.ts
deleted file mode 100644
index 51d0e022d2..0000000000
--- a/frontend/src/hooks/api/pam/recording-config/types.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { TPamRecordingStorageBackend } from "../session-playback/types";
-
-export type { TPamRecordingStorageBackend };
-
-export type TPamRecordingConfig = {
- id: string;
- projectId: string;
- storageBackend: TPamRecordingStorageBackend;
- connectionId: string;
- bucket: string;
- region: string;
- keyPrefix: string | null;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TUpsertPamRecordingConfigDTO = {
- projectId: string;
- storageBackend: TPamRecordingStorageBackend;
- connectionId: string;
- bucket: string;
- region: string;
- keyPrefix?: string | null;
-};
diff --git a/frontend/src/hooks/api/pam/types/aws-iam-resource.ts b/frontend/src/hooks/api/pam/types/aws-iam-resource.ts
deleted file mode 100644
index 8cb51a0ec0..0000000000
--- a/frontend/src/hooks/api/pam/types/aws-iam-resource.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export type TAwsIamConnectionDetails = {
- roleArn: string;
-};
-
-export type TAwsIamCredentials = {
- targetRoleArn: string;
- defaultSessionDuration: number;
-};
-
-export type TAwsIamResource = Omit<TBasePamResource, "gatewayId"> & {
- resourceType: PamResourceType.AwsIam;
- gatewayId?: string | null;
- connectionDetails: TAwsIamConnectionDetails;
-};
-
-export type TAwsIamAccount = Omit<
- TBasePamAccount,
- "rotationEnabled" | "rotationIntervalSeconds" | "lastRotatedAt"
-> & {
- credentials: TAwsIamCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/base-account.ts b/frontend/src/hooks/api/pam/types/base-account.ts
deleted file mode 100644
index 0621019057..0000000000
--- a/frontend/src/hooks/api/pam/types/base-account.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { PamResourceType } from "../enums";
-
-export interface TBasePamAccount {
- id: string;
- projectId: string;
- parentType: string;
- folderId?: string | null;
- resourceId?: string | null;
- domainId?: string | null;
- resource?: {
- id: string;
- name: string;
- resourceType: PamResourceType;
- rotationCredentialsConfigured: boolean;
- } | null;
- domain?: {
- id: string;
- name: string;
- domainType: string;
- } | null;
- name: string;
- description?: string | null;
- credentialsConfigured: boolean;
- requireMfa?: boolean | null;
- requireReason?: boolean;
- lastRotatedAt?: string | null;
- lastRotationMessage?: string | null;
- rotationStatus?: string | null;
- dependencyCount?: number;
- policyId?: string | null;
- policyName?: string | null;
- metadata?: { key: string; value: string }[];
- createdAt: string;
- updatedAt: string;
-}
diff --git a/frontend/src/hooks/api/pam/types/base-resource.ts b/frontend/src/hooks/api/pam/types/base-resource.ts
deleted file mode 100644
index e208cd81ae..0000000000
--- a/frontend/src/hooks/api/pam/types/base-resource.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-export type TSessionSummaryConfig = {
- aiInsightsEnabled: boolean;
- connectionId: string;
- model: string;
-} | null;
-
-export interface TBasePamResource {
- id: string;
- projectId: string;
- name: string;
- gatewayId: string;
- gatewayPoolId?: string | null;
- domainId?: string | null;
- metadata?: { key: string; value: string }[];
- isFavorite?: boolean;
- sessionSummaryConfig?: TSessionSummaryConfig;
- createdAt: string;
- updatedAt: string;
-}
diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.ts
index 16427270c6..9b30d98f05 100644
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@ -1,48 +1,13 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- contains old PAM DTOs pending cleanup alongside new types
import { OrderByDirection } from "../../generic/types";
import {
PamAccountOrderBy,
PamAccountView,
- PamResourceOrderBy,
PamResourceType,
PamSessionStatus,
SessionChannelType
} from "../enums";
-import { TAwsIamResource } from "./aws-iam-resource";
-import { TSessionSummaryConfig } from "./base-resource";
-import { TKubernetesResource } from "./kubernetes-resource";
-import { TMongoDBResource } from "./mongodb-resource";
-import { TMsSQLResource } from "./mssql-resource";
-import { TMySQLResource } from "./mysql-resource";
-import { TOracleDBResource } from "./oracledb-resource";
-import { TPostgresResource } from "./postgres-resource";
-import { TRedisResource } from "./redis-resource";
-import { TSSHResource } from "./ssh-resource";
-import { TWindowsResource } from "./windows-server-resource";
-export * from "./aws-iam-resource";
-export * from "./kubernetes-resource";
-export * from "./mongodb-resource";
-export * from "./mssql-resource";
-export * from "./mysql-resource";
-export * from "./oracledb-resource";
-export * from "./postgres-resource";
-export * from "./redis-resource";
-export * from "./ssh-resource";
-export * from "./windows-server-resource";
-
-export type TPamResource =
- | TPostgresResource
- | TMySQLResource
- | TMsSQLResource
- | TRedisResource
- | TMongoDBResource
- | TSSHResource
- | TAwsIamResource
- | TKubernetesResource
- | TWindowsResource
- | TOracleDBResource;
+// New model types
export type TPamAccount = {
id: string;
@@ -74,7 +39,20 @@ export type TPamFolder = {
updatedAt: string;
};
+export type TPamAccountTemplate = {
+ id: string;
+ projectId: string;
+ name: string;
+ description?: string | null;
+ accountType: string;
+ accessPolicy: unknown;
+ settings: unknown;
+ createdAt: string;
+ updatedAt: string;
+};
+
// Session log types
+
export type TPamCommandLog = {
input: string;
output: string;
@@ -84,9 +62,9 @@ export type TPamCommandLog = {
export type TSessionEvent = {
timestamp: string;
eventType: "input" | "output" | "resize" | "error";
- channelType?: SessionChannelType; // Optional for backwards compatibility with existing logs
- data: string; // Base64 encoded binary data
- elapsedTime: number; // Seconds since session start (for replay)
+ channelType?: SessionChannelType;
+ data: string;
+ elapsedTime: number;
};
export type THttpRequestEvent = {
@@ -144,47 +122,14 @@ export type TPamSession = {
reason?: string | null;
};
-// Resource DTOs
-export type TListPamResourcesDTO = {
- projectId: string;
- offset?: number;
- limit?: number;
- orderBy?: PamResourceOrderBy;
- orderDirection?: OrderByDirection;
- search?: string;
- filterResourceTypes?: string;
- metadataFilter?: Array<{ key: string; value?: string }>;
-};
-
-export type TCreatePamResourceDTO = Pick<
- TPamResource,
- "name" | "connectionDetails" | "resourceType" | "projectId"
-> & {
- gatewayId?: string;
- gatewayPoolId?: string;
- domainId?: string | null;
- metadata?: { key: string; value: string }[];
-};
-
-export type { TSessionSummaryConfig };
-
-export type TUpdatePamResourceDTO = Partial<Pick<TPamResource, "name" | "connectionDetails">> & {
- resourceId: string;
- resourceType: PamResourceType;
- gatewayId?: string;
- gatewayPoolId?: string;
- domainId?: string | null;
- metadata?: { key: string; value: string }[];
- rotationAccountCredentials?: { username: string; password: string } | null;
- sessionSummaryConfig?: TSessionSummaryConfig;
-};
-
-export type TDeletePamResourceDTO = {
- resourceId: string;
- resourceType: PamResourceType;
+export type TPamSessionLogsPage = {
+ logs: TPamSessionLog[];
+ hasMore: boolean;
+ batchCount: number;
};
// Account DTOs
+
export type TListPamAccountsDTO = {
projectId: string;
accountView?: PamAccountView;
@@ -193,38 +138,8 @@ export type TListPamAccountsDTO = {
orderBy?: PamAccountOrderBy;
orderDirection?: OrderByDirection;
search?: string;
- filterResourceIds?: string;
- filterDomainIds?: string;
- metadataFilter?: Array<{ key: string; value?: string }>;
};
-export type TCreatePamAccountDTO = Pick<
- TPamAccount,
- "name" | "description" | "credentials" | "projectId" | "resourceId" | "folderId" | "requireMfa"
-> & {
- parentType: string;
- domainId?: string;
- internalMetadata?: Record<string, unknown>;
- metadata?: { key: string; value: string }[];
- policyId?: string | null;
-};
-
-export type TUpdatePamAccountDTO = Partial<
- Pick<TPamAccount, "name" | "description" | "credentials" | "requireMfa">
-> & {
- accountId: string;
- parentType: string;
- internalMetadata?: Record<string, unknown>;
- metadata?: { key: string; value: string }[];
- policyId?: string | null;
-};
-
-export type TDeletePamAccountDTO = {
- accountId: string;
- parentType: string;
-};
-
-// Folder DTOs
export type TCreatePamFolderDTO = Pick<
TPamFolder,
"name" | "description" | "parentId" | "projectId"
@@ -237,116 +152,3 @@ export type TUpdatePamFolderDTO = Partial<Pick<TPamFolder, "name" | "description
export type TDeletePamFolderDTO = {
folderId: string;
};
-
-export type TPamAccountDependency = {
- id: string;
- accountId: string;
- resourceId: string;
- dependencyType: string;
- name: string;
- displayName?: string | null;
- state?: string | null;
- data: Record<string, unknown>;
- source: string;
- isRotationSyncEnabled: boolean;
- syncStatus?: string | null;
- lastSyncedAt?: string | null;
- lastSyncMessage?: string | null;
- resourceName?: string | null;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TPamRotationRule = {
- id: string;
- resourceId: string;
- name?: string | null;
- namePattern: string;
- enabled: boolean;
- intervalSeconds?: number | null;
- priority: number;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TCreatePamRotationRuleDTO = {
- resourceId: string;
- name?: string;
- namePattern: string;
- enabled: boolean;
- intervalSeconds?: number | null;
-};
-
-export type TUpdatePamRotationRuleDTO = {
- resourceId: string;
- ruleId: string;
- name?: string | null;
- namePattern?: string;
- enabled?: boolean;
- intervalSeconds?: number | null;
-};
-
-export type TDeletePamRotationRuleDTO = {
- resourceId: string;
- ruleId: string;
-};
-
-export type TReorderPamRotationRulesDTO = {
- resourceId: string;
- ruleIds: string[];
-};
-
-export type TPamResourceDependency = TPamAccountDependency & {
- accountName: string | null;
-};
-
-export type TPamSessionLogsPage = {
- logs: TPamSessionLog[];
- hasMore: boolean;
- batchCount: number;
-};
-
-// Account Policy types
-export enum PamAccountPolicyRuleType {
- CommandBlocking = "command-blocking",
- SessionLogMasking = "session-log-masking",
- RequireReason = "require-reason"
-}
-
-export type TPamAccountPolicyRuleConfig = {
- patterns?: string[];
-};
-
-export type TPamAccountPolicyRules = Partial<
- Record<PamAccountPolicyRuleType, TPamAccountPolicyRuleConfig>
->;
-
-export type TPamAccountPolicy = {
- id: string;
- projectId: string;
- name: string;
- description?: string | null;
- rules: TPamAccountPolicyRules;
- isActive: boolean;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TCreatePamAccountPolicyDTO = {
- projectId: string;
- name: string;
- description?: string;
- rules: TPamAccountPolicyRules;
-};
-
-export type TUpdatePamAccountPolicyDTO = {
- policyId: string;
- name?: string;
- description?: string | null;
- rules?: TPamAccountPolicyRules;
- isActive?: boolean;
-};
-
-export type TDeletePamAccountPolicyDTO = {
- policyId: string;
-};
diff --git a/frontend/src/hooks/api/pam/types/kubernetes-resource.ts b/frontend/src/hooks/api/pam/types/kubernetes-resource.ts
deleted file mode 100644
index a8aa34b851..0000000000
--- a/frontend/src/hooks/api/pam/types/kubernetes-resource.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export enum KubernetesAuthMethod {
- ServiceAccountToken = "service-account-token",
- GatewayKubernetesAuth = "gateway-kubernetes-auth"
-}
-
-export type TKubernetesConnectionDetails = {
- url: string;
- sslRejectUnauthorized: boolean;
- sslCertificate?: string;
-};
-
-export type TKubernetesServiceAccountTokenCredentials = {
- authMethod: KubernetesAuthMethod.ServiceAccountToken;
- serviceAccountToken: string;
-};
-
-export type TKubernetesGatewayAuthCredentials = {
- authMethod: KubernetesAuthMethod.GatewayKubernetesAuth;
- namespace: string;
- serviceAccountName: string;
-};
-
-export type TKubernetesCredentials =
- | TKubernetesServiceAccountTokenCredentials
- | TKubernetesGatewayAuthCredentials;
-
-// Resources
-export type TKubernetesResource = TBasePamResource & {
- resourceType: PamResourceType.Kubernetes;
-} & {
- connectionDetails: TKubernetesConnectionDetails;
- rotationAccountCredentials?: TKubernetesCredentials | null;
-};
-
-// Accounts
-export type TKubernetesAccount = TBasePamAccount & {
- credentials: TKubernetesCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/mongodb-resource.ts b/frontend/src/hooks/api/pam/types/mongodb-resource.ts
deleted file mode 100644
index 1c746bd29b..0000000000
--- a/frontend/src/hooks/api/pam/types/mongodb-resource.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export type TMongoDBConnectionDetails = {
- connectionString: string;
- database: string;
- sslEnabled: boolean;
- sslRejectUnauthorized: boolean;
- sslCertificate?: string;
-};
-
-export type TMongoDBCredentials = {
- username: string;
- password: string;
-};
-
-// Resources
-export type TMongoDBResource = TBasePamResource & { resourceType: PamResourceType.MongoDB } & {
- connectionDetails: TMongoDBConnectionDetails;
-};
-
-// Accounts
-export type TMongoDBAccount = TBasePamAccount & {
- credentials: TMongoDBCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/mssql-resource.ts b/frontend/src/hooks/api/pam/types/mssql-resource.ts
deleted file mode 100644
index ce53dc307f..0000000000
--- a/frontend/src/hooks/api/pam/types/mssql-resource.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBaseSqlConnectionDetails } from "./shared/sql-resource";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export enum MsSqlAuthMethod {
- SqlLogin = "sql-login",
- Ntlm = "ntlm",
- Kerberos = "kerberos"
-}
-
-export type TMsSQLSqlLoginCredentials = {
- authMethod: MsSqlAuthMethod.SqlLogin;
- username: string;
- password: string;
-};
-
-export type TMsSQLNtlmCredentials = {
- authMethod: MsSqlAuthMethod.Ntlm;
- username: string;
- password: string;
- domain: string;
-};
-
-export type TMsSQLKerberosCredentials = {
- authMethod: MsSqlAuthMethod.Kerberos;
- username: string;
- password: string;
- realm: string;
- kdcAddress?: string;
- spn: string;
-};
-
-export type TMsSQLCredentials =
- | TMsSQLSqlLoginCredentials
- | TMsSQLNtlmCredentials
- | TMsSQLKerberosCredentials;
-
-// Resources
-export type TMsSQLResource = TBasePamResource & { resourceType: PamResourceType.MsSQL } & {
- connectionDetails: TBaseSqlConnectionDetails;
-};
-
-// Accounts
-export type TMsSQLAccount = TBasePamAccount & {
- credentials: TMsSQLCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/mysql-resource.ts b/frontend/src/hooks/api/pam/types/mysql-resource.ts
deleted file mode 100644
index f1a7c09c82..0000000000
--- a/frontend/src/hooks/api/pam/types/mysql-resource.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBaseSqlConnectionDetails, TBaseSqlCredentials } from "./shared/sql-resource";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-// Resources
-export type TMySQLResource = TBasePamResource & { resourceType: PamResourceType.MySQL } & {
- connectionDetails: TBaseSqlConnectionDetails;
-};
-
-// Accounts
-export type TMySQLAccount = TBasePamAccount & {
- credentials: TBaseSqlCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/oracledb-resource.ts b/frontend/src/hooks/api/pam/types/oracledb-resource.ts
deleted file mode 100644
index 16eba813a9..0000000000
--- a/frontend/src/hooks/api/pam/types/oracledb-resource.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBaseSqlConnectionDetails, TBaseSqlCredentials } from "./shared/sql-resource";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-// Resources
-export type TOracleDBResource = TBasePamResource & { resourceType: PamResourceType.OracleDB } & {
- connectionDetails: TBaseSqlConnectionDetails;
-};
-
-// Accounts
-export type TOracleDBAccount = TBasePamAccount & {
- credentials: TBaseSqlCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/postgres-resource.ts b/frontend/src/hooks/api/pam/types/postgres-resource.ts
deleted file mode 100644
index b1b5b74873..0000000000
--- a/frontend/src/hooks/api/pam/types/postgres-resource.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBaseSqlConnectionDetails, TBaseSqlCredentials } from "./shared/sql-resource";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-// Resources
-export type TPostgresResource = TBasePamResource & { resourceType: PamResourceType.Postgres } & {
- connectionDetails: TBaseSqlConnectionDetails;
- rotationAccountCredentials?: TBaseSqlCredentials | null;
-};
-
-// Accounts
-export type TPostgresAccount = TBasePamAccount & {
- credentials: TBaseSqlCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/redis-resource.ts b/frontend/src/hooks/api/pam/types/redis-resource.ts
deleted file mode 100644
index f3be2a2c7b..0000000000
--- a/frontend/src/hooks/api/pam/types/redis-resource.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export type TRedisConnectionDetails = {
- host: string;
- port: number;
- sslEnabled: boolean;
- sslRejectUnauthorized: boolean;
- sslCertificate?: string;
-};
-
-export type TRedisCredentials = {
- username: string;
- password: string;
-};
-
-// Resources
-export type TRedisResource = TBasePamResource & { resourceType: PamResourceType.Redis } & {
- connectionDetails: TRedisConnectionDetails;
-};
-
-// Accounts
-export type TRedisAccount = TBasePamAccount & {
- credentials: TRedisCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/resource-options.ts b/frontend/src/hooks/api/pam/types/resource-options.ts
deleted file mode 100644
index 4efb9e3b5f..0000000000
--- a/frontend/src/hooks/api/pam/types/resource-options.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { PamResourceType } from "../enums";
-
-export type TPamResourceOptionBase = {
- name: string;
-};
-
-export type TPostgresResourceOption = TPamResourceOptionBase & {
- resource: PamResourceType.Postgres;
-};
-
-export type TPamResourceOption = TPostgresResourceOption;
diff --git a/frontend/src/hooks/api/pam/types/shared/sql-resource.ts b/frontend/src/hooks/api/pam/types/shared/sql-resource.ts
deleted file mode 100644
index 1122fa5ed0..0000000000
--- a/frontend/src/hooks/api/pam/types/shared/sql-resource.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export type TBaseSqlConnectionDetails = {
- host: string;
- port: number;
- database: string;
- sslEnabled: boolean;
- sslRejectUnauthorized: boolean;
-};
-
-export type TBaseSqlCredentials = {
- username: string;
- password: string;
-};
diff --git a/frontend/src/hooks/api/pam/types/ssh-resource.ts b/frontend/src/hooks/api/pam/types/ssh-resource.ts
deleted file mode 100644
index 0ac3b5a779..0000000000
--- a/frontend/src/hooks/api/pam/types/ssh-resource.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export enum SSHAuthMethod {
- Password = "password",
- PublicKey = "public-key",
- Certificate = "certificate"
-}
-
-export type TSSHConnectionDetails = {
- host: string;
- port: number;
-};
-
-export type TSSHPasswordCredentials = {
- authMethod: SSHAuthMethod.Password;
- username: string;
- password: string;
-};
-
-export type TSSHPublicKeyCredentials = {
- authMethod: SSHAuthMethod.PublicKey;
- username: string;
- privateKey: string;
-};
-
-export type TSSHCertificateCredentials = {
- authMethod: SSHAuthMethod.Certificate;
- username: string;
-};
-
-export type TSSHCredentials =
- | TSSHPasswordCredentials
- | TSSHPublicKeyCredentials
- | TSSHCertificateCredentials;
-
-// Resources
-export type TSSHResource = TBasePamResource & { resourceType: PamResourceType.SSH } & {
- connectionDetails: TSSHConnectionDetails;
- rotationAccountCredentials?: TSSHCredentials | null;
-};
-
-// Accounts
-export type TSSHAccount = TBasePamAccount & {
- credentials: TSSHCredentials;
-};
diff --git a/frontend/src/hooks/api/pam/types/windows-server-resource.ts b/frontend/src/hooks/api/pam/types/windows-server-resource.ts
deleted file mode 100644
index b2ab6c7098..0000000000
--- a/frontend/src/hooks/api/pam/types/windows-server-resource.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
-export enum WindowsProtocol {
- RDP = "rdp"
-}
-
-export enum WindowsAccountType {
- User = "user",
- Service = "service"
-}
-
-export type TWindowsConnectionDetails = {
- protocol: WindowsProtocol.RDP;
- hostname: string;
- port: number;
-};
-
-export type TWindowsCredentials = {
- username: string;
- password: string;
-};
-
-export type TWindowsAccountMetadata = {
- accountType: WindowsAccountType;
- lastLogon?: string;
- passwordLastSet?: string;
- sid?: string;
- enabled?: boolean;
-};
-
-// Resources
-export type TWindowsResource = TBasePamResource & {
- resourceType: PamResourceType.Windows;
-} & {
- connectionDetails: TWindowsConnectionDetails;
- rotationAccountCredentials?: TWindowsCredentials | null;
-};
-
-// Accounts
-export type TWindowsAccount = TBasePamAccount & {
- credentials: TWindowsCredentials;
- internalMetadata: TWindowsAccountMetadata;
-};
diff --git a/frontend/src/hooks/api/pamDiscovery/index.tsx b/frontend/src/hooks/api/pamDiscovery/index.tsx
deleted file mode 100644
index 177955438b..0000000000
--- a/frontend/src/hooks/api/pamDiscovery/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from "./mutations";
-export * from "./queries";
-export * from "./types";
diff --git a/frontend/src/hooks/api/pamDiscovery/mutations.tsx b/frontend/src/hooks/api/pamDiscovery/mutations.tsx
deleted file mode 100644
index 296fd41c63..0000000000
--- a/frontend/src/hooks/api/pamDiscovery/mutations.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import { gatewayPoolsQueryKeys } from "../gateway-pools/queries";
-import { pamDiscoveryKeys } from "./queries";
-import {
- TCreatePamDiscoverySourceDTO,
- TDeletePamDiscoverySourceDTO,
- TPamDiscoverySource,
- TTriggerPamDiscoveryScanDTO,
- TUpdatePamDiscoverySourceDTO
-} from "./types";
-
-export const useCreatePamDiscoverySource = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ discoveryType, ...dto }: TCreatePamDiscoverySourceDTO) => {
- const { data } = await apiRequest.post<{ source: TPamDiscoverySource }>(
- `/api/v1/pam/discovery-sources/${discoveryType}`,
- dto
- );
- return data.source;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDiscoveryKeys.sources() });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useUpdatePamDiscoverySource = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({
- discoverySourceId,
- discoveryType,
- ...dto
- }: TUpdatePamDiscoverySourceDTO) => {
- const { data } = await apiRequest.patch<{ source: TPamDiscoverySource }>(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}`,
- dto
- );
- return data.source;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDiscoveryKeys.all });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useDeletePamDiscoverySource = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ discoverySourceId, discoveryType }: TDeletePamDiscoverySourceDTO) => {
- const { data } = await apiRequest.delete(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}`
- );
- return data;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDiscoveryKeys.sources() });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useTriggerPamDiscoveryScan = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ discoverySourceId, discoveryType }: TTriggerPamDiscoveryScanDTO) => {
- const { data } = await apiRequest.post(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}/scan`
- );
- return data;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDiscoveryKeys.all });
- }
- });
-};
diff --git a/frontend/src/hooks/api/pamDiscovery/queries.tsx b/frontend/src/hooks/api/pamDiscovery/queries.tsx
deleted file mode 100644
index 4b3dd10605..0000000000
--- a/frontend/src/hooks/api/pamDiscovery/queries.tsx
+++ /dev/null
@@ -1,202 +0,0 @@
-import { useQuery, UseQueryOptions } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import {
- PamDiscoveryType,
- TDiscoveredAccount,
- TDiscoveredResource,
- TListPamDiscoverySourcesDTO,
- TPamDiscoverySource,
- TPamDiscoverySourceOption,
- TPamDiscoverySourceRun
-} from "./types";
-
-export const pamDiscoveryKeys = {
- all: ["pam-discovery"] as const,
- options: () => [...pamDiscoveryKeys.all, "options"] as const,
- sources: () => [...pamDiscoveryKeys.all, "sources"] as const,
- listSources: (params: TListPamDiscoverySourcesDTO) =>
- [...pamDiscoveryKeys.sources(), "list", params] as const,
- getSource: (discoverySourceId: string) =>
- [...pamDiscoveryKeys.sources(), "get", discoverySourceId] as const,
- runs: (discoverySourceId: string) =>
- [...pamDiscoveryKeys.all, "runs", discoverySourceId] as const,
- listRuns: (discoverySourceId: string, params: { offset?: number; limit?: number }) =>
- [...pamDiscoveryKeys.runs(discoverySourceId), "list", params] as const,
- getRun: (discoverySourceId: string, runId: string) =>
- [...pamDiscoveryKeys.runs(discoverySourceId), "get", runId] as const,
- discoveredResources: (discoverySourceId: string, params: { offset?: number; limit?: number }) =>
- [...pamDiscoveryKeys.all, "discovered-resources", discoverySourceId, params] as const,
- discoveredAccounts: (discoverySourceId: string, params: { offset?: number; limit?: number }) =>
- [...pamDiscoveryKeys.all, "discovered-accounts", discoverySourceId, params] as const
-};
-
-export const useListPamDiscoverySourceOptions = (
- options?: Omit<
- UseQueryOptions<
- TPamDiscoverySourceOption[],
- unknown,
- TPamDiscoverySourceOption[],
- ReturnType<typeof pamDiscoveryKeys.options>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamDiscoveryKeys.options(),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ discoveryOptions: TPamDiscoverySourceOption[] }>(
- "/api/v1/pam/discovery-sources/options"
- );
- return data.discoveryOptions;
- },
- ...options
- });
-};
-
-type TListSourcesResponse = { sources: TPamDiscoverySource[]; totalCount: number };
-
-export const useListPamDiscoverySources = (
- params: TListPamDiscoverySourcesDTO,
- options?: Omit<
- UseQueryOptions<
- TListSourcesResponse,
- unknown,
- TListSourcesResponse,
- ReturnType<typeof pamDiscoveryKeys.listSources>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamDiscoveryKeys.listSources(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TListSourcesResponse>("/api/v1/pam/discovery-sources", {
- params
- });
- return data;
- },
- placeholderData: (prev) => prev,
- ...options
- });
-};
-
-export const useGetPamDiscoverySource = (
- discoverySourceId: string,
- discoveryType: PamDiscoveryType,
- options?: Omit<
- UseQueryOptions<
- TPamDiscoverySource,
- unknown,
- TPamDiscoverySource,
- ReturnType<typeof pamDiscoveryKeys.getSource>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamDiscoveryKeys.getSource(discoverySourceId),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ source: TPamDiscoverySource }>(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}`
- );
- return data.source;
- },
- enabled: !!discoverySourceId && !!discoveryType && (options?.enabled ?? true),
- ...options
- });
-};
-
-type TListRunsResponse = { runs: TPamDiscoverySourceRun[]; totalCount: number };
-
-export const useListPamDiscoverySourceRuns = (
- discoverySourceId: string,
- discoveryType: PamDiscoveryType,
- params: { offset?: number; limit?: number },
- options?: Omit<
- UseQueryOptions<
- TListRunsResponse,
- unknown,
- TListRunsResponse,
- ReturnType<typeof pamDiscoveryKeys.listRuns>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamDiscoveryKeys.listRuns(discoverySourceId, params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TListRunsResponse>(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}/runs`,
- { params }
- );
- return data;
- },
- enabled: !!discoverySourceId && !!discoveryType && (options?.enabled ?? true),
- placeholderData: (prev) => prev,
- ...options
- });
-};
-
-type TListDiscoveredResourcesResponse = { resources: TDiscoveredResource[]; totalCount: number };
-
-export const useGetDiscoveredResources = (
- discoverySourceId: string,
- discoveryType: PamDiscoveryType,
- params: { offset?: number; limit?: number },
- options?: Omit<
- UseQueryOptions<
- TListDiscoveredResourcesResponse,
- unknown,
- TListDiscoveredResourcesResponse,
- ReturnType<typeof pamDiscoveryKeys.discoveredResources>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamDiscoveryKeys.discoveredResources(discoverySourceId, params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TListDiscoveredResourcesResponse>(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}/resources`,
- { params }
- );
- return data;
- },
- enabled: !!discoverySourceId && !!discoveryType && (options?.enabled ?? true),
- placeholderData: (prev) => prev,
- ...options
- });
-};
-
-type TListDiscoveredAccountsResponse = { accounts: TDiscoveredAccount[]; totalCount: number };
-
-export const useGetDiscoveredAccounts = (
- discoverySourceId: string,
- discoveryType: PamDiscoveryType,
- params: { offset?: number; limit?: number },
- options?: Omit<
- UseQueryOptions<
- TListDiscoveredAccountsResponse,
- unknown,
- TListDiscoveredAccountsResponse,
- ReturnType<typeof pamDiscoveryKeys.discoveredAccounts>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamDiscoveryKeys.discoveredAccounts(discoverySourceId, params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TListDiscoveredAccountsResponse>(
- `/api/v1/pam/discovery-sources/${discoveryType}/${discoverySourceId}/accounts`,
- { params }
- );
- return data;
- },
- enabled: !!discoverySourceId && !!discoveryType && (options?.enabled ?? true),
- placeholderData: (prev) => prev,
- ...options
- });
-};
diff --git a/frontend/src/hooks/api/pamDiscovery/types.ts b/frontend/src/hooks/api/pamDiscovery/types.ts
deleted file mode 100644
index 7aa4ee5ae2..0000000000
--- a/frontend/src/hooks/api/pamDiscovery/types.ts
+++ /dev/null
@@ -1,146 +0,0 @@
-export enum PamDiscoveryType {
- ActiveDirectory = "active-directory"
-}
-
-export const PAM_DISCOVERY_TYPE_MAP: Record<PamDiscoveryType, { name: string; image: string }> = {
- [PamDiscoveryType.ActiveDirectory]: { name: "Active Directory", image: "ActiveDirectory.png" }
-};
-
-export type TPamDiscoverySourceOption = {
- name: string;
- discoveryType: PamDiscoveryType;
-};
-
-export type TPamDiscoverySource = {
- id: string;
- projectId: string;
- name: string;
- discoveryType: PamDiscoveryType;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- discoveryConfiguration?: Record<string, unknown>;
- discoveryCredentials?: Record<string, unknown>;
- schedule?: string | null;
- lastRunAt?: string | null;
- status: string;
- totalResources: number;
- totalAccounts: number;
- totalDependencies: number;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TPamDiscoverySourceRunProgress = {
- adEnumeration?: {
- status: "running" | "completed" | "failed";
- completedAt?: string;
- error?: string;
- };
- machineEnumeration?: {
- status: "running" | "completed" | "failed" | "skipped";
- totalMachines?: number;
- scannedMachines?: number;
- failedMachines?: number;
- statusMessage?: string;
- };
- machineErrors?: Record<string, string>;
-};
-
-export type TPamDiscoverySourceRun = {
- id: string;
- discoverySourceId: string;
- status: string;
- triggeredBy: string;
- resourcesDiscoveredCount: number;
- accountsDiscoveredCount: number;
- dependenciesDiscoveredCount: number;
- newResourcesCount: number;
- staleResourcesCount: number;
- newAccountsCount: number;
- staleAccountsCount: number;
- newDependenciesCount: number;
- staleDependenciesCount: number;
- progress?: TPamDiscoverySourceRunProgress;
- errorMessage?: string | null;
- startedAt?: string | null;
- completedAt?: string | null;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TDiscoveredResource = {
- id: string;
- resourceId: string;
- resourceName: string;
- resourceType: string;
- lastDiscoveredAt: string;
- isStale: boolean;
- createdAt: string;
- resourceInternalMetadata?: {
- osVersion?: string;
- osVersionDetail?: string;
- };
- dependencyCount?: number;
-};
-
-export type TDiscoveredAccountMetadata = {
- accountType?: string;
- adGuid?: string;
- displayName?: string;
- userPrincipalName?: string;
- lastLogon?: string;
-};
-
-export type TDiscoveredAccount = {
- id: string;
- accountId: string;
- accountName: string;
- resourceId: string;
- resourceName: string;
- resourceType: string;
- lastDiscoveredAt: string;
- isStale: boolean;
- internalMetadata?: TDiscoveredAccountMetadata;
- dependencyCount?: number;
- createdAt: string;
-};
-
-export type TListPamDiscoverySourcesDTO = {
- projectId: string;
- offset?: number;
- limit?: number;
- search?: string;
-};
-
-export type TCreatePamDiscoverySourceDTO = {
- projectId: string;
- name: string;
- discoveryType: PamDiscoveryType;
- gatewayId?: string;
- gatewayPoolId?: string;
- discoveryCredentials: Record<string, unknown>;
- discoveryConfiguration: Record<string, unknown>;
- schedule?: string;
-};
-
-export type TUpdatePamDiscoverySourceDTO = {
- discoverySourceId: string;
- discoveryType: PamDiscoveryType;
- name?: string;
- gatewayId?: string;
- gatewayPoolId?: string;
- discoveryCredentials?: Record<string, unknown>;
- discoveryConfiguration?: Record<string, unknown>;
- schedule?: string;
- status?: string;
-};
-
-export type TDeletePamDiscoverySourceDTO = {
- discoverySourceId: string;
- discoveryType: PamDiscoveryType;
-};
-
-export type TTriggerPamDiscoveryScanDTO = {
- discoverySourceId: string;
- discoveryType: PamDiscoveryType;
-};
diff --git a/frontend/src/hooks/api/pamDomain/active-directory-types.ts b/frontend/src/hooks/api/pamDomain/active-directory-types.ts
deleted file mode 100644
index 5a8a26c90a..0000000000
--- a/frontend/src/hooks/api/pamDomain/active-directory-types.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-export enum ActiveDirectoryAccountType {
- User = "user",
- Service = "service"
-}
-
-export type TActiveDirectoryConnectionDetails = {
- domain: string;
- dcAddress: string;
- port: number;
- useLdaps: boolean;
- ldapRejectUnauthorized: boolean;
- ldapCaCert?: string;
- ldapTlsServerName?: string;
-};
-
-export type TActiveDirectoryCredentials = {
- username: string;
- password: string;
-};
-
-export type TActiveDirectoryAccountInternalMetadata = {
- accountType: ActiveDirectoryAccountType;
- adGuid?: string;
- userPrincipalName?: string;
- passwordLastSet?: string;
- lastLogon?: string;
-};
-
-export type TActiveDirectoryAccount = {
- id: string;
- name: string;
- description?: string | null;
- projectId: string;
- resourceId?: string | null;
- domainId?: string | null;
- folderId?: string | null;
- requireMfa: boolean;
- createdAt: string;
- updatedAt: string;
- credentials: TActiveDirectoryCredentials;
- internalMetadata: TActiveDirectoryAccountInternalMetadata;
-};
diff --git a/frontend/src/hooks/api/pamDomain/enums.ts b/frontend/src/hooks/api/pamDomain/enums.ts
deleted file mode 100644
index 03fcd18cad..0000000000
--- a/frontend/src/hooks/api/pamDomain/enums.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export enum PamDomainType {
- ActiveDirectory = "active-directory"
-}
-
-export enum PamDomainOrderBy {
- Name = "name"
-}
diff --git a/frontend/src/hooks/api/pamDomain/index.ts b/frontend/src/hooks/api/pamDomain/index.ts
deleted file mode 100644
index 01197819d0..0000000000
--- a/frontend/src/hooks/api/pamDomain/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export * from "./active-directory-types";
-export * from "./enums";
-export * from "./maps";
-export * from "./mutations";
-export * from "./queries";
-export * from "./types";
diff --git a/frontend/src/hooks/api/pamDomain/maps.ts b/frontend/src/hooks/api/pamDomain/maps.ts
deleted file mode 100644
index b64baec606..0000000000
--- a/frontend/src/hooks/api/pamDomain/maps.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { PamDomainType } from "./enums";
-
-export const PAM_DOMAIN_TYPE_MAP: Record<PamDomainType, { name: string; image: string }> = {
- [PamDomainType.ActiveDirectory]: {
- name: "Active Directory",
- image: "ActiveDirectory.png"
- }
-};
diff --git a/frontend/src/hooks/api/pamDomain/mutations.tsx b/frontend/src/hooks/api/pamDomain/mutations.tsx
deleted file mode 100644
index da29c6ce91..0000000000
--- a/frontend/src/hooks/api/pamDomain/mutations.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import { gatewayPoolsQueryKeys } from "../gateway-pools/queries";
-import { pamDomainKeys } from "./queries";
-import { TCreatePamDomainDTO, TDeletePamDomainDTO, TPamDomain, TUpdatePamDomainDTO } from "./types";
-
-export const useCreatePamDomain = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ domainType, ...body }: TCreatePamDomainDTO) => {
- const { data } = await apiRequest.post<{ domain: TPamDomain }>(
- `/api/v1/pam/domains/${domainType}`,
- body
- );
- return data.domain;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDomainKeys.domain() });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useUpdatePamDomain = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ domainType, domainId, ...body }: TUpdatePamDomainDTO) => {
- const { data } = await apiRequest.patch<{ domain: TPamDomain }>(
- `/api/v1/pam/domains/${domainType}/${domainId}`,
- body
- );
- return data.domain;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDomainKeys.domain() });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
-
-export const useDeletePamDomain = () => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async ({ domainType, domainId }: TDeletePamDomainDTO) => {
- const { data } = await apiRequest.delete<{ domain: TPamDomain }>(
- `/api/v1/pam/domains/${domainType}/${domainId}`
- );
- return data.domain;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: pamDomainKeys.domain() });
- queryClient.invalidateQueries({ queryKey: gatewayPoolsQueryKeys.allKey() });
- }
- });
-};
diff --git a/frontend/src/hooks/api/pamDomain/queries.tsx b/frontend/src/hooks/api/pamDomain/queries.tsx
deleted file mode 100644
index 514efec387..0000000000
--- a/frontend/src/hooks/api/pamDomain/queries.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { useQuery, UseQueryOptions } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import { PamDomainType } from "./enums";
-import { TListPamDomainsDTO, TPamDomain, TPamDomainRelatedResource } from "./types";
-
-export const pamDomainKeys = {
- all: ["pam-domain"] as const,
- domain: () => [...pamDomainKeys.all, "domain"] as const,
- listDomainOptions: () => [...pamDomainKeys.domain(), "options"] as const,
- listDomains: ({ projectId, ...params }: TListPamDomainsDTO) => [
- ...pamDomainKeys.domain(),
- "list",
- projectId,
- params
- ],
- getDomain: (domainType: string, domainId: string) => [
- ...pamDomainKeys.domain(),
- "get",
- domainType,
- domainId
- ],
- listRelatedResources: (domainId: string) => [...pamDomainKeys.domain(), "related", domainId]
-};
-
-export const useListPamDomainOptions = () => {
- return useQuery({
- queryKey: pamDomainKeys.listDomainOptions(),
- queryFn: async () => {
- const { data } = await apiRequest.get<{
- options: Array<{ name: string; domain: string }>;
- }>("/api/v1/pam/domains/options");
-
- return data.options;
- }
- });
-};
-
-export const useListPamDomains = (params: TListPamDomainsDTO) => {
- return useQuery({
- queryKey: pamDomainKeys.listDomains(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<{
- domains: TPamDomain[];
- totalCount: number;
- }>("/api/v1/pam/domains", { params });
- return data;
- },
- enabled: !!params.projectId
- });
-};
-
-export const useGetPamDomainById = (
- domainType: PamDomainType | string,
- domainId: string | undefined,
- options?: Omit<UseQueryOptions<TPamDomain>, "queryKey" | "queryFn">
-) => {
- return useQuery({
- queryKey: pamDomainKeys.getDomain(domainType, domainId || ""),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ domain: TPamDomain }>(
- `/api/v1/pam/domains/${domainType}/${domainId}`
- );
- return data.domain;
- },
- enabled: !!domainId && !!domainType,
- retry: 5,
- ...options
- });
-};
-
-export const useListDomainRelatedResources = (
- domainType: PamDomainType | string,
- domainId: string | undefined,
- options?: Omit<UseQueryOptions<TPamDomainRelatedResource[]>, "queryKey" | "queryFn">
-) => {
- return useQuery({
- queryKey: pamDomainKeys.listRelatedResources(domainId || ""),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ resources: TPamDomainRelatedResource[] }>(
- `/api/v1/pam/domains/${domainType}/${domainId}/related-resources`
- );
- return data.resources;
- },
- enabled: !!domainId && !!domainType,
- ...options
- });
-};
diff --git a/frontend/src/hooks/api/pamDomain/types.ts b/frontend/src/hooks/api/pamDomain/types.ts
deleted file mode 100644
index fd9342cc09..0000000000
--- a/frontend/src/hooks/api/pamDomain/types.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { TActiveDirectoryConnectionDetails } from "./active-directory-types";
-import { PamDomainType } from "./enums";
-
-export type TBasePamDomain = {
- id: string;
- projectId: string;
- name: string;
- domainType: PamDomainType;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- createdAt: string;
- updatedAt: string;
- metadata?: Array<{ id: string; key: string; value: string }>;
-};
-
-export type TActiveDirectoryDomain = TBasePamDomain & {
- domainType: PamDomainType.ActiveDirectory;
- connectionDetails: TActiveDirectoryConnectionDetails;
-};
-
-export type TPamDomain = TActiveDirectoryDomain;
-
-export type TListPamDomainsDTO = {
- projectId: string;
- search?: string;
- limit?: number;
- offset?: number;
- orderBy?: string;
- orderDirection?: "asc" | "desc";
- filterDomainTypes?: string;
- discoveryFingerprint?: string;
-};
-
-export type TCreatePamDomainDTO = {
- domainType: PamDomainType;
- projectId: string;
- name: string;
- gatewayId?: string;
- gatewayPoolId?: string;
- connectionDetails: TActiveDirectoryConnectionDetails;
- metadata?: Array<{ key: string; value?: string }>;
-};
-
-export type TUpdatePamDomainDTO = {
- domainType: PamDomainType;
- domainId: string;
- name?: string;
- gatewayId?: string;
- gatewayPoolId?: string;
- connectionDetails?: TActiveDirectoryConnectionDetails;
- metadata?: Array<{ key: string; value?: string }>;
-};
-
-export type TDeletePamDomainDTO = {
- domainType: PamDomainType;
- domainId: string;
-};
-
-export type TPamDomainRelatedResource = {
- id: string;
- name: string;
- resourceType: string;
- projectId: string;
-};
diff --git a/frontend/src/hooks/api/pamInsights/index.ts b/frontend/src/hooks/api/pamInsights/index.ts
deleted file mode 100644
index 50958da78a..0000000000
--- a/frontend/src/hooks/api/pamInsights/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export {
- pamInsightsKeys,
- useGetPamInsightsSummary,
- useGetPamResourceBreakdown,
- useGetPamRotationCalendar,
- useGetPamSessionActivity,
- useGetPamTopActors
-} from "./queries";
-export type {
- TGetPamInsightsParams,
- TGetPamRotationCalendarParams,
- TPamInsightsSummary,
- TPamResourceBreakdownEntry,
- TPamResourceBreakdownResponse,
- TPamRotationCalendarEvent,
- TPamRotationCalendarResponse,
- TPamSessionActivityDay,
- TPamSessionActivityResponse,
- TPamTopActor,
- TPamTopActorsResponse
-} from "./types";
diff --git a/frontend/src/hooks/api/pamInsights/queries.tsx b/frontend/src/hooks/api/pamInsights/queries.tsx
deleted file mode 100644
index eade828ac4..0000000000
--- a/frontend/src/hooks/api/pamInsights/queries.tsx
+++ /dev/null
@@ -1,157 +0,0 @@
-import { useQuery, UseQueryOptions } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import {
- TGetPamInsightsParams,
- TGetPamRotationCalendarParams,
- TPamInsightsSummary,
- TPamResourceBreakdownResponse,
- TPamRotationCalendarResponse,
- TPamSessionActivityResponse,
- TPamTopActorsResponse
-} from "./types";
-
-export const pamInsightsKeys = {
- all: () => ["pam-insights"] as const,
- summary: (params: TGetPamInsightsParams) =>
- [...pamInsightsKeys.all(), "summary", params] as const,
- sessionActivity: (params: TGetPamInsightsParams) =>
- [...pamInsightsKeys.all(), "session-activity", params] as const,
- topActors: (params: TGetPamInsightsParams) =>
- [...pamInsightsKeys.all(), "top-actors", params] as const,
- resourceBreakdown: (params: TGetPamInsightsParams) =>
- [...pamInsightsKeys.all(), "resource-breakdown", params] as const,
- rotationCalendar: (params: TGetPamRotationCalendarParams) =>
- [...pamInsightsKeys.all(), "rotation-calendar", params] as const
-};
-
-const PAM_INSIGHTS_STALE_TIME = 5 * 60 * 1000;
-const PAM_INSIGHTS_SUMMARY_REFETCH_INTERVAL = 15 * 1000;
-
-export const useGetPamInsightsSummary = (
- params: TGetPamInsightsParams,
- options?: Omit<
- UseQueryOptions<
- TPamInsightsSummary,
- unknown,
- TPamInsightsSummary,
- ReturnType<typeof pamInsightsKeys.summary>
- >,
- "queryKey" | "queryFn"
- >
-) =>
- useQuery({
- queryKey: pamInsightsKeys.summary(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TPamInsightsSummary>("/api/v1/insights/pam/summary", {
- params
- });
- return data;
- },
- staleTime: 0,
- refetchInterval: PAM_INSIGHTS_SUMMARY_REFETCH_INTERVAL,
- ...options
- });
-
-export const useGetPamSessionActivity = (
- params: TGetPamInsightsParams,
- options?: Omit<
- UseQueryOptions<
- TPamSessionActivityResponse,
- unknown,
- TPamSessionActivityResponse,
- ReturnType<typeof pamInsightsKeys.sessionActivity>
- >,
- "queryKey" | "queryFn"
- >
-) =>
- useQuery({
- queryKey: pamInsightsKeys.sessionActivity(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TPamSessionActivityResponse>(
- "/api/v1/insights/pam/session-activity",
- { params }
- );
- return data;
- },
- staleTime: PAM_INSIGHTS_STALE_TIME,
- ...options
- });
-
-export const useGetPamTopActors = (
- params: TGetPamInsightsParams,
- options?: Omit<
- UseQueryOptions<
- TPamTopActorsResponse,
- unknown,
- TPamTopActorsResponse,
- ReturnType<typeof pamInsightsKeys.topActors>
- >,
- "queryKey" | "queryFn"
- >
-) =>
- useQuery({
- queryKey: pamInsightsKeys.topActors(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TPamTopActorsResponse>(
- "/api/v1/insights/pam/top-actors",
- {
- params
- }
- );
- return data;
- },
- staleTime: PAM_INSIGHTS_STALE_TIME,
- ...options
- });
-
-export const useGetPamResourceBreakdown = (
- params: TGetPamInsightsParams,
- options?: Omit<
- UseQueryOptions<
- TPamResourceBreakdownResponse,
- unknown,
- TPamResourceBreakdownResponse,
- ReturnType<typeof pamInsightsKeys.resourceBreakdown>
- >,
- "queryKey" | "queryFn"
- >
-) =>
- useQuery({
- queryKey: pamInsightsKeys.resourceBreakdown(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TPamResourceBreakdownResponse>(
- "/api/v1/insights/pam/resource-breakdown",
- { params }
- );
- return data;
- },
- staleTime: PAM_INSIGHTS_STALE_TIME,
- ...options
- });
-
-export const useGetPamRotationCalendar = (
- params: TGetPamRotationCalendarParams,
- options?: Omit<
- UseQueryOptions<
- TPamRotationCalendarResponse,
- unknown,
- TPamRotationCalendarResponse,
- ReturnType<typeof pamInsightsKeys.rotationCalendar>
- >,
- "queryKey" | "queryFn"
- >
-) =>
- useQuery({
- queryKey: pamInsightsKeys.rotationCalendar(params),
- queryFn: async () => {
- const { data } = await apiRequest.get<TPamRotationCalendarResponse>(
- "/api/v1/insights/pam/rotation-calendar",
- { params }
- );
- return data;
- },
- staleTime: PAM_INSIGHTS_STALE_TIME,
- ...options
- });
diff --git a/frontend/src/hooks/api/pamInsights/types.ts b/frontend/src/hooks/api/pamInsights/types.ts
deleted file mode 100644
index f35212f1d1..0000000000
--- a/frontend/src/hooks/api/pamInsights/types.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-export type TGetPamInsightsParams = {
- projectId: string;
-};
-
-export type TPamFailedRotationAccount = {
- accountId: string;
- accountName: string;
- resourceId: string;
- resourceName: string;
- resourceType: string;
- lastRotatedAt: string | null;
-};
-
-export type TPamInsightsSummary = {
- totalResources: number;
- resourcesWithRotation: number;
- totalAccounts: number;
- failedRotations: number;
- failedRotationAccounts: TPamFailedRotationAccount[];
- activeSessions: number;
- resourceTypeCount: number;
-};
-
-export type TPamSessionActivityDay = {
- date: string;
- count: number;
-};
-
-export type TPamSessionActivityResponse = {
- days: TPamSessionActivityDay[];
- avgPerDay: number;
-};
-
-export type TPamTopActor = {
- actorName: string;
- actorEmail: string;
- sessionCount: number;
- isService: boolean;
-};
-
-export type TPamTopActorsResponse = {
- actors: TPamTopActor[];
-};
-
-export type TPamResourceBreakdownEntry = {
- resourceType: string;
- resourceCount: number;
-};
-
-export type TPamResourceBreakdownResponse = {
- breakdown: TPamResourceBreakdownEntry[];
-};
-
-export type TPamRotationCalendarEvent = {
- id: string;
- accountId: string;
- accountName: string;
- resourceId: string;
- resourceName: string;
- resourceType: string;
- intervalSeconds: number;
- nextRotationAt: string;
-};
-
-export type TPamRotationCalendarResponse = {
- rotations: TPamRotationCalendarEvent[];
-};
-
-export type TGetPamRotationCalendarParams = {
- projectId: string;
- month: number;
- year: number;
-};
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx
index 24b9b08c33..e7ed115b4c 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx
@@ -1,38 +1,12 @@
-import {
- ActivityIcon,
- BookCheck,
- Database,
- FileText,
- Globe,
- ScrollText,
- Search,
- Settings,
- Shield,
- Video
-} from "lucide-react";
+import { FileText, Shield, Video } from "lucide-react";
import { ProjectNavList } from "./ProjectNavLink";
-import {
- PAM_APPROVALS_SUBMENU,
- PAM_SETTINGS_SUBMENU,
- PROJECT_ACCESS_CONTROL_SUBMENU
-} from "./submenus";
+import { PROJECT_ACCESS_CONTROL_SUBMENU } from "./submenus";
import type { NavItem, Submenu } from "./types";
export const PamNav = ({ onSubmenuOpen }: { onSubmenuOpen: (submenu: Submenu) => void }) => {
const items: NavItem[] = [
- { label: "Resources", icon: Database, pathSuffix: "resources" },
- { label: "Discovery", icon: Search, pathSuffix: "discovery", activeMatch: /\/discovery\// },
{ label: "Sessions", icon: Video, pathSuffix: "sessions" },
- { label: "Domains", icon: Globe, pathSuffix: "domains" },
- { label: "Account Policies", icon: ScrollText, pathSuffix: "account-policies" },
- {
- label: "Approvals",
- icon: BookCheck,
- pathSuffix: "approvals",
- activeMatch: /\/approvals\//,
- submenu: PAM_APPROVALS_SUBMENU
- },
{
label: "Access Control",
icon: Shield,
@@ -40,14 +14,7 @@ export const PamNav = ({ onSubmenuOpen }: { onSubmenuOpen: (submenu: Submenu) =>
activeMatch: /\/groups\/|\/identities\/|\/members\/|\/roles\//,
submenu: PROJECT_ACCESS_CONTROL_SUBMENU
},
- { label: "Insights", icon: ActivityIcon, pathSuffix: "insights" },
- { label: "Audit Logs", icon: FileText, pathSuffix: "audit-logs" },
- {
- label: "Settings",
- icon: Settings,
- pathSuffix: "settings",
- submenu: PAM_SETTINGS_SUBMENU
- }
+ { label: "Audit Logs", icon: FileText, pathSuffix: "audit-logs" }
];
return <ProjectNavList items={items} onSubmenuOpen={onSubmenuOpen} />;
};
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx
index e1e9f437da..bbeaa3204a 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx
@@ -21,8 +21,6 @@ import {
CERT_INTEGRATIONS_SUBMENU,
INTEGRATIONS_SUBMENU,
MCP_SUBMENU,
- PAM_APPROVALS_SUBMENU,
- PAM_SETTINGS_SUBMENU,
PROJECT_ACCESS_CONTROL_SUBMENU,
SECRET_MANAGER_ACCESS_CONTROL_SUBMENU,
SECRET_SCANNING_SETTINGS_SUBMENU,
@@ -98,12 +96,9 @@ export const ProjectNav = () => {
return SM_SETTINGS_SUBMENU;
if (isOnProjectSettings && currentProject.type === ProjectType.SecretScanning)
return SECRET_SCANNING_SETTINGS_SUBMENU;
- if (isOnProjectSettings && currentProject.type === ProjectType.PAM) return PAM_SETTINGS_SUBMENU;
if (isOnMcpOverview) return MCP_SUBMENU;
if (isOnCertPolicies) return CERT_CERTIFICATES_SUBMENU;
if (isOnCertApprovals) return CERT_APPROVALS_SUBMENU;
- if (currentProject.type === ProjectType.PAM && pathname.includes("/approvals"))
- return PAM_APPROVALS_SUBMENU;
if (isOnApproval && !isCertManager) return smApprovalsSubmenu;
return null;
};
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
index 22cc8e996c..81187ee072 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
@@ -29,8 +29,7 @@ import {
ShieldCheck,
ShieldUser,
User,
- Users,
- Video
+ Users
} from "lucide-react";
import { SubOrgIcon } from "@app/components/v3";
@@ -244,29 +243,6 @@ export const SECRET_SCANNING_SETTINGS_SUBMENU: Submenu = {
]
};
-// --- PAM submenus ---
-
-export const PAM_APPROVALS_SUBMENU: Submenu = {
- title: "Approvals",
- pathSuffix: "approvals",
- defaultTab: "requests",
- items: [
- { label: "Requests", icon: FileCheck, tab: "requests" },
- { label: "Policies", icon: Shield, tab: "policies" },
- { label: "Grants", icon: Key, tab: "grants" }
- ]
-};
-
-export const PAM_SETTINGS_SUBMENU: Submenu = {
- title: "Settings",
- pathSuffix: "settings",
- defaultTab: "tab-project-general",
- items: [
- { label: "General", icon: Cog, tab: "tab-project-general" },
- { label: "Session Recording", icon: Video, tab: "tab-pam-session-recording" }
- ]
-};
-
// --- AI submenus ---
export const MCP_SUBMENU: Submenu = {
diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx
deleted file mode 100644
index 3127685c00..0000000000
--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-import { Helmet } from "react-helmet";
-import { faBan, faChevronLeft, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useQuery } from "@tanstack/react-query";
-import { Link, useNavigate, useParams } from "@tanstack/react-router";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- ConfirmActionModal,
- ContentLoader,
- EmptyState,
- PageHeader
-} from "@app/components/v2";
-import { ROUTE_PATHS } from "@app/const/routes";
-import { useOrganization, useProject, useUser } from "@app/context";
-import { usePopUp } from "@app/hooks";
-import { ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
-import {
- approvalRequestQuery,
- ApprovalRequestStatus,
- PamAccessRequestData,
- useCancelApprovalRequest
-} from "@app/hooks/api/approvalRequests";
-import { ProjectType } from "@app/hooks/api/projects/types";
-
-import { ApprovalStepsSection, RequestActionsSection, RequestDetailsSection } from "./components";
-
-const PageContent = () => {
- const { approvalRequestId } = useParams({
- from: ROUTE_PATHS.Pam.ApprovalRequestDetailPage.id
- });
- const { currentOrg } = useOrganization();
- const { currentProject } = useProject();
- const { user: currentUser } = useUser();
- const cancelApprovalRequest = useCancelApprovalRequest();
- const navigate = useNavigate();
- const { handlePopUpOpen, handlePopUpToggle, popUp } = usePopUp(["cancelRequest"]);
-
- const { data: request, isPending } = useQuery(
- approvalRequestQuery.getById({
- policyType: ApprovalPolicyType.PamAccess,
- requestId: approvalRequestId
- })
- );
-
- const handleRequestCancel = async () => {
- if (cancelApprovalRequest.isPending || !request) return;
-
- await cancelApprovalRequest.mutateAsync(
- {
- requestId: request.id,
- policyType: ApprovalPolicyType.PamAccess
- },
- {
- onSuccess: () => {
- createNotification({
- text: "Successfully cancelled request",
- type: "success"
- });
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/approvals",
- params: {
- orgId: currentProject.orgId,
- projectId: currentProject.id
- }
- });
- }
- }
- );
- };
-
- if (isPending) {
- return (
- <div className="flex h-full w-full items-center justify-center">
- <ContentLoader />
- </div>
- );
- }
-
- if (!request) {
- return (
- <div className="flex h-full w-full items-center justify-center px-20">
- <EmptyState
- className="max-w-2xl rounded-md text-center"
- icon={faBan}
- title={`Could not find approval request with ID ${approvalRequestId}`}
- />
- </div>
- );
- }
-
- return (
- <div className="container mx-auto flex flex-col justify-between bg-bunker-800 font-inter text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <Link
- to="/organizations/$orgId/projects/pam/$projectId/approvals"
- params={{ orgId: currentOrg.id, projectId: currentProject.id }}
- className="mb-4 flex items-center gap-x-2 text-sm text-mineshaft-400"
- >
- <FontAwesomeIcon icon={faChevronLeft} />
- Approvals List
- </Link>
- <PageHeader
- scope={ProjectType.PAM}
- title="Approval Request"
- description={(() => {
- const data = request.requestData.requestData as PamAccessRequestData;
- const target = data.resourceName
- ? `${data.resourceName}${data.accountName ? ` / ${data.accountName}` : ""}`
- : "account";
- return `Request to access ${target} for ${data.accessDuration} by ${request.requesterName || "Unknown"}`;
- })()}
- >
- <div>
- {request.requesterId === currentUser.id &&
- request.status === ApprovalRequestStatus.Pending && (
- <Button
- onClick={() => handlePopUpOpen("cancelRequest")}
- variant="outline_bg"
- size="xs"
- isLoading={cancelApprovalRequest.isPending}
- >
- Cancel Request
- </Button>
- )}
- </div>
- </PageHeader>
- {request.isBreakGlass && (
- <div className="mb-4 flex items-start gap-3 rounded border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-200">
- <FontAwesomeIcon icon={faTriangleExclamation} className="mt-0.5 text-red-400" />
- <div>
- <div className="font-semibold">Approval Policy Bypassed</div>
- <div className="text-xs break-words text-red-200/80">
- {request.bypassReason
- ? `Reason: "${request.bypassReason}"`
- : "This request was approved without obtaining the required approval."}
- </div>
- </div>
- </div>
- )}
- <div className="flex flex-col justify-center gap-4 lg:flex-row">
- <div className="flex flex-col gap-4 lg:w-96">
- <RequestDetailsSection request={request} />
- <RequestActionsSection request={request} />
- </div>
- <div className="flex flex-1 flex-col gap-4">
- <ApprovalStepsSection request={request} />
- </div>
- </div>
- </div>
- <ConfirmActionModal
- isOpen={popUp.cancelRequest.isOpen}
- confirmKey="cancel"
- title="Do you want to cancel this approval request?"
- onChange={(isOpen) => handlePopUpToggle("cancelRequest", isOpen)}
- onConfirmed={handleRequestCancel}
- buttonText="Confirm"
- />
- </div>
- );
-};
-
-export const ApprovalRequestDetailPage = () => {
- return (
- <>
- <Helmet>
- <title>Approval Request | Infisical</title>
- <link rel="icon" href="/infisical.ico" />
- </Helmet>
- <PageContent />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/ApprovalStepsSection.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/components/ApprovalStepsSection.tsx
deleted file mode 100644
index 4b8c68ab2e..0000000000
--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/ApprovalStepsSection.tsx
+++ /dev/null
@@ -1,186 +0,0 @@
-import { useMemo } from "react";
-import { faCheck, faCheckCircle, faClock, faXmark } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { format } from "date-fns";
-import { User, Users } from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import { Badge } from "@app/components/v3";
-import { useProject } from "@app/context";
-import { useGetWorkspaceUsers, useListWorkspaceGroups } from "@app/hooks/api";
-import { ApproverType } from "@app/hooks/api/approvalPolicies";
-import {
- ApprovalRequestApproval,
- ApprovalRequestStepStatus,
- TApprovalRequest
-} from "@app/hooks/api/approvalRequests";
-import { ApprovalRequestApprovalDecision } from "@app/hooks/api/approvalRequests/types";
-
-type Props = {
- request: TApprovalRequest;
-};
-
-const getMemberLabel = (member: {
- user: { username: string; email: string; firstName: string; lastName: string };
-}) => {
- const { user } = member;
- if (user.firstName || user.lastName) {
- return `${user.firstName || ""} ${user.lastName || ""}`.trim();
- }
- return user.username || user.email;
-};
-
-export const ApprovalStepsSection = ({ request }: Props) => {
- const { currentProject } = useProject();
- const projectId = currentProject?.id || "";
-
- const { data: members = [] } = useGetWorkspaceUsers(projectId, true);
- const { data: groups = [] } = useListWorkspaceGroups(projectId);
-
- const getApproverLabel = useMemo(
- () => (approverId: string, approverType: ApproverType) => {
- if (approverType === ApproverType.User) {
- const member = members?.find((m) => m.user.id === approverId);
- if (member) return getMemberLabel(member);
- } else if (approverType === ApproverType.Group) {
- const group = groups?.find(({ group: g }) => g.id === approverId);
- if (group) return group.group.name;
- }
- return approverId;
- },
- [members, groups]
- );
-
- const getApprovalLabel = (approval: ApprovalRequestApproval) => {
- const member = members?.find((m) => m.user.id === approval.approverUserId);
- if (member) return getMemberLabel(member);
- return approval.approverUserId;
- };
-
- const getStepStatusIcon = (status: ApprovalRequestStepStatus) => {
- switch (status) {
- case ApprovalRequestStepStatus.Completed:
- return <FontAwesomeIcon icon={faCheckCircle} className="text-green-500" />;
- case ApprovalRequestStepStatus.InProgress:
- return <FontAwesomeIcon icon={faClock} className="text-yellow-500" />;
- case ApprovalRequestStepStatus.Pending:
- return <div className="h-4 w-4 rounded-full border-2 border-mineshaft-400" />;
- case ApprovalRequestStepStatus.Rejected:
- return <FontAwesomeIcon icon={faXmark} className="text-red-500" />;
- default:
- return null;
- }
- };
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
- <div className="mb-2 flex items-center justify-between border-b border-mineshaft-500 pb-2">
- <h3 className="text-lg font-medium text-mineshaft-100">Approval Sequence</h3>
- </div>
- <div className="space-y-6">
- {request.steps.map((step, index) => (
- <div key={step.id} className="relative">
- {index < request.steps.length - 1 && (
- <div className="absolute top-8 left-2 h-full w-0.5 bg-mineshaft-600" />
- )}
- <div className="relative flex gap-3">
- <div className="relative top-3 z-10 flex h-4 w-4 items-center justify-center bg-mineshaft-900">
- {getStepStatusIcon(step.status)}
- </div>
- <div className="flex-1 pb-4">
- <div
- className={twMerge(
- "rounded-lg border bg-mineshaft-800",
- step.status === ApprovalRequestStepStatus.InProgress
- ? "border-yellow-500/40"
- : "border-mineshaft-600"
- )}
- >
- <div
- className={twMerge(
- "mb-2 flex items-center justify-between p-2",
- step.status === ApprovalRequestStepStatus.InProgress
- ? "bg-yellow-500/20"
- : "bg-mineshaft-700"
- )}
- >
- <h4 className="font-medium text-mineshaft-100">
- Step {index + 1}
- {step.status === ApprovalRequestStepStatus.InProgress && (
- <span className="ml-2 text-xs text-yellow-500">(Current Step)</span>
- )}
- </h4>
- <Badge
- variant={
- step.status === ApprovalRequestStepStatus.InProgress ? "project" : "neutral"
- }
- className="capitalize"
- >
- {step.status.split("-").join(" ")}
- </Badge>
- </div>
- <div className="space-y-3 p-2 pb-4 text-bunker-200">
- <div className="flex items-center space-x-2 text-sm">
- <div>Approvals Required:</div>
- <div>{step.requiredApprovals}</div>
- </div>
- <div className="text-sm">
- <div className="mb-2">Approvers</div>
- <div className="flex flex-wrap gap-1.5">
- {step.approvers.map((approver) => (
- <Badge variant="neutral">
- {approver.type === ApproverType.User ? <User /> : <Users />}
- {getApproverLabel(approver.id, approver.type)}
- </Badge>
- ))}
- </div>
- </div>
- {step.approvals.length > 0 && (
- <div className="mt-3 space-y-2 border-t border-mineshaft-600 pt-3">
- <p className="text-xs font-medium text-mineshaft-300">Approvals Given:</p>
- {step.approvals.map((approval) => (
- <div
- key={approval.id}
- className="flex items-start justify-between rounded bg-mineshaft-900/50 p-2"
- >
- <div className="flex items-center gap-2">
- <FontAwesomeIcon
- icon={
- approval.decision === ApprovalRequestApprovalDecision.Approved
- ? faCheck
- : faXmark
- }
- className={
- approval.decision === ApprovalRequestApprovalDecision.Approved
- ? "text-green-500"
- : "text-red-500"
- }
- />
- <div>
- <p className="text-xs font-medium text-mineshaft-100">
- {getApprovalLabel(approval)}
- </p>
- <p className="text-xs text-mineshaft-400">
- {format(new Date(approval.createdAt), "MMM dd, yyyy hh:mm aaa")}
- </p>
- </div>
- </div>
- {approval.comment && (
- <p className="max-w-xs text-xs text-mineshaft-400 italic">
- &quot;{approval.comment}&quot;
- </p>
- )}
- </div>
- ))}
- </div>
- )}
- </div>
- </div>
- </div>
- </div>
- </div>
- ))}
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestActionsSection.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestActionsSection.tsx
deleted file mode 100644
index 11b955e5de..0000000000
--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestActionsSection.tsx
+++ /dev/null
@@ -1,273 +0,0 @@
-import { Controller, useForm } from "react-hook-form";
-import {
- faCheck,
- faMagnifyingGlass,
- faTriangleExclamation,
- faXmark
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { twMerge } from "tailwind-merge";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- Checkbox,
- FormControl,
- FormLabel,
- Input,
- Popover,
- PopoverContent,
- PopoverTrigger,
- TextArea
-} from "@app/components/v2";
-import { useProjectPermission, useUser } from "@app/context";
-import { ApproverType } from "@app/hooks/api/approvalPolicies";
-import {
- ApprovalRequestStatus,
- ApprovalRequestStepStatus,
- TApprovalRequest,
- useApproveApprovalRequest,
- useRejectApprovalRequest
-} from "@app/hooks/api/approvalRequests";
-
-type Props = {
- request: TApprovalRequest;
-};
-
-const ReviewFormSchema = z
- .object({
- comment: z.string().max(1000).optional(),
- bypassApproval: z.boolean().default(false),
- bypassReason: z.string().max(500).optional()
- })
- .superRefine((data, ctx) => {
- if (data.bypassApproval && (data.bypassReason ?? "").trim().length < 10) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- path: ["bypassReason"],
- message: "Minimum 10 characters required"
- });
- }
- });
-
-type TReviewForm = z.infer<typeof ReviewFormSchema>;
-
-export const RequestActionsSection = ({ request }: Props) => {
- const { user } = useUser();
- const { memberships } = useProjectPermission();
-
- const userId = user?.id || "";
- const userGroups = memberships.map((el) => el.actorGroupId).filter(Boolean);
-
- const { mutateAsync: approveRequest, isPending: isApproving } = useApproveApprovalRequest();
- const { mutateAsync: rejectRequest, isPending: isRejecting } = useRejectApprovalRequest();
-
- const {
- control,
- handleSubmit,
- watch,
- reset,
- getValues,
- formState: { isValid }
- } = useForm<TReviewForm>({
- resolver: zodResolver(ReviewFormSchema),
- mode: "onChange",
- defaultValues: { comment: "", bypassApproval: false, bypassReason: "" }
- });
-
- const bypassApproval = watch("bypassApproval");
-
- if (request.status !== ApprovalRequestStatus.Pending) {
- return null;
- }
-
- const currentStep = request.steps.find(
- (step) => step.status === ApprovalRequestStepStatus.InProgress
- );
-
- const isApprover = currentStep
- ? currentStep.approvers.some((approver) =>
- approver.type === ApproverType.User
- ? approver.id === userId
- : userGroups.includes(approver.id)
- )
- : false;
-
- const hasAlreadyActed = currentStep
- ? currentStep.approvals.some((approval) => approval.approverUserId === userId)
- : false;
-
- if (!isApprover && !request.canBreakGlass) {
- return null;
- }
-
- if (hasAlreadyActed) {
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
- <p className="text-sm text-mineshaft-300">
- You have already provided your approval for this request.
- </p>
- </div>
- );
- }
-
- const canSubmitApprove = bypassApproval ? isValid : isApprover;
-
- const onApprove = async (data: TReviewForm) => {
- try {
- await approveRequest({
- policyType: request.type,
- requestId: request.id,
- comment: !data.bypassApproval && data.comment ? data.comment : undefined,
- bypassReason: data.bypassApproval ? data.bypassReason!.trim() : undefined
- });
- createNotification({
- text: data.bypassApproval
- ? "Approved without obtaining the required approval"
- : "Request approved successfully",
- type: data.bypassApproval ? "info" : "success"
- });
- } finally {
- reset({ comment: "", bypassApproval: false, bypassReason: "" });
- }
- };
-
- const handleReject = async () => {
- const { comment } = getValues();
- try {
- await rejectRequest({
- policyType: request.type,
- requestId: request.id,
- comment: comment || undefined
- });
- createNotification({
- text: "Request rejected successfully",
- type: "success"
- });
- } finally {
- reset({ comment: "", bypassApproval: false, bypassReason: "" });
- }
- };
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-yellow-500/30 bg-yellow-500/5 px-4 py-3">
- <div className="flex items-center justify-between border-b border-yellow-500/30 pb-2">
- <h3 className="font-medium text-mineshaft-100">Action Required</h3>
- <span className="text-xs text-yellow-500">Awaiting Your Approval</span>
- </div>
- <div className="space-y-4">
- <p className="text-sm text-mineshaft-300">
- {isApprover
- ? "You are an approver for the current step. Please review the request details and provide your decision."
- : "You can bypass this policy on this request. Provide a reason and approve to grant access immediately."}
- </p>
- <Popover>
- <PopoverTrigger>
- <Button
- colorSchema="primary"
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- className="px-2 py-1"
- >
- Review
- </Button>
- </PopoverTrigger>
- <PopoverContent align="start" title="Finish your review" className="w-96 pt-4">
- <form onSubmit={handleSubmit(onApprove)}>
- {request.canBreakGlass && (
- <div className="mb-4 flex flex-col space-y-2">
- <Controller
- control={control}
- name="bypassApproval"
- render={({ field: { value, onChange } }) => (
- <Checkbox
- id="byPassApproval"
- isChecked={value}
- onCheckedChange={(checked) => onChange(checked === true)}
- className={twMerge(
- "mt-0.5 mr-2 self-start",
- value ? "border-red/50! bg-red/30!" : ""
- )}
- allowMultilineLabel
- >
- <span className="text-xs text-red">
- Approve immediately without approver review (bypass policy)
- </span>
- </Checkbox>
- )}
- />
- {bypassApproval && (
- <Controller
- control={control}
- name="bypassReason"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Reason for bypass"
- isRequired
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Enter a reason for bypassing the policy"
- className="mb-0"
- >
- <Input
- {...field}
- placeholder="Enter reason for bypass"
- leftIcon={<FontAwesomeIcon icon={faTriangleExclamation} />}
- />
- </FormControl>
- )}
- />
- )}
- </div>
- )}
- {isApprover && (
- <>
- <FormLabel label="Finish your review" />
- <Controller
- control={control}
- name="comment"
- render={({ field }) => (
- <TextArea
- {...field}
- placeholder="Add a comment about your decision..."
- rows={3}
- reSize="vertical"
- className="mt-1 mb-4"
- />
- )}
- />
- </>
- )}
- <div className="flex gap-3">
- <Button
- type="submit"
- colorSchema="primary"
- leftIcon={<FontAwesomeIcon icon={faCheck} />}
- isLoading={isApproving}
- isDisabled={isRejecting || !canSubmitApprove}
- className="px-2 py-1"
- >
- Approve Request
- </Button>
- {isApprover && (
- <Button
- type="button"
- colorSchema="danger"
- leftIcon={<FontAwesomeIcon icon={faXmark} />}
- onClick={handleReject}
- isLoading={isRejecting}
- isDisabled={isApproving}
- className="px-2 py-1"
- >
- Reject Request
- </Button>
- )}
- </div>
- </form>
- </PopoverContent>
- </Popover>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsx
deleted file mode 100644
index baf91f5f83..0000000000
--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { format } from "date-fns";
-
-import { GenericFieldLabel } from "@app/components/v2";
-import { Badge } from "@app/components/v3";
-import {
- ApprovalRequestStatus,
- PamAccessRequestData,
- TApprovalRequest
-} from "@app/hooks/api/approvalRequests";
-
-type Props = {
- request: TApprovalRequest;
-};
-
-const getStatusBadgeColor = (status: ApprovalRequestStatus) => {
- switch (status) {
- case ApprovalRequestStatus.Pending:
- return "project";
- case ApprovalRequestStatus.Approved:
- return "success";
- case ApprovalRequestStatus.Rejected:
- return "danger";
- case ApprovalRequestStatus.Expired:
- return "neutral";
- default:
- return "neutral";
- }
-};
-
-export const RequestDetailsSection = ({ request }: Props) => {
- const { accessDuration, resourceName, accountName } = request.requestData
- .requestData as PamAccessRequestData;
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
- <div className="flex items-center justify-between border-b border-mineshaft-500 pb-2">
- <h3 className="text-lg font-medium text-mineshaft-100">Request Details</h3>
- </div>
- <div>
- <div className="space-y-3">
- <GenericFieldLabel label="Status">
- <Badge className="capitalize" variant={getStatusBadgeColor(request.status)}>
- {request.status}
- </Badge>
- </GenericFieldLabel>
- <GenericFieldLabel label="Requester Name">
- {request.requesterName || "Unknown"}
- </GenericFieldLabel>
- <GenericFieldLabel label="Requester Email">{request.requesterEmail}</GenericFieldLabel>
- {resourceName && (
- <GenericFieldLabel label="Resource Name">{resourceName}</GenericFieldLabel>
- )}
- {accountName && <GenericFieldLabel label="Account Name">{accountName}</GenericFieldLabel>}
- <GenericFieldLabel label="Access Duration">{accessDuration}</GenericFieldLabel>
- {request.justification && (
- <GenericFieldLabel label="Justification">
- <p className="rounded-sm bg-mineshaft-600 p-2 text-xs break-words">
- {request.justification}
- </p>
- </GenericFieldLabel>
- )}
- <GenericFieldLabel label="Requested At">
- {format(new Date(request.createdAt), "yyyy-MM-dd, hh:mm aaa")}
- </GenericFieldLabel>
- {request.expiresAt && (
- <GenericFieldLabel label="Expires">
- {format(new Date(request.expiresAt), "yyyy-MM-dd, hh:mm aaa")}
- </GenericFieldLabel>
- )}
- </div>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/index.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/components/index.tsx
deleted file mode 100644
index 1b2814dbf6..0000000000
--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export { ApprovalStepsSection } from "./ApprovalStepsSection";
-export { RequestActionsSection } from "./RequestActionsSection";
-export { RequestDetailsSection } from "./RequestDetailsSection";
diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/route.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/route.tsx
deleted file mode 100644
index e1699007fd..0000000000
--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/route.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-
-import { ApprovalRequestDetailPage } from "./ApprovalRequestDetailPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId"
-)({
- component: ApprovalRequestDetailPage,
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Approval Request"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/ApprovalsPage/ApprovalsPage.tsx b/frontend/src/pages/pam/ApprovalsPage/ApprovalsPage.tsx
deleted file mode 100644
index 5b3e197076..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/ApprovalsPage.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { Helmet } from "react-helmet";
-import { useSearch } from "@tanstack/react-router";
-
-import { PageHeader } from "@app/components/v2";
-import { useProject } from "@app/context";
-import { ApprovalControlTabs } from "@app/types/project";
-
-import { ApprovalRequestTab } from "./components/ApprovalRequestTab";
-import { PolicyTab } from "./components/PolicyTab";
-import { RequestGrantTab } from "./components/RequestGrantTab";
-
-const Page = () => {
- const { currentProject } = useProject();
- const selectedTab = useSearch({
- strict: false,
- select: (el) => el.selectedTab
- });
-
- const activeTab = (selectedTab as ApprovalControlTabs) || ApprovalControlTabs.Requests;
-
- return (
- <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <PageHeader
- scope={currentProject.type}
- title="PAM Approvals"
- description="Manage approval workflows, update policy settings, and monitor request statuses."
- />
- <div>
- {activeTab === ApprovalControlTabs.Requests && <ApprovalRequestTab />}
- {activeTab === ApprovalControlTabs.Policies && <PolicyTab />}
- {activeTab === ApprovalControlTabs.Grants && <RequestGrantTab />}
- </div>
- </div>
- </div>
- );
-};
-
-export const ApprovalsPage = () => {
- return (
- <>
- <Helmet>
- <link rel="icon" href="/infisical.ico" />
- </Helmet>
- <Page />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsx
deleted file mode 100644
index c55bbad3c3..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsx
+++ /dev/null
@@ -1,377 +0,0 @@
-import { useMemo, useState } from "react";
-import {
- faCheckCircle,
- faChevronRight,
- faExclamationCircle,
- faFileCircleQuestion,
- faFilter,
- faMagnifyingGlass,
- faSearch
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useQuery } from "@tanstack/react-query";
-import { useNavigate } from "@tanstack/react-router";
-import { formatDistance } from "date-fns";
-import { twMerge } from "tailwind-merge";
-
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuTrigger,
- DropdownSubMenu,
- DropdownSubMenuContent,
- DropdownSubMenuTrigger,
- EmptyState,
- IconButton,
- Input,
- Pagination,
- Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
-import { useOrganization, useProject, useProjectPermission, useUser } from "@app/context";
-import { getUserTablePreference, PreferenceKey } from "@app/helpers/userTablePreferences";
-import { usePagination } from "@app/hooks";
-import {
- ApprovalPolicyScope,
- ApprovalPolicyType,
- ApproverType
-} from "@app/hooks/api/approvalPolicies";
-import {
- approvalRequestQuery,
- ApprovalRequestStatus,
- ApprovalRequestStepStatus,
- PamAccessRequestData,
- TApprovalRequest
-} from "@app/hooks/api/approvalRequests";
-
-const getStatusBadgeColor = (status: ApprovalRequestStatus) => {
- switch (status) {
- case ApprovalRequestStatus.Pending:
- return "project";
- case ApprovalRequestStatus.Approved:
- return "success";
- case ApprovalRequestStatus.Rejected:
- return "danger";
- case ApprovalRequestStatus.Expired:
- return "neutral";
- default:
- return "neutral";
- }
-};
-
-const checkIfUserNeedsToApprove = (
- request: TApprovalRequest,
- userId: string,
- userGroups: string[]
-): boolean => {
- const currentStep = request.steps.find(
- (step) => step.status === ApprovalRequestStepStatus.InProgress
- );
-
- if (!currentStep) return false;
-
- const isApprover = currentStep.approvers.some((approver) =>
- approver.type === ApproverType.User ? approver.id === userId : userGroups.includes(approver.id)
- );
-
- if (!isApprover) return false;
-
- const hasAlreadyApproved = currentStep.approvals.some(
- (approval) => approval.approverUserId === userId
- );
-
- return !hasAlreadyApproved;
-};
-
-export const ApprovalRequestTab = () => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const { currentProject } = useProject();
- const { memberships } = useProjectPermission();
- const { user } = useUser();
- const [search, setSearch] = useState("");
- const [filter, setFilter] = useState(ApprovalRequestStatus.Pending);
-
- const projectId = currentProject?.id || "";
- const userId = user?.id || "";
- const userGroups = memberships.map((el) => el.actorGroupId).filter(Boolean);
-
- const { data: requests = [], isPending: isRequestsLoading } = useQuery(
- approvalRequestQuery.list({
- policyType: ApprovalPolicyType.PamAccess,
- scope: ApprovalPolicyScope.Project,
- scopeId: projectId
- })
- );
-
- const { page, perPage, setPage, setPerPage, offset } = usePagination("", {
- initPerPage: getUserTablePreference("PamApprovalRequestTable", PreferenceKey.PerPage, 10)
- });
-
- const filteredRequests = useMemo(() => {
- let filtered = requests;
-
- // Apply search filter
- if (search) {
- filtered = filtered.filter((request) => {
- const data = request.requestData.requestData as PamAccessRequestData;
- const searchLower = search.toLowerCase();
- return (
- request.requesterName?.toLowerCase().includes(searchLower) ||
- request.requesterEmail?.toLowerCase().includes(searchLower) ||
- request.justification?.toLowerCase().includes(searchLower) ||
- data.resourceName?.toLowerCase().includes(searchLower) ||
- data.accountName?.toLowerCase().includes(searchLower)
- );
- });
- }
-
- return filtered
- .filter((req) => req.status === filter)
- .sort(
- (a, b) => (new Date(b.createdAt)?.getTime() || 0) - (new Date(a.createdAt)?.getTime() || 0)
- );
- }, [requests, search, filter]);
-
- const paginatedRequests = useMemo(
- () => filteredRequests.slice(offset, offset + perPage),
- [filteredRequests, offset, perPage]
- );
-
- const handleRowClick = (requestId: string) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId",
- params: {
- orgId: currentOrg.id,
- projectId: currentProject.id,
- approvalRequestId: requestId
- }
- });
- };
-
- const isTableFiltered = filter !== ApprovalRequestStatus.Pending;
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="mb-4">
- <div className="flex items-center gap-x-2">
- <p className="text-xl font-medium text-mineshaft-100">Access Requests</p>
- </div>
- <p className="text-sm text-bunker-300">View pending access requests to PAM accounts</p>
- </div>
- <div>
- <div className="flex gap-2">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Filter Requests"
- variant="plain"
- size="sm"
- className={twMerge(
- "flex h-9.5 w-[2.6rem] items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",
- isTableFiltered && "border-primary/50 text-primary"
- )}
- >
- <FontAwesomeIcon icon={faFilter} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="p-0">
- <DropdownMenuLabel>Filter By</DropdownMenuLabel>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalRequestStatus.Pending);
- }}
- icon={
- filter === ApprovalRequestStatus.Pending && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Open Requests
- </DropdownMenuItem>
- <DropdownSubMenu>
- <DropdownSubMenuTrigger
- iconPos="right"
- icon={<FontAwesomeIcon icon={faChevronRight} size="sm" />}
- >
- Closed Requests
- </DropdownSubMenuTrigger>
- <DropdownSubMenuContent className="max-h-80 thin-scrollbar overflow-y-auto rounded-l-none">
- <DropdownMenuLabel className="sticky top-0 bg-mineshaft-900">
- Filter by Status
- </DropdownMenuLabel>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalRequestStatus.Approved);
- }}
- icon={
- filter === ApprovalRequestStatus.Approved && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Approved
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalRequestStatus.Cancelled);
- }}
- icon={
- filter === ApprovalRequestStatus.Cancelled && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Cancelled
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalRequestStatus.Rejected);
- }}
- icon={
- filter === ApprovalRequestStatus.Rejected && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Rejected
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalRequestStatus.Expired);
- }}
- icon={
- filter === ApprovalRequestStatus.Expired && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Expired
- </DropdownMenuItem>
- </DropdownSubMenuContent>
- </DropdownSubMenu>
- </DropdownMenuContent>
- </DropdownMenu>
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search access requests..."
- />
- </div>
- <TableContainer className="mt-4">
- <Table>
- <THead>
- <Tr>
- <Th>Requester</Th>
- <Th>Resource</Th>
- <Th>Account</Th>
- <Th>Access Duration</Th>
- <Th>Status</Th>
- <Th>Requested</Th>
- </Tr>
- </THead>
- <TBody>
- {isRequestsLoading && <TableSkeleton columns={6} innerKey="approval-requests" />}
- {!isRequestsLoading &&
- paginatedRequests.map((request) => {
- const needsApproval = checkIfUserNeedsToApprove(request, userId, userGroups);
- const { accessDuration, resourceName, accountName } = request.requestData
- .requestData as PamAccessRequestData;
-
- return (
- <Tr
- key={request.id}
- className="cursor-pointer transition-colors hover:bg-mineshaft-700"
- onClick={() => handleRowClick(request.id)}
- >
- <Td>
- <div>
- <div className="text-sm font-medium text-mineshaft-100">
- {request.requesterName || "Unknown"}
- </div>
- <div className="text-xs text-mineshaft-400">{request.requesterEmail}</div>
- </div>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-200">{resourceName || "-"}</span>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-200">{accountName || "-"}</span>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-200">{accessDuration}</span>
- </Td>
- <Td>
- <div className="flex items-center gap-2">
- <Badge
- className="capitalize"
- variant={getStatusBadgeColor(request.status)}
- >
- {request.status.split("-").join(" ")}
- </Badge>
- {request.isBreakGlass && (
- <div className="flex items-center gap-1 rounded bg-red-500/20 px-2 py-0.5 text-xs text-red-300">
- <FontAwesomeIcon icon={faExclamationCircle} className="h-3 w-3" />
- <span>Bypassed</span>
- </div>
- )}
- {needsApproval && (
- <div className="flex items-center gap-1 rounded bg-primary/20 px-2 py-0.5 text-xs text-primary">
- <FontAwesomeIcon icon={faExclamationCircle} className="h-3 w-3" />
- <span>Approval Required</span>
- </div>
- )}
- </div>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-400">
- {formatDistance(new Date(request.createdAt), new Date(), {
- addSuffix: true
- })}
- </span>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {Boolean(filteredRequests.length) && (
- <Pagination
- count={filteredRequests.length}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- {!isRequestsLoading && !filteredRequests?.length && (
- <EmptyState
- title="No approval requests found"
- icon={requests.length ? faSearch : faFileCircleQuestion}
- />
- )}
- </TableContainer>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/index.tsx b/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/index.tsx
deleted file mode 100644
index 3a0475784a..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { ApprovalRequestTab } from "./ApprovalRequestTab";
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx
deleted file mode 100644
index c767f5e48e..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { createNotification } from "@app/components/notifications";
-import { Button, DeleteActionModal } from "@app/components/v2";
-import { useProject } from "@app/context";
-import { usePopUp } from "@app/hooks";
-import { ApprovalPolicyType, useDeleteApprovalPolicy } from "@app/hooks/api/approvalPolicies";
-
-import { PoliciesTable } from "./components/PoliciesTable";
-import { PolicyModal } from "./components/PolicyModal";
-
-export const PolicyTab = () => {
- const { currentProject } = useProject();
-
- const { mutateAsync: deleteApprovalPolicy } = useDeleteApprovalPolicy();
-
- const { handlePopUpToggle, popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
- "policy",
- "deletePolicy"
- ] as const);
-
- const handleDeletePolicy = async () => {
- const policyId = (popUp?.deletePolicy?.data as { policyId: string })?.policyId;
- if (!currentProject?.id) return;
- if (!policyId) return;
-
- await deleteApprovalPolicy({
- policyType: ApprovalPolicyType.PamAccess,
- policyId
- });
- createNotification({
- text: "Successfully deleted policy",
- type: "success"
- });
- handlePopUpClose("deletePolicy");
- };
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="mb-4 flex items-center">
- <div className="flex-1">
- <div className="flex items-center gap-x-2">
- <p className="text-xl font-medium text-mineshaft-100">Access Policies</p>
- </div>
- <p className="text-sm text-bunker-300">View and manage PAM access policies</p>
- </div>
-
- <Button
- variant="outline_bg"
- type="submit"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => handlePopUpOpen("policy")}
- >
- Create Policy
- </Button>
- </div>
-
- <PoliciesTable handlePopUpOpen={handlePopUpOpen} />
- <PolicyModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
- isOpen={popUp.deletePolicy.isOpen}
- deleteKey="delete"
- title="Are you sure you want to delete this policy?"
- onChange={(isOpen) => handlePopUpToggle("deletePolicy", isOpen)}
- onDeleteApproved={handleDeletePolicy}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
deleted file mode 100644
index cf0ab9f4f1..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
+++ /dev/null
@@ -1,359 +0,0 @@
-import { Fragment, useState } from "react";
-import {
- faChevronDown,
- faChevronRight,
- faEllipsisV,
- faPencil,
- faTrash,
- faUsers
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useQuery } from "@tanstack/react-query";
-import { User, Users } from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- EmptyState,
- IconButton,
- Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tooltip,
- Tr
-} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
-import { useProject } from "@app/context";
-import { getMemberLabel } from "@app/helpers/members";
-import { useGetWorkspaceUsers, useListWorkspaceGroups } from "@app/hooks/api";
-import {
- approvalPolicyQuery,
- ApprovalPolicyScope,
- ApprovalPolicyType,
- ApproverType,
- EnforcementLevel,
- PamAccessPolicyConditions,
- PamAccessPolicyConstraints
-} from "@app/hooks/api/approvalPolicies";
-import { UsePopUpState } from "@app/hooks/usePopUp";
-
-type Props = {
- handlePopUpOpen: (
- popUpName: keyof UsePopUpState<["policy", "deletePolicy"]>,
- data?: object
- ) => void;
-};
-
-export const PoliciesTable = ({ handlePopUpOpen }: Props) => {
- const { currentProject } = useProject();
- const [expandedRows, setExpandedRows] = useState<Set<string>>(new Set());
-
- const projectId = currentProject?.id || "";
-
- const { data: policies = [], isPending: isPoliciesLoading } = useQuery(
- approvalPolicyQuery.list({
- policyType: ApprovalPolicyType.PamAccess,
- scope: ApprovalPolicyScope.Project,
- scopeId: projectId
- })
- );
-
- const { data: members = [] } = useGetWorkspaceUsers(projectId);
- const { data: groups = [] } = useListWorkspaceGroups(projectId);
-
- const getApproverLabel = (approverId: string, approverType: ApproverType) => {
- if (approverType === ApproverType.User) {
- const member = members?.find((m) => m.user.id === approverId);
- if (member) {
- return getMemberLabel(member);
- }
- } else if (approverType === ApproverType.Group) {
- const group = groups?.find(({ group: g }) => g.id === approverId);
- if (group) {
- return group.group.name;
- }
- }
- return approverId;
- };
-
- const toggleRowExpansion = (policyId: string) => {
- setExpandedRows((prev) => {
- const newSet = new Set(prev);
- if (newSet.has(policyId)) {
- newSet.delete(policyId);
- } else {
- newSet.add(policyId);
- }
- return newSet;
- });
- };
-
- return (
- <div>
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th className="w-10" />
- <Th>Policy Name</Th>
- <Th>Max. Access Duration</Th>
- <Th>Conditions</Th>
- <Th className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isPoliciesLoading && <TableSkeleton columns={5} innerKey="approval-policies" />}
- {!isPoliciesLoading && policies.length === 0 && (
- <Tr>
- <Td colSpan={7}>
- <EmptyState title="No policies found" icon={faUsers} />
- </Td>
- </Tr>
- )}
- {!isPoliciesLoading &&
- policies.map((policy) => {
- const isExpanded = expandedRows.has(policy.id);
- const conditionsCount = policy.conditions.conditions.length;
-
- return (
- <>
- <Tr
- key={policy.id}
- className="group cursor-pointer hover:bg-mineshaft-700"
- onClick={() => toggleRowExpansion(policy.id)}
- >
- <Td>
- <IconButton
- ariaLabel="expand"
- variant="plain"
- className="p-0"
- onClick={(e) => {
- e.stopPropagation();
- toggleRowExpansion(policy.id);
- }}
- >
- <FontAwesomeIcon
- icon={isExpanded ? faChevronDown : faChevronRight}
- className="text-mineshaft-400"
- />
- </IconButton>
- </Td>
- <Td>{policy.name}</Td>
- <Td>
- {
- (policy.constraints.constraints as PamAccessPolicyConstraints)
- .accessDuration.max
- }
- </Td>
- <Td>
- {conditionsCount} condition{conditionsCount !== 1 ? "s" : ""}
- </Td>
- <Td
- onClick={(e) => {
- e.stopPropagation();
- }}
- >
- <DropdownMenu>
- <DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
- <Tooltip content="More options">
- <IconButton
- ariaLabel="More options"
- variant="plain"
- className="w-4 p-0"
- size="md"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </Tooltip>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="p-1">
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("policy", {
- policyId: policy.id,
- policy
- });
- }}
- icon={<FontAwesomeIcon icon={faPencil} />}
- >
- Edit Policy
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deletePolicy", {
- policyId: policy.id,
- policyName: policy.name
- });
- }}
- icon={<FontAwesomeIcon icon={faTrash} />}
- >
- Delete Policy
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </Td>
- </Tr>
- {isExpanded && (
- <Tr className="bg-mineshaft-800">
- <Td colSpan={7} className="p-0">
- <div className="flex max-h-80 w-full gap-4 overflow-auto overflow-x-hidden p-4">
- <div className="flex-1">
- <div className="mb-2 text-sm font-medium text-mineshaft-300">
- Approval Conditions
- </div>
- {(policy.conditions.conditions as PamAccessPolicyConditions).map(
- (condition, index) => {
- const hasResourceNames =
- condition.resourceNames && condition.resourceNames.length > 0;
- const hasAccountNames =
- condition.accountNames && condition.accountNames.length > 0;
-
- return (
- <Fragment key={`${policy.id}--${index + 1}`}>
- <div
- className={twMerge(
- "rounded border border-mineshaft-600 bg-mineshaft-900 p-3"
- )}
- >
- <div className="space-y-2">
- {hasResourceNames && (
- <div>
- <span className="text-sm font-medium text-mineshaft-300">
- Resource Names:
- </span>
- <p className="text-sm text-mineshaft-100">
- {condition.resourceNames!.join(", ")}
- </p>
- </div>
- )}
- {hasAccountNames && (
- <div>
- <span className="text-sm font-medium text-mineshaft-300">
- Account Names:
- </span>
- <p className="text-sm text-mineshaft-100">
- {condition.accountNames!.join(", ")}
- </p>
- </div>
- )}
- </div>
- </div>
- {index < policy.conditions.conditions.length - 1 && (
- <div className="flex items-center">
- <div className="flex flex-col items-center">
- <div className="h-3 w-px bg-mineshaft-500" />
- <span className="px-2 text-xs font-medium text-mineshaft-400">
- OR
- </span>
- <div className="h-3 w-px bg-mineshaft-500" />
- </div>
- </div>
- )}
- </Fragment>
- );
- }
- )}
- </div>
- <div className="flex-2">
- <div className="mb-2 text-sm font-medium text-mineshaft-300">
- Bypass Approvals
- </div>
- {policy.enforcementLevel !== EnforcementLevel.Soft ? (
- <div className="mb-3 rounded border border-mineshaft-600 bg-mineshaft-900 p-3 text-sm text-mineshaft-400">
- Disabled
- </div>
- ) : (
- <div className="mb-3 rounded border border-mineshaft-600 bg-mineshaft-900 p-3">
- {policy.bypassers.length === 0 ? (
- <div className="rounded-r border-l-2 border-l-red-500 bg-mineshaft-300/5 px-3 py-2 text-xs text-bunker-300">
- Enabled — no bypassers configured. Anyone in the project can
- bypass this policy.
- </div>
- ) : (
- <div className="flex flex-wrap gap-2">
- {policy.bypassers.map((b, i) => (
- <Badge
- variant="neutral"
- key={`${policy.id}-bypasser-${i + 1}`}
- >
- {b.type === ApproverType.Group ? <Users /> : <User />}
- {getApproverLabel(
- b.id,
- b.type === ApproverType.User
- ? ApproverType.User
- : ApproverType.Group
- )}
- </Badge>
- ))}
- </div>
- )}
- </div>
- )}
-
- <div className="mb-2 text-sm font-medium text-mineshaft-300">
- Approval Sequence
- </div>
- {policy.steps.map((step, index) => (
- <div
- key={`${policy.id}-step-${index + 1}`}
- className={twMerge(
- "mb-3 rounded border border-mineshaft-600 bg-mineshaft-900",
- index === policy.steps.length - 1 && "mb-0"
- )}
- >
- <div className="mb-2 flex items-center justify-between bg-mineshaft-700 p-3">
- <div className="text-sm font-medium text-mineshaft-200">
- Step {index + 1}
- {step.name && (
- <span className="ml-2 text-mineshaft-400">
- ({step.name})
- </span>
- )}
- </div>
- <div className="text-xs text-mineshaft-400">
- Requires {step.requiredApprovals} approval
- {step.requiredApprovals !== 1 ? "s" : ""}
- </div>
- </div>
- <div className="flex flex-wrap gap-2 p-3">
- {step.approvers.map((approver, approverIndex) => (
- <Badge
- variant="neutral"
- key={`${policy.id}-step-${index + 1}-approver-${approverIndex + 1}`}
- >
- {approver.type === ApproverType.Group ? (
- <Users />
- ) : (
- <User />
- )}
- {getApproverLabel(approver.id, approver.type)}
- </Badge>
- ))}
- </div>
- </div>
- ))}
- </div>
- </div>
- </Td>
- </Tr>
- )}
- </>
- );
- })}
- </TBody>
- </Table>
- </TableContainer>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx
deleted file mode 100644
index bdcdbc548b..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx
+++ /dev/null
@@ -1,275 +0,0 @@
-import { useEffect, useState } from "react";
-import { FormProvider, useForm } from "react-hook-form";
-import { Tab } from "@headlessui/react";
-import { zodResolver } from "@hookform/resolvers/zod";
-
-import { createNotification } from "@app/components/notifications";
-import { Button, Modal, ModalContent } from "@app/components/v2";
-import { useProject } from "@app/context";
-import {
- ApprovalPolicyScope,
- ApprovalPolicyType,
- ApproverType,
- EnforcementLevel,
- PamAccessPolicyConditions,
- PamAccessPolicyConstraints,
- TApprovalPolicy,
- useCreateApprovalPolicy,
- useUpdateApprovalPolicy
-} from "@app/hooks/api/approvalPolicies";
-import { UsePopUpState } from "@app/hooks/usePopUp";
-
-import { PolicyFormSchema, TPolicyForm } from "./PolicySchema";
-import { PolicyApprovalSteps, PolicyDetailsStep, PolicyReviewStep } from "./PolicySteps";
-
-type Props = {
- popUp: UsePopUpState<["policy"]>;
- handlePopUpToggle: (popUpName: keyof UsePopUpState<["policy"]>, state?: boolean) => void;
-};
-
-const FORM_STEPS: { name: string; key: string; fields: (keyof TPolicyForm)[] }[] = [
- {
- name: "Configuration",
- key: "configuration",
- fields: ["name", "constraints", "conditions"]
- },
- { name: "Approval Sequence", key: "approvals", fields: ["steps"] },
- { name: "Review", key: "review", fields: [] }
-];
-
-export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentProject } = useProject();
- const isOpen = popUp?.policy?.isOpen;
- const policyData = popUp?.policy?.data as
- | { policyId: string; policy: TApprovalPolicy }
- | undefined;
-
- const [selectedStepIndex, setSelectedStepIndex] = useState(0);
-
- const formMethods = useForm<TPolicyForm>({
- resolver: zodResolver(PolicyFormSchema),
- defaultValues: {
- name: "",
- maxRequestTtl: null,
- conditions: [{ resourceNames: [], accountNames: [] }],
- constraints: {
- accessDuration: {
- min: "30s",
- max: "7d"
- }
- },
- steps: [
- {
- name: "",
- requiredApprovals: 1,
- notifyApprovers: true,
- approvers: []
- }
- ],
- enforcementLevel: EnforcementLevel.Hard,
- userBypassers: [],
- groupBypassers: []
- }
- });
-
- const { handleSubmit, trigger, reset } = formMethods;
-
- const { mutateAsync: createPolicy, isPending: isCreating } = useCreateApprovalPolicy();
- const { mutateAsync: updatePolicy, isPending: isUpdating } = useUpdateApprovalPolicy();
-
- useEffect(() => {
- if (policyData?.policy) {
- const conditions = policyData.policy.conditions.conditions as PamAccessPolicyConditions;
- const policyBypassers = policyData.policy.bypassers ?? [];
- reset({
- name: policyData.policy.name,
- maxRequestTtl: policyData.policy.maxRequestTtl,
- conditions: conditions.map((c) => ({
- resourceNames: c.resourceNames || [],
- accountNames: c.accountNames || []
- })),
- constraints: policyData.policy.constraints.constraints as PamAccessPolicyConstraints,
- steps: policyData.policy.steps.map((step) => ({
- ...step,
- name: step.name || ""
- })),
- enforcementLevel: policyData.policy.enforcementLevel ?? EnforcementLevel.Hard,
- userBypassers: policyBypassers
- .filter((b) => b.type === ApproverType.User)
- .map((b) => ({ type: ApproverType.User, id: b.id })),
- groupBypassers: policyBypassers
- .filter((b) => b.type === ApproverType.Group)
- .map((b) => ({ type: ApproverType.Group, id: b.id }))
- });
- } else {
- reset({
- name: "",
- maxRequestTtl: null,
- conditions: [{ resourceNames: [], accountNames: [] }],
- constraints: {
- accessDuration: {
- min: "30s",
- max: "7d"
- }
- },
- steps: [
- {
- name: "",
- requiredApprovals: 1,
- notifyApprovers: true,
- approvers: []
- }
- ],
- enforcementLevel: EnforcementLevel.Hard,
- userBypassers: [],
- groupBypassers: []
- });
- }
- setSelectedStepIndex(0);
- }, [policyData, reset, isOpen]);
-
- const onSubmit = async (data: TPolicyForm) => {
- if (!currentProject?.id) return;
-
- const { userBypassers, groupBypassers, ...rest } = data;
- const bypassers = [...userBypassers, ...groupBypassers];
-
- try {
- if (policyData?.policyId) {
- await updatePolicy({
- policyType: ApprovalPolicyType.PamAccess,
- policyId: policyData.policyId,
- ...rest,
- bypassers
- });
- createNotification({
- text: "Successfully updated policy",
- type: "success"
- });
- } else {
- await createPolicy({
- policyType: ApprovalPolicyType.PamAccess,
- scope: ApprovalPolicyScope.Project,
- scopeId: currentProject.id,
- ...rest,
- bypassers
- });
- createNotification({
- text: "Successfully created policy",
- type: "success"
- });
- }
- handlePopUpToggle("policy", false);
- } catch (error) {
- console.error(error);
- createNotification({
- text: `Failed to ${policyData?.policyId ? "update" : "create"} policy`,
- type: "error"
- });
- }
- };
-
- const isStepValid = async (index: number) => {
- const { fields } = FORM_STEPS[index];
- if (fields.length === 0) return true;
- return trigger(fields);
- };
-
- const isFinalStep = selectedStepIndex === FORM_STEPS.length - 1;
-
- const handleNext = async () => {
- if (isFinalStep) {
- await handleSubmit(onSubmit)();
- return;
- }
-
- const isValid = await isStepValid(selectedStepIndex);
-
- if (!isValid) return;
-
- setSelectedStepIndex((prev) => prev + 1);
- };
-
- const handlePrev = () => {
- if (selectedStepIndex === 0) {
- handlePopUpToggle("policy", false);
- return;
- }
-
- setSelectedStepIndex((prev) => prev - 1);
- };
-
- const isTabEnabled = async (index: number) => {
- let isEnabled = true;
- for (let i = index - 1; i >= 0; i -= 1) {
- // eslint-disable-next-line no-await-in-loop
- isEnabled = isEnabled && (await isStepValid(i));
- }
-
- return isEnabled;
- };
-
- return (
- <Modal isOpen={isOpen} onOpenChange={(open) => handlePopUpToggle("policy", open)}>
- <ModalContent
- title={policyData?.policyId ? "Edit Access Policy" : "Create Access Policy"}
- subTitle="Configure a policy dictating account access with constraints"
- className="max-w-3xl"
- >
- <FormProvider {...formMethods}>
- <form>
- <Tab.Group selectedIndex={selectedStepIndex} onChange={setSelectedStepIndex}>
- <Tab.List className="-pb-1 mb-6 w-full border-b-2 border-mineshaft-600">
- {FORM_STEPS.map((step, index) => (
- <Tab
- onClick={async (e) => {
- e.preventDefault();
- const isEnabled = await isTabEnabled(index);
- setSelectedStepIndex((prev) => (isEnabled ? index : prev));
- }}
- className={({ selected }) =>
- `-mb-[0.14rem] whitespace-nowrap ${index > selectedStepIndex ? "opacity-30" : ""} px-4 py-2 text-sm font-medium outline-hidden disabled:opacity-60 ${
- selected
- ? "border-b-2 border-mineshaft-300 text-mineshaft-200"
- : "text-bunker-300"
- }`
- }
- key={step.key}
- >
- {index + 1}. {step.name}
- </Tab>
- ))}
- </Tab.List>
- <Tab.Panels>
- <Tab.Panel>
- <PolicyDetailsStep />
- </Tab.Panel>
- <Tab.Panel>
- <PolicyApprovalSteps />
- </Tab.Panel>
- <Tab.Panel>
- <PolicyReviewStep />
- </Tab.Panel>
- </Tab.Panels>
- </Tab.Group>
-
- <div className="mt-6 flex justify-between border-t border-mineshaft-600 pt-4">
- <Button type="button" variant="outline_bg" onClick={handlePrev}>
- {selectedStepIndex === 0 ? "Cancel" : "Back"}
- </Button>
- <Button
- type="button"
- onClick={handleNext}
- isLoading={isCreating || isUpdating}
- isDisabled={isCreating || isUpdating}
- >
- {isFinalStep && (policyData?.policyId ? "Update" : "Create")}
- {!isFinalStep && "Next"}
- </Button>
- </div>
- </form>
- </FormProvider>
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx
deleted file mode 100644
index c5e25ad2f1..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import ms from "ms";
-import { z } from "zod";
-
-import { ApprovalStepsSchema } from "@app/components/approvals";
-import { ApproverType, EnforcementLevel } from "@app/hooks/api/approvalPolicies";
-
-const DurationSchema = (
- min = 30,
- max = 604800,
- msg = "Duration must be between 30 seconds and 7 days"
-) =>
- z.string().refine(
- (val) => {
- const duration = ms(val) / 1000;
- return duration >= min && duration <= max;
- },
- { message: msg }
- );
-
-export const PolicyFormSchema = z.object({
- name: z.string().min(1, "Policy name is required").max(128),
- maxRequestTtl: DurationSchema(
- 3600,
- 2592000,
- "Duration must be between 1 hour and 30 days"
- ).nullish(),
- conditions: z
- .object({
- resourceNames: z.string().array().optional(),
- accountNames: z.string().array().optional()
- })
- .superRefine((data, ctx) => {
- // At least one condition type must be provided
- const hasResourceNames = data.resourceNames && data.resourceNames.length > 0;
- const hasAccountNames = data.accountNames && data.accountNames.length > 0;
- if (!hasResourceNames && !hasAccountNames) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message: "At least one condition type must be provided (Resource Names or Account Names)",
- path: ["resourceNames"]
- });
- }
- })
- .array()
- .min(1, "At least one condition is required"),
- constraints: z.object({
- accessDuration: z.object({
- min: DurationSchema(),
- max: DurationSchema()
- })
- }),
- steps: ApprovalStepsSchema,
- enforcementLevel: z.nativeEnum(EnforcementLevel),
- userBypassers: z.object({ type: z.literal(ApproverType.User), id: z.string() }).array(),
- groupBypassers: z.object({ type: z.literal(ApproverType.Group), id: z.string() }).array()
-});
-
-export type TPolicyForm = z.infer<typeof PolicyFormSchema>;
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
deleted file mode 100644
index dfc1073160..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
+++ /dev/null
@@ -1,217 +0,0 @@
-import { useMemo } from "react";
-import { Controller, useFormContext } from "react-hook-form";
-import { MultiValue } from "react-select";
-
-import { TtlFormLabel } from "@app/components/features";
-import { FilterableSelect, FormControl, Input, Switch } from "@app/components/v2";
-import { useProject } from "@app/context";
-import { getMemberLabel } from "@app/helpers/members";
-import { useGetWorkspaceUsers, useListWorkspaceGroups } from "@app/hooks/api";
-import { ApproverType, EnforcementLevel } from "@app/hooks/api/approvalPolicies";
-
-import { TPolicyForm } from "../PolicySchema";
-
-export const PolicyDetailsStep = () => {
- const { control, watch } = useFormContext<TPolicyForm>();
-
- const { currentProject } = useProject();
- const projectId = currentProject?.id || "";
- const { data: members = [] } = useGetWorkspaceUsers(projectId);
- const { data: groups = [] } = useListWorkspaceGroups(projectId);
-
- const enforcementLevel = watch("enforcementLevel");
- const userBypassers = watch("userBypassers") || [];
- const groupBypassers = watch("groupBypassers") || [];
- const bypasserCount = userBypassers.length + groupBypassers.length;
- const isSoft = enforcementLevel === EnforcementLevel.Soft;
-
- const userBypasserOptions = useMemo(
- () =>
- members.map((member) => ({
- id: member.user.id,
- type: ApproverType.User as const
- })),
- [members]
- );
-
- const groupBypasserOptions = useMemo(
- () => groups?.map(({ group }) => ({ id: group.id, type: ApproverType.Group as const })) ?? [],
- [groups]
- );
-
- return (
- <div className="flex flex-col gap-4">
- <div className="flex w-full gap-4">
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Policy Name"
- className="mb-0 flex-1"
- isRequired
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <Input {...field} placeholder="Enter policy name" />
- </FormControl>
- )}
- />
-
- <Controller
- control={control}
- name="constraints.accessDuration.max"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="Max. Access Duration" />}
- className="mb-0"
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <Input {...field} />
- </FormControl>
- )}
- />
- </div>
-
- <Controller
- control={control}
- name="conditions.0.resourceNames"
- render={({ field: resourceField, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- label="Resource Names"
- isError={Boolean(error)}
- errorText={error?.message}
- helperText="Comma-separated list of resource names this policy applies to. Glob patterns supported: * matches any characters except / (e.g., prod-* matches prod-db), ** matches across nested levels (e.g., prod/** matches prod/db/main)."
- >
- <Input
- value={resourceField.value?.join(",") ?? ""}
- onChange={(e) => {
- const { value } = e.target;
- resourceField.onChange(value ? value.split(",").map((name) => name.trim()) : []);
- }}
- placeholder="e.g., prod-*, staging-db, *"
- />
- </FormControl>
- )}
- />
-
- <Controller
- control={control}
- name="conditions.0.accountNames"
- render={({ field: accountField, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- label="Account Names"
- isError={Boolean(error)}
- errorText={error?.message}
- helperText="Supports glob patterns. Use * to match within a single level (e.g., admin-* matches admin-ro but not admin/ro). Use ** to match across all depths (e.g., admin/** matches admin/ro/dev)."
- >
- <Input
- value={accountField.value?.join(",") ?? ""}
- onChange={(e) => {
- const { value } = e.target;
- accountField.onChange(value ? value.split(",").map((name) => name.trim()) : []);
- }}
- placeholder="e.g., admin-*, readonly, *"
- />
- </FormControl>
- )}
- />
-
- <Controller
- control={control}
- name="enforcementLevel"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- label="Bypass Approvals"
- isError={Boolean(error)}
- errorText={error?.message}
- className="mb-0"
- >
- <Switch
- id="bypass-approvals"
- thumbClassName="bg-mineshaft-800"
- isChecked={value === EnforcementLevel.Soft}
- onCheckedChange={(v) => onChange(v ? EnforcementLevel.Soft : EnforcementLevel.Hard)}
- >
- Allow certain users to bypass policy in break-glass situations
- </Switch>
- </FormControl>
- )}
- />
-
- {isSoft && (
- <>
- <div className="flex gap-2">
- <Controller
- control={control}
- name="userBypassers"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- label="User Bypassers"
- isError={Boolean(error)}
- errorText={error?.message}
- className="mb-0 w-1/2"
- >
- <FilterableSelect
- isMulti
- placeholder="Select members..."
- options={userBypasserOptions}
- getOptionValue={(option) => option.id}
- getOptionLabel={(option) => {
- const member = members?.find((m) => m.user.id === option.id);
- if (!member) return option.id;
- return getMemberLabel(member);
- }}
- value={value || []}
- onChange={(selected) => {
- onChange(
- (selected as MultiValue<{ type: ApproverType.User; id: string }>) || []
- );
- }}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="groupBypassers"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- label="Group Bypassers"
- isError={Boolean(error)}
- errorText={error?.message}
- className="mb-0 w-1/2"
- >
- <FilterableSelect
- isMulti
- placeholder="Select groups..."
- options={groupBypasserOptions}
- getOptionValue={(option) => option.id}
- getOptionLabel={(option) =>
- groups?.find(({ group }) => group.id === option.id)?.group.name ?? option.id
- }
- value={value || []}
- onChange={(selected) => {
- onChange(
- (selected as MultiValue<{ type: ApproverType.Group; id: string }>) || []
- );
- }}
- />
- </FormControl>
- )}
- />
- </div>
-
- {bypasserCount <= 0 && (
- <div className="mt-1 flex rounded-r border-l-2 border-l-red-500 bg-mineshaft-300/5 px-4 py-2.5 text-sm text-bunker-300">
- Not selecting specific users or groups will allow anyone to bypass this policy.
- </div>
- )}
- </>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx
deleted file mode 100644
index eb8de52182..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx
+++ /dev/null
@@ -1,230 +0,0 @@
-import { useFormContext } from "react-hook-form";
-import { faUsers } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { useProject } from "@app/context";
-import { getMemberLabel } from "@app/helpers/members";
-import { useGetWorkspaceUsers, useListWorkspaceGroups } from "@app/hooks/api";
-import { ApproverType, EnforcementLevel } from "@app/hooks/api/approvalPolicies";
-
-import { TPolicyForm } from "../PolicySchema";
-
-const ReviewField = ({ label, value }: { label: string; value: string | number }) => (
- <div className="flex gap-x-8">
- <span className="min-w-[140px] text-sm text-mineshaft-400">{label}</span>
- <span className="text-sm text-mineshaft-200">{value}</span>
- </div>
-);
-
-export const PolicyReviewStep = () => {
- const { getValues } = useFormContext<TPolicyForm>();
- const { currentProject } = useProject();
- const projectId = currentProject?.id || "";
-
- const { data: members = [] } = useGetWorkspaceUsers(projectId);
- const { data: groups = [] } = useListWorkspaceGroups(projectId);
-
- const name = getValues("name");
- const conditions = getValues("conditions") as {
- resourceNames?: string[];
- accountNames?: string[];
- }[];
- const constraints = getValues("constraints");
- const steps = getValues("steps");
- const enforcementLevel = getValues("enforcementLevel");
- const userBypassers = getValues("userBypassers") || [];
- const groupBypassers = getValues("groupBypassers") || [];
- const isSoft = enforcementLevel === EnforcementLevel.Soft;
- const bypasserCount = userBypassers.length + groupBypassers.length;
-
- const getUserLabel = (userId: string) => {
- const member = members?.find((m) => m.user.id === userId);
- return member ? getMemberLabel(member) : userId;
- };
-
- const getGroupLabel = (groupId: string) => {
- const group = groups?.find(({ group: g }) => g.id === groupId);
- return group ? group.group.name : groupId;
- };
-
- const getApproverLabel = (approverId: string, approverType: ApproverType) =>
- approverType === ApproverType.User ? getUserLabel(approverId) : getGroupLabel(approverId);
-
- const resourceNames = conditions[0]?.resourceNames || [];
- const accountNames = conditions[0]?.accountNames || [];
-
- return (
- <div className="space-y-6">
- <div>
- <div className="mb-3 border-b border-mineshaft-600 pb-2">
- <h3 className="text-sm font-medium text-mineshaft-200">Policy Configuration</h3>
- </div>
- <div className="grid grid-cols-2 gap-2">
- <ReviewField label="Policy Name" value={name || "Not set"} />
- <ReviewField label="Max. Access Duration" value={constraints.accessDuration.max} />
- {resourceNames.length > 0 && (
- <ReviewField label="Resource Names" value={resourceNames.join(", ")} />
- )}
- {accountNames.length > 0 && (
- <ReviewField label="Account Names" value={accountNames.join(", ")} />
- )}
- {resourceNames.length === 0 && accountNames.length === 0 && (
- <ReviewField label="Conditions" value="Not set" />
- )}
- </div>
- </div>
-
- <div>
- <div className="mb-3 border-b border-mineshaft-600 pb-2">
- <h3 className="text-sm font-medium text-mineshaft-200">Approval Sequence</h3>
- </div>
- <div className="space-y-3">
- {steps.map((step, index) => {
- const userApprovers = step.approvers.filter((a) => a.type === ApproverType.User);
- const groupApprovers = step.approvers.filter((a) => a.type === ApproverType.Group);
-
- return (
- <div
- key={`step-${index + 1}`}
- className="rounded border border-mineshaft-600 bg-mineshaft-700 p-3"
- >
- <div className="mb-3 flex items-center justify-between">
- <div className="flex items-center gap-2">
- <span className="flex h-6 w-6 items-center justify-center rounded-full bg-primary/20 text-xs font-medium text-primary">
- {index + 1}
- </span>
- <div>
- <span className="text-sm font-medium text-mineshaft-200">
- Step {index + 1}
- {step.name && (
- <span className="ml-2 text-xs text-mineshaft-400">({step.name})</span>
- )}
- </span>
- </div>
- </div>
- <div className="text-xs text-mineshaft-400">
- Requires {step.requiredApprovals} approval
- {step.requiredApprovals !== 1 ? "s" : ""}
- </div>
- </div>
-
- <div className="space-y-2">
- {userApprovers.length > 0 && (
- <div>
- <div className="mb-1 text-xs text-mineshaft-400">
- User Approvers ({userApprovers.length}):
- </div>
- <div className="flex flex-wrap gap-2">
- {userApprovers.map((approver, approverIndex) => (
- <div
- key={`step-${index + 1}-user-${approverIndex + 1}`}
- className="flex items-center gap-1.5 rounded bg-mineshaft-700 px-2 py-1 text-xs text-mineshaft-300"
- >
- <FontAwesomeIcon icon={faUsers} className="text-mineshaft-400" />
- <span className="text-mineshaft-200">
- {getApproverLabel(approver.id, ApproverType.User)}
- </span>
- </div>
- ))}
- </div>
- </div>
- )}
-
- {groupApprovers.length > 0 && (
- <div>
- <div className="mb-1 text-xs text-mineshaft-400">
- Group Approvers ({groupApprovers.length}):
- </div>
- <div className="flex flex-wrap gap-2">
- {groupApprovers.map((approver, approverIndex) => (
- <div
- key={`step-${index + 1}-group-${approverIndex + 1}`}
- className="flex items-center gap-1.5 rounded bg-mineshaft-700 px-2 py-1 text-xs text-mineshaft-300"
- >
- <FontAwesomeIcon icon={faUsers} className="text-mineshaft-400" />
- <span className="text-mineshaft-200">
- {getApproverLabel(approver.id, ApproverType.Group)}
- </span>
- </div>
- ))}
- </div>
- </div>
- )}
-
- {step.approvers.length === 0 && (
- <span className="text-xs text-mineshaft-500">No approvers defined</span>
- )}
- </div>
- </div>
- );
- })}
- </div>
- </div>
-
- <div>
- <div className="mb-3 border-b border-mineshaft-600 pb-2">
- <h3 className="text-sm font-medium text-mineshaft-200">Bypass Approvals</h3>
- </div>
- {!isSoft ? (
- <ReviewField label="Status" value="Disabled" />
- ) : (
- <div className="space-y-3">
- <ReviewField label="Status" value="Enabled" />
- {bypasserCount === 0 ? (
- <div className="mt-1 flex rounded-r border-l-2 border-l-red-500 bg-mineshaft-300/5 px-4 py-2.5 text-sm text-bunker-300">
- Not selecting specific users or groups will allow anyone to bypass this policy.
- </div>
- ) : (
- <div className="space-y-2">
- {userBypassers.length > 0 && (
- <div>
- <div className="mb-1 text-xs text-mineshaft-400">
- User Bypassers ({userBypassers.length}):
- </div>
- <div className="flex flex-wrap gap-2">
- {userBypassers.map((b, i) => (
- <div
- key={`bypasser-user-${i + 1}`}
- className="flex items-center gap-1.5 rounded bg-mineshaft-700 px-2 py-1 text-xs text-mineshaft-300"
- >
- <FontAwesomeIcon icon={faUsers} className="text-mineshaft-400" />
- <span className="text-mineshaft-200">{getUserLabel(b.id)}</span>
- </div>
- ))}
- </div>
- </div>
- )}
- {groupBypassers.length > 0 && (
- <div>
- <div className="mb-1 text-xs text-mineshaft-400">
- Group Bypassers ({groupBypassers.length}):
- </div>
- <div className="flex flex-wrap gap-2">
- {groupBypassers.map((b, i) => (
- <div
- key={`bypasser-group-${i + 1}`}
- className="flex items-center gap-1.5 rounded bg-mineshaft-700 px-2 py-1 text-xs text-mineshaft-300"
- >
- <FontAwesomeIcon icon={faUsers} className="text-mineshaft-400" />
- <span className="text-mineshaft-200">{getGroupLabel(b.id)}</span>
- </div>
- ))}
- </div>
- </div>
- )}
- </div>
- )}
- </div>
- )}
- </div>
-
- {/* Summary Notice */}
- <div className="rounded-md border border-primary/30 bg-primary/5 p-3">
- <p className="text-xs text-mineshaft-300">
- Please review all the details above. Submit to save this policy or go back to make
- changes.
- </p>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/index.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/index.tsx
deleted file mode 100644
index ca5752533c..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export { PolicyDetailsStep } from "./PolicyDetailsStep";
-export { PolicyReviewStep } from "./PolicyReviewStep";
-export { PolicyApprovalSteps } from "@app/components/approvals";
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/index.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/index.tsx
deleted file mode 100644
index af44d67b8e..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/index.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-export { PoliciesTable } from "./PoliciesTable";
-export { PolicyModal } from "./PolicyModal";
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/index.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/index.tsx
deleted file mode 100644
index 5a3f85b4f7..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { PolicyTab } from "./PolicyTab";
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx
deleted file mode 100644
index ec253182a0..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx
+++ /dev/null
@@ -1,466 +0,0 @@
-import { useMemo, useState } from "react";
-import { useForm } from "react-hook-form";
-import {
- faCheckCircle,
- faChevronRight,
- faEllipsisV,
- faFileCircleQuestion,
- faFilter,
- faInfo,
- faMagnifyingGlass,
- faSearch,
- faXmark
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { useQuery } from "@tanstack/react-query";
-import { Link } from "@tanstack/react-router";
-import { formatDistance } from "date-fns";
-import { twMerge } from "tailwind-merge";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuTrigger,
- DropdownSubMenu,
- DropdownSubMenuContent,
- DropdownSubMenuTrigger,
- EmptyState,
- FormControl,
- IconButton,
- Input,
- Modal,
- ModalContent,
- Pagination,
- Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- TextArea,
- Th,
- THead,
- Tooltip,
- Tr
-} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
-import { useProject } from "@app/context";
-import { getMemberLabel } from "@app/helpers/members";
-import { getUserTablePreference, PreferenceKey } from "@app/helpers/userTablePreferences";
-import { usePagination } from "@app/hooks";
-import { useGetWorkspaceUsers } from "@app/hooks/api";
-import {
- approvalGrantQuery,
- ApprovalGrantStatus,
- PamAccessGrantAttributes,
- useRevokeApprovalGrant
-} from "@app/hooks/api/approvalGrants";
-import { ApprovalPolicyScope, ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
-
-const revokeGrantSchema = z.object({
- revocationReason: z.string().max(256).optional()
-});
-
-type TRevokeGrantForm = z.infer<typeof revokeGrantSchema>;
-
-const getStatusBadgeColor = (status: ApprovalGrantStatus) => {
- switch (status) {
- case ApprovalGrantStatus.Active:
- return "success";
- case ApprovalGrantStatus.Expired:
- return "neutral";
- case ApprovalGrantStatus.Revoked:
- return "danger";
- default:
- return "neutral";
- }
-};
-
-export const RequestGrantTab = () => {
- const { currentProject } = useProject();
- const [search, setSearch] = useState("");
- const [filter, setFilter] = useState(ApprovalGrantStatus.Active);
- const [revokeModalOpen, setRevokeModalOpen] = useState(false);
- const [grantToRevoke, setGrantToRevoke] = useState<string | null>(null);
- const { data: members = [] } = useGetWorkspaceUsers(currentProject.id);
-
- const projectId = currentProject?.id || "";
-
- const { data: grants = [], isPending: isGrantsLoading } = useQuery(
- approvalGrantQuery.list({
- policyType: ApprovalPolicyType.PamAccess,
- scope: ApprovalPolicyScope.Project,
- id: projectId
- })
- );
-
- const { mutateAsync: revokeGrant, isPending: isRevoking } = useRevokeApprovalGrant();
-
- const {
- register,
- handleSubmit,
- reset,
- formState: { errors }
- } = useForm<TRevokeGrantForm>({
- resolver: zodResolver(revokeGrantSchema)
- });
-
- const { page, perPage, setPage, setPerPage, offset } = usePagination("", {
- initPerPage: getUserTablePreference("pamApprovalGrants", PreferenceKey.PerPage, 20)
- });
-
- const filteredGrants = useMemo(() => {
- let filtered = grants;
-
- // Apply search filter
- if (search) {
- filtered = filtered.filter((grant) => {
- if (grant.type !== ApprovalPolicyType.PamAccess) return false;
- const attrs = grant.attributes as PamAccessGrantAttributes;
- const searchLower = search.toLowerCase();
- return (
- attrs.resourceName?.toLowerCase().includes(searchLower) ||
- attrs.accountName?.toLowerCase().includes(searchLower) ||
- grant.id.toLowerCase().includes(searchLower)
- );
- });
- }
-
- return filtered.filter((grant) => grant.status === filter);
- }, [grants, search, filter]);
-
- const paginatedGrants = useMemo(
- () => filteredGrants.slice(offset, offset + perPage),
- [filteredGrants, offset, perPage]
- );
-
- const openRevokeModal = (grantId: string) => {
- setGrantToRevoke(grantId);
- setRevokeModalOpen(true);
- };
-
- const closeRevokeModal = () => {
- setRevokeModalOpen(false);
- setGrantToRevoke(null);
- reset();
- };
-
- const getGrantedUser = (grantedUserId: string) => {
- const member = members?.find((m) => m.user.id === grantedUserId);
- if (member) {
- return getMemberLabel(member);
- }
- return grantedUserId;
- };
-
- const handleRevokeGrant = async (data: TRevokeGrantForm) => {
- if (!grantToRevoke) return;
-
- try {
- await revokeGrant({
- policyType: ApprovalPolicyType.PamAccess,
- grantId: grantToRevoke,
- revocationReason: data.revocationReason
- });
-
- createNotification({
- text: "Grant revoked successfully",
- type: "success"
- });
-
- closeRevokeModal();
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to revoke grant",
- type: "error"
- });
- }
- };
-
- const isTableFiltered = filter !== ApprovalGrantStatus.Active;
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="mb-4">
- <div className="flex items-center gap-x-2">
- <p className="text-xl font-medium text-mineshaft-100">Access Grants</p>
- </div>
- <p className="text-sm text-bunker-300">View and revoke access grants to PAM accounts</p>
- </div>
- <div>
- <div className="flex gap-2">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Filter Grants"
- variant="plain"
- size="sm"
- className={twMerge(
- "flex h-9.5 w-[2.6rem] items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",
- isTableFiltered && "border-primary/50 text-primary"
- )}
- >
- <FontAwesomeIcon icon={faFilter} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="p-0">
- <DropdownMenuLabel>Filter By</DropdownMenuLabel>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalGrantStatus.Active);
- }}
- icon={
- filter === ApprovalGrantStatus.Active && <FontAwesomeIcon icon={faCheckCircle} />
- }
- iconPos="right"
- >
- Active Grants
- </DropdownMenuItem>
- <DropdownSubMenu>
- <DropdownSubMenuTrigger
- iconPos="right"
- icon={<FontAwesomeIcon icon={faChevronRight} size="sm" />}
- >
- Inactive Grants
- </DropdownSubMenuTrigger>
- <DropdownSubMenuContent className="max-h-80 thin-scrollbar overflow-y-auto rounded-l-none">
- <DropdownMenuLabel className="sticky top-0 bg-mineshaft-900">
- Filter by Status
- </DropdownMenuLabel>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalGrantStatus.Expired);
- }}
- icon={
- filter === ApprovalGrantStatus.Expired && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Expired
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(evt) => {
- evt.preventDefault();
- setFilter(ApprovalGrantStatus.Revoked);
- }}
- icon={
- filter === ApprovalGrantStatus.Revoked && (
- <FontAwesomeIcon icon={faCheckCircle} />
- )
- }
- iconPos="right"
- >
- Revoked
- </DropdownMenuItem>
- </DropdownSubMenuContent>
- </DropdownSubMenu>
- </DropdownMenuContent>
- </DropdownMenu>
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search access grants..."
- />
- </div>
- <TableContainer className="mt-4">
- <Table>
- <THead>
- <Tr>
- <Th>User</Th>
- <Th>Resource</Th>
- <Th>Account</Th>
- <Th>Access Duration</Th>
- <Th>Status</Th>
- <Th>Granted</Th>
- <Th>Expires</Th>
- <Th className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isGrantsLoading && <TableSkeleton columns={8} innerKey="access-grants" />}
- {!isGrantsLoading &&
- paginatedGrants.map((grant) => {
- if (grant.type !== ApprovalPolicyType.PamAccess) return null;
- const attrs = grant.attributes as PamAccessGrantAttributes;
- const isActive = grant.status === ApprovalGrantStatus.Active;
-
- return (
- <Tr key={grant.id} className="group">
- <Td>
- {grant.granteeUserId ? getGrantedUser(grant.granteeUserId) : "Unknown"}
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-200">
- {attrs.resourceName || "-"}
- </span>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-200">
- {attrs.accountName || "-"}
- </span>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-200">{attrs.accessDuration}</span>
- </Td>
- <Td>
- <div className="flex items-center gap-2">
- <Badge
- variant={
- isActive
- ? getStatusBadgeColor(ApprovalGrantStatus.Active)
- : getStatusBadgeColor(grant.status)
- }
- className="capitalize"
- >
- {isActive ? "Active" : grant.status}
- </Badge>
- {grant.isBreakGlass && (
- <Tooltip
- content={
- <span className="block max-w-xs text-xs break-words">
- Reason: {grant.bypassReason || "No reason provided"}
- </span>
- }
- >
- <span className="cursor-default rounded bg-red-500/20 px-2 py-0.5 text-xs text-red-300">
- Bypassed
- </span>
- </Tooltip>
- )}
- </div>
- </Td>
- <Td>
- <span className="text-sm text-mineshaft-400">
- {formatDistance(new Date(grant.createdAt), new Date(), {
- addSuffix: true
- })}
- </span>
- </Td>
- <Td>
- {grant.expiresAt ? (
- <span className="text-sm text-mineshaft-400">
- {formatDistance(new Date(grant.expiresAt), new Date(), {
- addSuffix: true
- })}
- </span>
- ) : (
- <span className="text-sm text-mineshaft-500">Never</span>
- )}
- </Td>
- <Td
- onClick={(e) => {
- e.stopPropagation();
- }}
- >
- {isActive && (
- <DropdownMenu>
- <DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
- <Tooltip content="More options">
- <IconButton
- ariaLabel="More options"
- variant="plain"
- className="w-4 p-0"
- size="md"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </Tooltip>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="p-1" sideOffset={5}>
- <Link
- to="/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId"
- params={{
- orgId: currentProject.orgId,
- projectId: currentProject.id,
- approvalRequestId: grant.requestId || ""
- }}
- >
- <DropdownMenuItem icon={<FontAwesomeIcon icon={faInfo} />}>
- Request Details
- </DropdownMenuItem>
- </Link>
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- openRevokeModal(grant.id);
- }}
- icon={<FontAwesomeIcon icon={faXmark} />}
- >
- Revoke Grant
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- )}
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {Boolean(filteredGrants.length) && (
- <Pagination
- count={filteredGrants.length}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- {!isGrantsLoading && !filteredGrants?.length && (
- <EmptyState
- title={grants.length ? "No access grants match search..." : "No access grants found"}
- icon={grants.length ? faSearch : faFileCircleQuestion}
- />
- )}
- </TableContainer>
-
- <Modal isOpen={revokeModalOpen} onOpenChange={(open) => !open && closeRevokeModal()}>
- <ModalContent
- title="Revoke Access Grant"
- subTitle="Are you sure you want to revoke this access grant? This action cannot be undone."
- >
- <form onSubmit={handleSubmit(handleRevokeGrant)}>
- <FormControl
- label="Revocation Reason (Optional)"
- isError={Boolean(errors.revocationReason)}
- errorText={errors.revocationReason?.message}
- >
- <TextArea
- {...register("revocationReason")}
- placeholder="Provide a reason for revoking this grant..."
- rows={4}
- />
- </FormControl>
- <div className="mt-6 flex items-center space-x-4">
- <Button
- colorSchema="danger"
- type="submit"
- isLoading={isRevoking}
- isDisabled={isRevoking}
- >
- Revoke Grant
- </Button>
- <Button variant="outline_bg" onClick={closeRevokeModal} isDisabled={isRevoking}>
- Cancel
- </Button>
- </div>
- </form>
- </ModalContent>
- </Modal>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/index.tsx b/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/index.tsx
deleted file mode 100644
index 507cf13b77..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { RequestGrantTab } from "./RequestGrantTab";
diff --git a/frontend/src/pages/pam/ApprovalsPage/route.tsx b/frontend/src/pages/pam/ApprovalsPage/route.tsx
deleted file mode 100644
index 5bc6f7b330..0000000000
--- a/frontend/src/pages/pam/ApprovalsPage/route.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { createFileRoute, stripSearchParams } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { ApprovalControlTabs } from "@app/types/project";
-
-import { ApprovalsPage } from "./ApprovalsPage";
-
-const ApprovalPagePageQuerySchema = z.object({
- selectedTab: z.nativeEnum(ApprovalControlTabs).catch(ApprovalControlTabs.Requests)
-});
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/"
-)({
- component: ApprovalsPage,
- validateSearch: zodValidator(ApprovalPagePageQuerySchema),
- search: {
- middlewares: [stripSearchParams({})]
- },
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Approvals"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/InsightsPage/InsightsPage.tsx b/frontend/src/pages/pam/InsightsPage/InsightsPage.tsx
deleted file mode 100644
index 141f6eb34a..0000000000
--- a/frontend/src/pages/pam/InsightsPage/InsightsPage.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import { Helmet } from "react-helmet";
-
-import { PageHeader } from "@app/components/v2";
-import { ProjectPermissionPamInsightsActions, ProjectPermissionSub } from "@app/context";
-import { withProjectPermission } from "@app/hoc";
-import { ProjectType } from "@app/hooks/api/projects/types";
-
-import {
- PamInsightsKpiCards,
- PamResourceBreakdown,
- PamRotationCalendar,
- PamSessionActivityChart,
- PamTopActors
-} from "./components";
-
-export const InsightsPage = withProjectPermission(
- () => {
- return (
- <>
- <Helmet>
- <title>PAM Insights</title>
- </Helmet>
- <PageHeader
- scope={ProjectType.PAM}
- title="PAM Insights"
- description="Monitor privileged access activity, account rotation health, and session usage across your project."
- />
- <PamInsightsKpiCards />
- <div className="mt-6 grid grid-cols-1 gap-6 xl:grid-cols-[1.3fr_1fr]">
- <div className="flex flex-col gap-6">
- <PamRotationCalendar />
- <PamResourceBreakdown />
- </div>
- <div className="flex flex-col gap-6">
- <PamSessionActivityChart />
- <PamTopActors />
- </div>
- </div>
- </>
- );
- },
- {
- action: ProjectPermissionPamInsightsActions.Read,
- subject: ProjectPermissionSub.PamInsights
- }
-);
diff --git a/frontend/src/pages/pam/InsightsPage/components/PamInsightsKpiCards.tsx b/frontend/src/pages/pam/InsightsPage/components/PamInsightsKpiCards.tsx
deleted file mode 100644
index 5cd63321ce..0000000000
--- a/frontend/src/pages/pam/InsightsPage/components/PamInsightsKpiCards.tsx
+++ /dev/null
@@ -1,350 +0,0 @@
-import { useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
-import { formatDistanceToNow, parseISO } from "date-fns";
-import {
- ActivityIcon,
- AlertTriangleIcon,
- CheckIcon,
- DatabaseIcon,
- ExternalLinkIcon,
- InfoIcon,
- KeyRoundIcon
-} from "lucide-react";
-
-import {
- Badge,
- Button,
- Card,
- CardAction,
- CardContent,
- CardHeader,
- CardTitle,
- Popover,
- PopoverContent,
- PopoverTrigger,
- Separator,
- Skeleton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { cn } from "@app/components/v3/utils";
-import { useOrganization, useProject } from "@app/context";
-import { PamResourceType } from "@app/hooks/api/pam/enums";
-import { PAM_RESOURCE_TYPE_MAP } from "@app/hooks/api/pam/maps";
-import { useGetPamInsightsSummary } from "@app/hooks/api/pamInsights";
-import { TPamFailedRotationAccount } from "@app/hooks/api/pamInsights/types";
-
-const knownResourceTypes = Object.values(PamResourceType) as string[];
-
-const accountRoute =
- "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId" as const;
-
-type IconVariant = "warning" | "info" | "success" | "danger";
-type FootnoteVariant = "success" | "info" | "danger" | "warning";
-
-type StatCardProps = {
- title: string;
- icon: React.ReactNode;
- iconVariant: IconVariant;
- count: number;
- subtitle: string;
- footnote: React.ReactNode;
- footnoteVariant: FootnoteVariant;
- footnoteTooltip?: React.ReactNode;
- viewLabel?: string;
- to?: string;
- params?: Record<string, string>;
- popoverContent?: React.ReactNode;
- popoverDisabled?: boolean;
-};
-
-const FailedRotationsTable = ({
- accounts,
- orgId,
- projectId
-}: {
- accounts: TPamFailedRotationAccount[];
- orgId: string;
- projectId: string;
-}) => {
- const navigate = useNavigate();
- if (!accounts.length) {
- return <p className="p-4 text-center text-xs text-muted">No failed rotations</p>;
- }
- return (
- <Table containerClassName="max-h-72">
- <TableHeader className="sticky top-0 z-10 bg-container shadow-[inset_0_-1px_0_var(--color-border)]">
- <TableRow>
- <TableHead>Account</TableHead>
- <TableHead>Resource</TableHead>
- <TableHead>Last Rotated</TableHead>
- <TableHead className="w-8" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {accounts.map((account) => {
- const meta = knownResourceTypes.includes(account.resourceType)
- ? PAM_RESOURCE_TYPE_MAP[account.resourceType as PamResourceType]
- : null;
- return (
- <TableRow
- key={account.accountId}
- onClick={() =>
- navigate({
- to: accountRoute,
- params: {
- orgId,
- projectId,
- resourceType: account.resourceType,
- resourceId: account.resourceId,
- accountId: account.accountId
- }
- })
- }
- >
- <TableCell className="max-w-[140px] truncate font-medium" title={account.accountName}>
- {account.accountName}
- </TableCell>
- <TableCell>
- <div className="flex items-center gap-1.5">
- {meta?.image && (
- <img
- src={`/images/integrations/${meta.image}`}
- alt={meta.name}
- className="size-3.5 shrink-0 object-contain"
- />
- )}
- <span className="max-w-[110px] truncate text-muted" title={account.resourceName}>
- {account.resourceName}
- </span>
- </div>
- </TableCell>
- <TableCell className="text-muted">
- {account.lastRotatedAt
- ? formatDistanceToNow(parseISO(account.lastRotatedAt), { addSuffix: true })
- : "Never"}
- </TableCell>
- <TableCell className="w-8 px-2">
- <ExternalLinkIcon className="size-3.5 text-muted" />
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- );
-};
-
-const LiveBadge = ({ count }: { count: number }) => (
- <Badge variant="success" className="animate-pulse">
- <ActivityIcon />
- {count === 1 ? "1 session live" : `${count} sessions live`}
- </Badge>
-);
-
-const renderFootnoteIcon = (variant: FootnoteVariant) => {
- if (variant === "success") return <CheckIcon />;
- if (variant === "danger" || variant === "warning") return <AlertTriangleIcon />;
- return <InfoIcon />;
-};
-
-const computeResourcesFootnote = (totalResources: number, resourcesWithRotation: number) => {
- if (totalResources === 0) {
- return { text: "No resources yet", variant: "info" as const };
- }
- const pct = (resourcesWithRotation / totalResources) * 100;
- const text = `${resourcesWithRotation} of ${totalResources} with rotation`;
- if (pct === 100) return { text: "All resources covered", variant: "success" as const };
- if (pct >= 50) return { text, variant: "warning" as const };
- return { text, variant: "danger" as const };
-};
-
-const computeAccountsFootnote = (totalAccounts: number, failedRotations: number) => {
- if (totalAccounts === 0) {
- return { text: "No accounts yet", variant: "info" as const };
- }
- if (failedRotations > 0) {
- return {
- text: `${failedRotations} failed rotation${failedRotations === 1 ? "" : "s"}`,
- variant: "danger" as const
- };
- }
- return { text: "All rotations healthy", variant: "success" as const };
-};
-
-const StatCard = ({
- title,
- icon,
- iconVariant,
- count,
- subtitle,
- footnote,
- footnoteVariant,
- footnoteTooltip,
- viewLabel,
- to,
- params,
- popoverContent,
- popoverDisabled
-}: StatCardProps) => {
- const navigate = useNavigate();
- const [popoverOpen, setPopoverOpen] = useState(false);
- const renderBadge = () => {
- if (typeof footnote !== "string") return footnote;
- const badge = (
- <Badge variant={footnoteVariant}>
- {renderFootnoteIcon(footnoteVariant)}
- {footnote}
- </Badge>
- );
- if (!footnoteTooltip) return badge;
- return (
- <Tooltip>
- <TooltipTrigger asChild>{badge}</TooltipTrigger>
- <TooltipContent side="bottom" className="max-w-xs">
- {footnoteTooltip}
- </TooltipContent>
- </Tooltip>
- );
- };
- return (
- <Card className="flex-1">
- <CardHeader>
- <CardTitle>{title}</CardTitle>
- <CardAction>
- <div
- className={cn(
- "flex size-9 items-center justify-center rounded-md border [&>svg]:size-5",
- iconVariant === "info" && "border-info/15 bg-info/10 text-info",
- iconVariant === "warning" && "border-warning/15 bg-warning/10 text-warning",
- iconVariant === "success" && "border-success/15 bg-success/10 text-success",
- iconVariant === "danger" && "border-danger/15 bg-danger/10 text-danger"
- )}
- >
- {icon}
- </div>
- </CardAction>
- </CardHeader>
- <CardContent className="flex flex-col gap-3">
- <div>
- <span className="text-2xl font-semibold">{count.toLocaleString()}</span>
- <span className="ml-2 text-sm text-muted">{subtitle}</span>
- </div>
- <Separator />
- <div className="flex min-h-7 items-center justify-between">
- {renderBadge()}
- {popoverContent && viewLabel ? (
- <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>
- <PopoverTrigger asChild>
- <Button variant="outline" size="xs" disabled={popoverDisabled}>
- {viewLabel}
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-[480px] p-0" align="end">
- {popoverContent}
- </PopoverContent>
- </Popover>
- ) : (
- viewLabel &&
- to &&
- params &&
- count > 0 && (
- <Button variant="outline" size="xs" onClick={() => navigate({ to, params })}>
- {viewLabel}
- </Button>
- )
- )}
- </div>
- </CardContent>
- </Card>
- );
-};
-
-export const PamInsightsKpiCards = () => {
- const { currentOrg } = useOrganization();
- const { projectId } = useProject();
- const { data, isPending } = useGetPamInsightsSummary({ projectId }, { enabled: !!projectId });
- const params = { orgId: currentOrg.id, projectId };
-
- if (isPending) {
- return (
- <div className="flex flex-col gap-6 xl:flex-row">
- <Skeleton className="h-[183px] flex-1" />
- <Skeleton className="h-[183px] flex-1" />
- <Skeleton className="h-[183px] flex-1" />
- </div>
- );
- }
-
- const totalResources = data?.totalResources ?? 0;
- const resourcesWithRotation = data?.resourcesWithRotation ?? 0;
- const totalAccounts = data?.totalAccounts ?? 0;
- const failedRotations = data?.failedRotations ?? 0;
- const failedRotationAccounts = data?.failedRotationAccounts ?? [];
- const activeSessions = data?.activeSessions ?? 0;
- const resourceTypeCount = data?.resourceTypeCount ?? 0;
-
- const resourcesFootnote = computeResourcesFootnote(totalResources, resourcesWithRotation);
- const accountsFootnote = computeAccountsFootnote(totalAccounts, failedRotations);
-
- return (
- <div className="flex flex-col gap-6 xl:flex-row">
- <StatCard
- title="Total Resources"
- icon={<DatabaseIcon />}
- iconVariant="info"
- count={totalResources}
- subtitle={`Across ${resourceTypeCount} resource types`}
- footnote={resourcesFootnote.text}
- footnoteVariant={resourcesFootnote.variant}
- footnoteTooltip={
- totalResources > 0
- ? "Rotation reduces credential exposure by replacing account passwords on a regular schedule. We recommend configuring rotation on every resource."
- : undefined
- }
- viewLabel="View Resources"
- to="/organizations/$orgId/projects/pam/$projectId/resources"
- params={params}
- />
- <StatCard
- title="Total Accounts"
- icon={<KeyRoundIcon />}
- iconVariant="warning"
- count={totalAccounts}
- subtitle="Privileged credentials"
- footnote={accountsFootnote.text}
- footnoteVariant={accountsFootnote.variant}
- viewLabel={failedRotations > 0 ? "View Failed Rotations" : undefined}
- popoverContent={
- failedRotations > 0 ? (
- <FailedRotationsTable
- accounts={failedRotationAccounts}
- orgId={currentOrg.id}
- projectId={projectId}
- />
- ) : undefined
- }
- popoverDisabled={failedRotations === 0}
- />
- <StatCard
- title="Active Sessions"
- icon={<ActivityIcon />}
- iconVariant="success"
- count={activeSessions}
- subtitle="Currently live"
- footnote={activeSessions > 0 ? <LiveBadge count={activeSessions} /> : "No active sessions"}
- footnoteVariant="info"
- viewLabel="View Sessions"
- to="/organizations/$orgId/projects/pam/$projectId/sessions"
- params={params}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/InsightsPage/components/PamResourceBreakdown.tsx b/frontend/src/pages/pam/InsightsPage/components/PamResourceBreakdown.tsx
deleted file mode 100644
index cb48219138..0000000000
--- a/frontend/src/pages/pam/InsightsPage/components/PamResourceBreakdown.tsx
+++ /dev/null
@@ -1,176 +0,0 @@
-import { Fragment, useMemo } from "react";
-import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts";
-
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
- Empty,
- EmptyHeader,
- EmptyTitle,
- Skeleton
-} from "@app/components/v3";
-import { useProject } from "@app/context";
-import { PamResourceType } from "@app/hooks/api/pam/enums";
-import { PAM_RESOURCE_TYPE_MAP } from "@app/hooks/api/pam/maps";
-import { useGetPamResourceBreakdown } from "@app/hooks/api/pamInsights";
-
-const knownResourceTypes = Object.values(PamResourceType) as string[];
-
-const COLORS = [
- "#63b0bd",
- "#f1c40f",
- "#6dbf8b",
- "#c084d8",
- "#e8855e",
- "#5b9bd5",
- "#e06b8f",
- "#85c46c",
- "#d4a054",
- "#7b8ec4",
- "#cb6b6b",
- "#4fc1b0",
- "#b8a060"
-];
-
-const gradientId = (index: number) => `pam-breakdown-pie-${index}`;
-
-export const PamResourceBreakdown = () => {
- const { projectId } = useProject();
- const { data, isPending } = useGetPamResourceBreakdown({ projectId }, { enabled: !!projectId });
-
- const rows = useMemo(() => {
- if (!data?.breakdown) return [];
- return data.breakdown.map((entry) => {
- const meta = knownResourceTypes.includes(entry.resourceType)
- ? PAM_RESOURCE_TYPE_MAP[entry.resourceType as PamResourceType]
- : null;
- return {
- ...entry,
- displayName: meta?.name ?? entry.resourceType
- };
- });
- }, [data]);
-
- const totalResources = useMemo(() => rows.reduce((sum, r) => sum + r.resourceCount, 0), [rows]);
-
- return (
- <Card className="h-full">
- <CardHeader>
- <CardTitle>Resources by Type</CardTitle>
- <CardDescription>Breakdown of managed resources across integrations</CardDescription>
- </CardHeader>
- <CardContent>
- {isPending && <Skeleton className="h-[260px] w-full" />}
- {!isPending && rows.length === 0 && (
- <Empty className="border-0">
- <EmptyHeader>
- <EmptyTitle>No resources have been added yet</EmptyTitle>
- </EmptyHeader>
- </Empty>
- )}
- {!isPending && rows.length > 0 && (
- <div className="flex items-center gap-8">
- <div className="shrink-0">
- <ResponsiveContainer width={220} height={220}>
- <PieChart>
- <defs>
- {COLORS.map((color, i) => (
- <radialGradient
- key={gradientId(i)}
- id={gradientId(i)}
- cx="50%"
- cy="50%"
- r="50%"
- gradientUnits="userSpaceOnUse"
- fx="110"
- fy="110"
- >
- <stop offset="0%" stopColor={color} stopOpacity={0.1} />
- <stop offset="55%" stopColor={color} stopOpacity={0.4} />
- <stop offset="100%" stopColor={color} stopOpacity={0.85} />
- </radialGradient>
- ))}
- </defs>
- <Pie
- data={rows}
- dataKey="resourceCount"
- nameKey="displayName"
- cx="50%"
- cy="50%"
- innerRadius={55}
- outerRadius={95}
- strokeWidth={2}
- stroke="var(--color-card)"
- paddingAngle={2}
- isAnimationActive={false}
- >
- {rows.map((entry, index) => (
- <Cell
- key={entry.resourceType}
- fill={`url(#${gradientId(index % COLORS.length)})`}
- style={{ outline: "none" }}
- />
- ))}
- </Pie>
- <Tooltip
- contentStyle={{
- backgroundColor: "var(--color-popover)",
- border: "1px solid var(--color-border)",
- borderRadius: 8,
- fontSize: 12
- }}
- labelStyle={{ color: "var(--color-foreground)" }}
- isAnimationActive={false}
- formatter={(value, name) => [
- `${Number(value).toLocaleString()} (${
- totalResources > 0 ? Math.round((Number(value) / totalResources) * 100) : 0
- }%)`,
- String(name)
- ]}
- />
- </PieChart>
- </ResponsiveContainer>
- </div>
- <div className="grid flex-1 grid-cols-[auto_1fr_auto_auto_auto] items-center gap-x-3 gap-y-2">
- {rows.map((entry, index) => {
- const pct =
- totalResources > 0 ? Math.round((entry.resourceCount / totalResources) * 100) : 0;
- return (
- <Fragment key={entry.resourceType}>
- <span
- className="size-2.5 shrink-0 rounded-full"
- style={{ backgroundColor: COLORS[index % COLORS.length] }}
- />
- <span className="truncate text-sm" title={entry.displayName}>
- {entry.displayName}
- </span>
- <span className="text-right text-sm text-muted">{pct}%</span>
- <span className="text-right text-sm font-medium">
- {entry.resourceCount.toLocaleString()}
- </span>
- <span className="text-left text-xs text-muted">
- {entry.resourceCount === 1 ? "resource" : "resources"}
- </span>
- </Fragment>
- );
- })}
- <div className="col-span-5 mt-1 border-t border-border" />
- <span />
- <span className="text-sm font-medium">Total</span>
- <span />
- <span className="text-right text-sm font-medium">
- {totalResources.toLocaleString()}
- </span>
- <span className="text-left text-xs text-muted">
- {totalResources === 1 ? "resource" : "resources"}
- </span>
- </div>
- </div>
- )}
- </CardContent>
- </Card>
- );
-};
diff --git a/frontend/src/pages/pam/InsightsPage/components/PamRotationCalendar.tsx b/frontend/src/pages/pam/InsightsPage/components/PamRotationCalendar.tsx
deleted file mode 100644
index b16144f91a..0000000000
--- a/frontend/src/pages/pam/InsightsPage/components/PamRotationCalendar.tsx
+++ /dev/null
@@ -1,326 +0,0 @@
-import { useMemo, useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
-import {
- addMonths,
- eachDayOfInterval,
- endOfMonth,
- endOfWeek,
- format,
- isSameMonth,
- isToday,
- parseISO,
- startOfMonth,
- startOfWeek,
- subMonths
-} from "date-fns";
-import { ChevronLeft, ChevronRight, ExternalLink, RefreshCwIcon } from "lucide-react";
-
-import { Lottie } from "@app/components/v2";
-import {
- Badge,
- Button,
- Card,
- CardAction,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
- Detail,
- DetailGroup,
- DetailLabel,
- DetailValue,
- IconButton,
- Popover,
- PopoverContent,
- PopoverTrigger,
- Separator
-} from "@app/components/v3";
-import { useOrganization, useProject } from "@app/context";
-import { PamResourceType } from "@app/hooks/api/pam/enums";
-import { PAM_RESOURCE_TYPE_MAP } from "@app/hooks/api/pam/maps";
-import { TPamRotationCalendarEvent, useGetPamRotationCalendar } from "@app/hooks/api/pamInsights";
-
-const knownResourceTypes = Object.values(PamResourceType) as string[];
-const DAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
-
-const accountRoute =
- "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId" as const;
-
-const formatInterval = (seconds: number): string => {
- const days = Math.round(seconds / 86400);
- if (days <= 0) {
- const hours = Math.max(1, Math.round(seconds / 3600));
- return `every ${hours} hour${hours === 1 ? "" : "s"}`;
- }
- return `every ${days} day${days === 1 ? "" : "s"}`;
-};
-
-const groupEventsByDate = (
- events: TPamRotationCalendarEvent[]
-): Record<string, TPamRotationCalendarEvent[]> => {
- const map: Record<string, TPamRotationCalendarEvent[]> = {};
- events.forEach((event) => {
- const key = format(parseISO(event.nextRotationAt), "yyyy-MM-dd");
- if (!map[key]) map[key] = [];
- map[key].push(event);
- });
- return map;
-};
-
-const RotationEventDetail = ({ event }: { event: TPamRotationCalendarEvent }) => {
- const { currentOrg } = useOrganization();
- const { projectId } = useProject();
- const navigate = useNavigate();
- const meta = knownResourceTypes.includes(event.resourceType)
- ? PAM_RESOURCE_TYPE_MAP[event.resourceType as PamResourceType]
- : null;
- const dateStr = format(parseISO(event.nextRotationAt), "MMM d, yyyy 'at' h:mm a");
-
- return (
- <div className="flex flex-col gap-4">
- <div className="flex items-center justify-between gap-2">
- <h3 className="truncate text-sm font-semibold" title={event.accountName}>
- {event.accountName}
- </h3>
- <Badge variant="info">
- <RefreshCwIcon />
- Rotation
- </Badge>
- </div>
- <Separator />
- <DetailGroup>
- <Detail>
- <DetailLabel>Date</DetailLabel>
- <DetailValue>{dateStr}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Resource</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-1.5">
- {meta?.image && (
- <img
- src={`/images/integrations/${meta.image}`}
- alt={meta.name}
- className="size-3.5 shrink-0 object-contain"
- />
- )}
- <span className="truncate">{event.resourceName}</span>
- </div>
- </DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Type</DetailLabel>
- <DetailValue>{meta?.name ?? event.resourceType}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Interval</DetailLabel>
- <DetailValue>{formatInterval(event.intervalSeconds)}</DetailValue>
- </Detail>
- </DetailGroup>
-
- <Button
- variant="project"
- size="sm"
- isFullWidth
- onClick={() =>
- navigate({
- to: accountRoute,
- params: {
- orgId: currentOrg.id,
- projectId,
- resourceType: event.resourceType,
- resourceId: event.resourceId,
- accountId: event.accountId
- }
- })
- }
- >
- <ExternalLink />
- View Account
- </Button>
- </div>
- );
-};
-
-const RotationEventPill = ({ event }: { event: TPamRotationCalendarEvent }) => {
- const [open, setOpen] = useState(false);
- return (
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <Badge asChild className="justify-start" variant="info" isFullWidth isTruncatable>
- <button type="button" onClick={(e) => e.stopPropagation()} title={event.accountName}>
- <RefreshCwIcon />
- <span>{event.accountName}</span>
- </button>
- </Badge>
- </PopoverTrigger>
- <PopoverContent side="left" className="w-80 bg-card" align="start">
- <RotationEventDetail event={event} />
- </PopoverContent>
- </Popover>
- );
-};
-
-const MAX_SLOTS = 2;
-
-const getBgClass = (today: boolean, isCurrentMonth: boolean) => {
- if (today) return isCurrentMonth ? "bg-muted/5" : "bg-card/50";
- return isCurrentMonth ? "bg-container" : "bg-card";
-};
-
-const RotationDayCell = ({
- date,
- isCurrentMonth,
- events
-}: {
- date: Date;
- isCurrentMonth: boolean;
- events: TPamRotationCalendarEvent[];
-}) => {
- const [overflowOpen, setOverflowOpen] = useState(false);
- const today = isToday(date);
- const dayNum = date.getDate();
- const hasOverflow = events.length > MAX_SLOTS;
- const visibleCount = hasOverflow ? MAX_SLOTS - 1 : events.length;
- const visibleEvents = events.slice(0, visibleCount);
- const overflowCount = events.length - visibleCount;
-
- return (
- <div
- className={`min-h-[86px] border border-border p-2 transition-colors duration-75 hover:bg-container-hover ${getBgClass(
- today,
- isCurrentMonth
- )}`}
- >
- <div className="mb-1">
- {today ? (
- <span className="inline-flex size-7 items-center justify-center rounded border border-border bg-muted/35 text-sm font-medium text-foreground">
- {dayNum}
- </span>
- ) : (
- <span className="text-sm text-label">{dayNum}</span>
- )}
- </div>
- <div className="flex flex-col gap-1">
- {visibleEvents.map((event) => (
- <RotationEventPill key={event.id} event={event} />
- ))}
- {hasOverflow && (
- <Popover open={overflowOpen} onOpenChange={setOverflowOpen}>
- <PopoverTrigger asChild>
- <Badge asChild variant="neutral" isFullWidth className="justify-center">
- <button type="button" onClick={(e) => e.stopPropagation()}>
- +{overflowCount} more
- </button>
- </Badge>
- </PopoverTrigger>
- <PopoverContent className="w-56 bg-card" align="start">
- <div className="flex flex-col gap-1.5">
- {events.map((event) => (
- <RotationEventPill key={`overflow-${event.id}`} event={event} />
- ))}
- </div>
- </PopoverContent>
- </Popover>
- )}
- </div>
- </div>
- );
-};
-
-const RotationLegend = () => (
- <div className="float-right mt-3 -mb-2 flex items-center gap-4">
- <div className="flex items-center gap-1.5">
- <span className="size-2 rounded-full bg-info" />
- <span className="text-xs text-muted">Rotation</span>
- </div>
- </div>
-);
-
-export const PamRotationCalendar = () => {
- const { projectId } = useProject();
- const [currentMonth, setCurrentMonth] = useState(new Date());
-
- const month = currentMonth.getMonth() + 1;
- const year = currentMonth.getFullYear();
-
- const { data, isPending } = useGetPamRotationCalendar(
- { projectId, month, year },
- { enabled: !!projectId }
- );
-
- const days = useMemo(() => {
- const monthStart = startOfMonth(currentMonth);
- const monthEnd = endOfMonth(currentMonth);
- const gridStart = startOfWeek(monthStart, { weekStartsOn: 1 });
- const gridEnd = endOfWeek(monthEnd, { weekStartsOn: 1 });
- return eachDayOfInterval({ start: gridStart, end: gridEnd });
- }, [currentMonth]);
-
- const eventsByDate = useMemo(() => groupEventsByDate(data?.rotations ?? []), [data]);
-
- return (
- <Card className="h-full">
- <CardHeader>
- <CardTitle>Rotation Calendar</CardTitle>
- <CardDescription>Account credentials due to rotate this month</CardDescription>
- <CardAction>
- <div className="ml-4 flex items-center gap-1">
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => setCurrentMonth((prev) => subMonths(prev, 1))}
- >
- <ChevronLeft className="size-4" />
- </IconButton>
- <span className="min-w-[140px] text-center text-sm font-medium">
- {format(currentMonth, "MMMM yyyy")}
- </span>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => setCurrentMonth((prev) => addMonths(prev, 1))}
- >
- <ChevronRight className="size-4" />
- </IconButton>
- </div>
- </CardAction>
- </CardHeader>
- <CardContent>
- <div className="relative">
- <div className="overflow-hidden rounded-lg border border-border bg-container">
- <div className="grid grid-cols-7">
- {DAY_NAMES.map((day) => (
- <div
- key={day}
- className="border-b border-border py-2 text-center text-sm font-medium"
- >
- {day}
- </div>
- ))}
- </div>
- <div className="grid grid-cols-7">
- {days.map((day) => {
- const dateKey = format(day, "yyyy-MM-dd");
- return (
- <RotationDayCell
- key={dateKey}
- date={day}
- isCurrentMonth={isSameMonth(day, currentMonth)}
- events={eventsByDate[dateKey] ?? []}
- />
- );
- })}
- </div>
- </div>
- {isPending && (
- <div className="absolute inset-0 flex items-center justify-center bg-container/40">
- <Lottie icon="infisical_loading_white" isAutoPlay className="w-16" />
- </div>
- )}
- </div>
- <RotationLegend />
- </CardContent>
- </Card>
- );
-};
diff --git a/frontend/src/pages/pam/InsightsPage/components/PamSessionActivityChart.tsx b/frontend/src/pages/pam/InsightsPage/components/PamSessionActivityChart.tsx
deleted file mode 100644
index 2da78d8fb0..0000000000
--- a/frontend/src/pages/pam/InsightsPage/components/PamSessionActivityChart.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-import { useMemo } from "react";
-import { format, parseISO } from "date-fns";
-
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
- Empty,
- EmptyHeader,
- EmptyTitle,
- Skeleton
-} from "@app/components/v3";
-import { useProject } from "@app/context";
-import { useGetPamSessionActivity } from "@app/hooks/api/pamInsights";
-import { LineChart } from "@app/pages/secret-manager/InsightsPage/components/LineChart";
-
-type ChartPoint = {
- date: string;
- label: string;
- value: number;
- showTickLabel: string | null;
-};
-
-const buildAxisTicks = (data: ChartPoint[]): string[] => {
- if (!data.length) return [];
- const ticks: string[] = [];
- data.forEach((point, index) => {
- if (index === 0 || index === data.length - 1) {
- ticks.push(point.label);
- return;
- }
- if (index % 7 === 0) ticks.push(point.label);
- });
- return ticks;
-};
-
-export const PamSessionActivityChart = () => {
- const { projectId } = useProject();
- const { data, isPending } = useGetPamSessionActivity({ projectId }, { enabled: !!projectId });
-
- const chartData = useMemo<ChartPoint[]>(() => {
- if (!data?.days) return [];
- return data.days.map((day, index, days) => {
- const isLast = index === days.length - 1;
- const isFirst = index === 0;
- const parsed = parseISO(day.date);
- let tickLabel: string | null = null;
- if (isLast) tickLabel = "Today";
- else if (isFirst || index % 7 === 0) tickLabel = format(parsed, "MMM d");
- return {
- date: day.date,
- label: day.date,
- value: day.count,
- showTickLabel: tickLabel
- };
- });
- }, [data]);
-
- const ticks = useMemo(() => buildAxisTicks(chartData), [chartData]);
- const totalSessions = chartData.reduce((sum, d) => sum + d.value, 0);
- const hasAnyData = totalSessions > 0;
-
- const tickFormatter = (date: string) => {
- const point = chartData.find((p) => p.date === date);
- return point?.showTickLabel ?? "";
- };
-
- const renderBody = () => {
- if (isPending) return <Skeleton className="h-[280px] w-full" />;
- if (!hasAnyData) {
- return (
- <Empty className="border-0">
- <EmptyHeader>
- <EmptyTitle>No sessions in the last 30 days</EmptyTitle>
- </EmptyHeader>
- </Empty>
- );
- }
- return (
- <div className="flex flex-col gap-4">
- <LineChart
- data={chartData}
- ticks={ticks}
- tickFormatter={tickFormatter}
- valueLabel="Sessions"
- gradientId="pam-session-activity-gradient"
- />
- <span className="text-xs text-muted">
- {totalSessions.toLocaleString()} sessions in the last 30 days &middot;{" "}
- {(data?.avgPerDay ?? 0).toLocaleString()} per day on average
- </span>
- </div>
- );
- };
-
- return (
- <Card>
- <CardHeader>
- <CardTitle>Session Activity</CardTitle>
- <CardDescription>PAM sessions started over the past 30 days</CardDescription>
- </CardHeader>
- <CardContent>{renderBody()}</CardContent>
- </Card>
- );
-};
diff --git a/frontend/src/pages/pam/InsightsPage/components/PamTopActors.tsx b/frontend/src/pages/pam/InsightsPage/components/PamTopActors.tsx
deleted file mode 100644
index 5e28b49d6e..0000000000
--- a/frontend/src/pages/pam/InsightsPage/components/PamTopActors.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import { useNavigate } from "@tanstack/react-router";
-import { ExternalLinkIcon } from "lucide-react";
-
-import {
- Badge,
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
- Empty,
- EmptyHeader,
- EmptyTitle,
- Skeleton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
-} from "@app/components/v3";
-import { useOrganization, useProject } from "@app/context";
-import { useGetPamTopActors } from "@app/hooks/api/pamInsights";
-
-const sessionsRoute = "/organizations/$orgId/projects/pam/$projectId/sessions" as const;
-
-export const PamTopActors = () => {
- const { currentOrg } = useOrganization();
- const { projectId } = useProject();
- const { data, isPending } = useGetPamTopActors({ projectId }, { enabled: !!projectId });
- const navigate = useNavigate();
-
- const totalSessions = data?.actors.reduce((sum, a) => sum + a.sessionCount, 0) ?? 0;
- const uniqueActors = data?.actors.length ?? 0;
-
- const renderBody = () => {
- if (isPending) return <Skeleton className="h-[280px] w-full" />;
- if (!data?.actors.length) {
- return (
- <Empty className="border-0">
- <EmptyHeader>
- <EmptyTitle>No session activity yet</EmptyTitle>
- </EmptyHeader>
- </Empty>
- );
- }
- return (
- <Table>
- <TableHeader className="sticky top-0 z-10 bg-container shadow-[inset_0_-1px_0_var(--color-border)]">
- <TableRow>
- <TableHead className="w-8" />
- <TableHead>Actor</TableHead>
- <TableHead>Type</TableHead>
- <TableHead className="text-right">Sessions</TableHead>
- <TableHead className="w-8" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {data.actors.map((actor, index) => (
- <TableRow
- key={`${actor.actorEmail}:${actor.actorName}`}
- className="[&>td]:h-auto [&>td]:py-2"
- onClick={() =>
- navigate({
- to: sessionsRoute,
- params: { orgId: currentOrg.id, projectId }
- })
- }
- >
- <TableCell className="text-muted">{index + 1}</TableCell>
- <TableCell className="font-medium">
- <div className="flex flex-col">
- <span className="truncate" title={actor.actorName}>
- {actor.actorName || actor.actorEmail || "Unknown"}
- </span>
- <span className="truncate text-xs text-muted" title={actor.actorEmail}>
- {actor.isService ? "machine identity" : actor.actorEmail}
- </span>
- </div>
- </TableCell>
- <TableCell>
- {actor.isService ? (
- <Badge variant="info">identity</Badge>
- ) : (
- <Badge variant="warning">user</Badge>
- )}
- </TableCell>
- <TableCell className="text-right font-medium">
- {actor.sessionCount.toLocaleString()}
- </TableCell>
- <TableCell className="w-8 px-2">
- <ExternalLinkIcon className="size-3.5 text-muted" />
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- );
- };
-
- return (
- <Card>
- <CardHeader>
- <CardTitle>Top Actors</CardTitle>
- <CardDescription>
- Users &amp; identities initiating the most PAM sessions over the past 30 days
- </CardDescription>
- </CardHeader>
- <CardContent className="flex flex-col gap-4">
- {renderBody()}
- {!isPending && uniqueActors > 0 && (
- <span className="text-xs text-muted">
- {uniqueActors} unique {uniqueActors === 1 ? "actor" : "actors"} &middot;{" "}
- {totalSessions.toLocaleString()} total sessions in the last 30 days
- </span>
- )}
- </CardContent>
- </Card>
- );
-};
diff --git a/frontend/src/pages/pam/InsightsPage/components/index.ts b/frontend/src/pages/pam/InsightsPage/components/index.ts
deleted file mode 100644
index 64b1e3cf04..0000000000
--- a/frontend/src/pages/pam/InsightsPage/components/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export { PamInsightsKpiCards } from "./PamInsightsKpiCards";
-export { PamResourceBreakdown } from "./PamResourceBreakdown";
-export { PamRotationCalendar } from "./PamRotationCalendar";
-export { PamSessionActivityChart } from "./PamSessionActivityChart";
-export { PamTopActors } from "./PamTopActors";
diff --git a/frontend/src/pages/pam/InsightsPage/route.tsx b/frontend/src/pages/pam/InsightsPage/route.tsx
deleted file mode 100644
index b72cb098e7..0000000000
--- a/frontend/src/pages/pam/InsightsPage/route.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-
-import { InsightsPage } from "./InsightsPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights"
-)({
- component: InsightsPage,
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Insights"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
deleted file mode 100644
index 87b9d55fed..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
+++ /dev/null
@@ -1,425 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useState } from "react";
-import { Helmet } from "react-helmet";
-import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useQueryClient } from "@tanstack/react-query";
-import { useNavigate, useParams } from "@tanstack/react-router";
-import {
- BanIcon,
- EllipsisVerticalIcon,
- LogInIcon,
- PencilIcon,
- RefreshCwIcon,
- Trash2Icon
-} from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- PageLoader
-} from "@app/components/v3";
-import { ProjectPermissionSub, useOrganization } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { usePopUp } from "@app/hooks";
-import { ApprovalPolicyType, useCheckPolicyMatch } from "@app/hooks/api/approvalPolicies";
-import {
- PAM_RESOURCE_TYPE_MAP,
- PamAccountRotationStatus,
- PamResourceType,
- TPamAccount,
- useGetPamAccountById
-} from "@app/hooks/api/pam";
-import { useManualRotateAccount } from "@app/hooks/api/pam/mutations";
-import { pamKeys } from "@app/hooks/api/pam/queries";
-import { PAM_DOMAIN_TYPE_MAP, PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
-
-import { PamAccessAccountModal } from "../PamAccountsPage/components/PamAccessAccountModal";
-import { PamAwsIamAccessReasonModal } from "../PamAccountsPage/components/PamAwsIamAccessReasonModal";
-import { PamDeleteAccountModal } from "../PamAccountsPage/components/PamDeleteAccountModal";
-import { PamRequestAccountAccessModal } from "../PamAccountsPage/components/PamRequestAccountAccessModal";
-import { PamUpdateAccountModal } from "../PamAccountsPage/components/PamUpdateAccountModal";
-import {
- PamAccountCredentialsSection,
- PamAccountDependenciesSection,
- PamAccountDetailsSection,
- PamAccountMetadataSection,
- PamAccountPropertiesSection,
- PamSelectResourceModal
-} from "./components";
-
-const PageContent = () => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({
- strict: false
- }) as {
- accountId?: string;
- projectId?: string;
- orgId?: string;
- resourceType?: string;
- resourceId?: string;
- domainType?: string;
- domainId?: string;
- };
-
- const { accountId, projectId, resourceType, resourceId, domainType, domainId } = params;
- const isDomainAccount = !!domainId;
-
- const [isEditModalOpen, setIsEditModalOpen] = useState(false);
- const [accessReason, setAccessReason] = useState<string | undefined>(undefined);
-
- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
- "accessAccount",
- "requestAccount",
- "deleteAccount",
- "awsIamReason",
- "selectResource"
- ] as const);
-
- const queryClient = useQueryClient();
- const { mutateAsync: checkPolicyMatch } = useCheckPolicyMatch();
- const rotateAccount = useManualRotateAccount();
-
- const { data: account, isPending } = useGetPamAccountById(accountId);
-
- const { data: domain, isPending: isDomainPending } = useGetPamDomainById(
- (account?.domain?.domainType as PamDomainType) ?? PamDomainType.ActiveDirectory,
- account?.domainId || undefined,
- { enabled: !!account?.domainId }
- );
-
- if (isPending) {
- return <PageLoader />;
- }
-
- if (!account) {
- return (
- <div className="flex h-full w-full items-center justify-center px-20">
- <Empty className="max-w-2xl">
- <EmptyHeader>
- <BanIcon className="size-8 text-muted" />
- <EmptyTitle className="text-muted">
- Could not find PAM Account with ID {accountId}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </div>
- );
- }
-
- const resourceTypeInfo = account.resource
- ? PAM_RESOURCE_TYPE_MAP[account.resource.resourceType]
- : null;
-
- const domainTypeInfo = account.domain
- ? PAM_DOMAIN_TYPE_MAP[account.domain.domainType as PamDomainType]
- : null;
-
- const parentTypeInfo = resourceTypeInfo || domainTypeInfo;
-
- const handleBack = () => {
- if (isDomainAccount) {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- domainType: domainType!,
- domainId: domainId!
- }
- });
- } else {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resourceType!,
- resourceId: resourceId!
- }
- });
- }
- };
-
- const handleAccess = async () => {
- if (isDomainAccount && account.domain) {
- handlePopUpOpen("selectResource");
- return;
- }
-
- const { requiresApproval, constraints } = await checkPolicyMatch({
- policyType: ApprovalPolicyType.PamAccess,
- projectId: projectId!,
- inputs: {
- resourceName: account.resource?.name ?? "",
- accountName: account.name
- }
- });
-
- if (requiresApproval) {
- handlePopUpOpen("requestAccount", {
- resourceName: account.resource?.name ?? "",
- accountName: account.name,
- accountAccessed: true,
- accessDurationMax: constraints?.accessDuration.max
- });
- return;
- }
-
- if (account.resource?.resourceType === PamResourceType.AwsIam) {
- handlePopUpOpen("awsIamReason", { account });
- } else {
- handlePopUpOpen("accessAccount", { account });
- }
- };
-
- const handleRotate = async () => {
- // Optimistically show rotating status immediately
- queryClient.setQueryData(pamKeys.getAccount(account.id), (old: TPamAccount | undefined) =>
- old ? { ...old, rotationStatus: PamAccountRotationStatus.Rotating } : old
- );
-
- try {
- const updatedAccount = await rotateAccount.mutateAsync({ accountId: account.id });
-
- if (updatedAccount.rotationStatus === PamAccountRotationStatus.Success) {
- createNotification({ text: "Credential rotation completed successfully", type: "success" });
- } else if (updatedAccount.rotationStatus === PamAccountRotationStatus.PartialSuccess) {
- createNotification({
- text: "Credential rotation completed with warnings",
- type: "warning"
- });
- } else if (updatedAccount.rotationStatus === PamAccountRotationStatus.Failed) {
- createNotification({ text: "Credential rotation failed", type: "error" });
- }
- } catch {
- // Revert optimistic update on failure
- queryClient.invalidateQueries({ queryKey: pamKeys.getAccount(account.id) });
- createNotification({ text: "Failed to trigger rotation", type: "error" });
- }
- };
-
- return (
- <div className="container mx-auto flex max-w-7xl flex-col px-6 py-6 text-mineshaft-50">
- <button
- type="button"
- onClick={handleBack}
- className="mb-4 flex items-center gap-1 text-sm text-bunker-300 hover:text-primary-400"
- >
- <FontAwesomeIcon icon={faChevronLeft} className="text-xs" />
- {isDomainAccount ? "Back to domain" : "Back to resource"}
- </button>
-
- <div className="mb-6 flex items-center justify-between">
- <div className="flex items-center gap-4">
- {parentTypeInfo && (
- <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
- <img
- alt={parentTypeInfo.name}
- src={`/images/integrations/${parentTypeInfo.image}`}
- className="size-6"
- />
- </div>
- )}
- <div>
- <h1 className="text-2xl font-semibold text-mineshaft-100">{account.name}</h1>
- <p className="text-sm text-bunker-300">
- {account.domain
- ? `${account.domain.domainType === "active-directory" ? "Active Directory" : account.domain.domainType} Account on ${account.domain.name}`
- : `${resourceTypeInfo?.name ?? ""} Account on ${account.resource?.name ?? ""}`}
- </p>
- </div>
- </div>
- <div className="flex items-center gap-3">
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
- >
- <Button
- variant="neutral"
- isDisabled={isDomainAccount && (isDomainPending || !domain?.connectionDetails.domain)}
- onClick={handleAccess}
- >
- <LogInIcon />
- Access
- </Button>
- </ProjectPermissionCan>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm">
- <EllipsisVerticalIcon />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" sideOffset={2}>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsEditModalOpen(true)}
- isDisabled={!isAllowed}
- >
- <PencilIcon className="size-3.5" />
- Edit Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- {account.resource?.rotationCredentialsConfigured && (
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.TriggerRotation}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={handleRotate}
- isDisabled={
- !isAllowed || account.rotationStatus === PamAccountRotationStatus.Rotating
- }
- >
- <RefreshCwIcon className="size-3.5" />
- Rotate Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- )}
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Delete}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => handlePopUpOpen("deleteAccount", account)}
- variant="danger"
- isDisabled={!isAllowed}
- >
- <Trash2Icon className="size-3.5" />
- Delete Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
-
- <div className="flex gap-6">
- {/* Left Column */}
- <div className="flex w-80 shrink-0 flex-col gap-4">
- <PamAccountDetailsSection account={account} onEdit={() => setIsEditModalOpen(true)} />
- <PamAccountCredentialsSection account={account} onEdit={() => setIsEditModalOpen(true)} />
- <PamAccountPropertiesSection account={account} />
- <PamAccountMetadataSection account={account} />
- </div>
-
- <div className="min-w-0 flex-1">
- <PamAccountDependenciesSection account={account} />
- </div>
- </div>
-
- <PamUpdateAccountModal
- isOpen={isEditModalOpen}
- onOpenChange={setIsEditModalOpen}
- account={account}
- />
-
- <PamAccessAccountModal
- isOpen={popUp.accessAccount.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("accessAccount", isOpen);
- if (!isOpen) setAccessReason(undefined);
- }}
- account={popUp.accessAccount.data?.account}
- resource={popUp.accessAccount.data?.resource}
- projectId={projectId!}
- reason={accessReason}
- />
-
- <PamAwsIamAccessReasonModal
- isOpen={popUp.awsIamReason.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("awsIamReason", isOpen)}
- account={popUp.awsIamReason.data?.account}
- onSubmit={(reason) => {
- const targetAccount = popUp.awsIamReason.data?.account;
- if (!targetAccount) return;
- handlePopUpClose("awsIamReason");
- setAccessReason(reason || undefined);
- handlePopUpOpen("accessAccount", { account: targetAccount });
- }}
- />
-
- <PamRequestAccountAccessModal
- isOpen={popUp.requestAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("requestAccount", isOpen)}
- resourceName={popUp.requestAccount.data?.resourceName}
- accountName={popUp.requestAccount.data?.accountName}
- accountAccessed={popUp.requestAccount.data?.accountAccessed}
- accessDurationMax={popUp.requestAccount.data?.accessDurationMax}
- />
-
- <PamDeleteAccountModal
- isOpen={popUp.deleteAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("deleteAccount", isOpen)}
- account={popUp.deleteAccount.data}
- onDeleted={handleBack}
- />
-
- {isDomainAccount && account.domain && (
- <PamSelectResourceModal
- isOpen={popUp.selectResource.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("selectResource", isOpen)}
- domainType={account.domain.domainType}
- domainId={account.domain.id}
- onSelect={async (resource) => {
- const accountIdentity = domain?.connectionDetails.domain
- ? `${domain.connectionDetails.domain}:${account.name}`
- : account.name;
-
- const { requiresApproval, constraints } = await checkPolicyMatch({
- policyType: ApprovalPolicyType.PamAccess,
- projectId: projectId!,
- inputs: {
- resourceName: resource.name,
- accountName: accountIdentity
- }
- });
-
- if (requiresApproval) {
- handlePopUpOpen("requestAccount", {
- resourceName: resource.name,
- accountName: accountIdentity,
- accountAccessed: true,
- accessDurationMax: constraints?.accessDuration.max
- });
- return;
- }
-
- handlePopUpOpen("accessAccount", { account, resource });
- }}
- />
- )}
- </div>
- );
-};
-
-export const PamAccountByIDPage = () => {
- return (
- <>
- <Helmet>
- <title>PAM Account | Infisical</title>
- <link rel="icon" href="/infisical.ico" />
- </Helmet>
- <PageContent />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
deleted file mode 100644
index 2173e8b7da..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
+++ /dev/null
@@ -1,373 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useReducer } from "react";
-import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon, PencilIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Detail, DetailLabel, DetailValue, IconButton, Input } from "@app/components/v3";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { useTimedReset } from "@app/hooks";
-import {
- KubernetesAuthMethod,
- PamResourceType,
- TKubernetesCredentials,
- TPamAccount,
- TWindowsAccount
-} from "@app/hooks/api/pam";
-import { TPamAccountCredentialsResponse } from "@app/hooks/api/pam/queries";
-import { TAwsIamCredentials } from "@app/hooks/api/pam/types/aws-iam-resource";
-import { TBaseSqlCredentials } from "@app/hooks/api/pam/types/shared/sql-resource";
-import { SSHAuthMethod, TSSHCredentials } from "@app/hooks/api/pam/types/ssh-resource";
-import { TActiveDirectoryAccount } from "@app/hooks/api/pamDomain/active-directory-types";
-
-import { SensitiveCredentialsGate } from "./SensitiveCredentialsGate";
-import { useCredentialsReveal } from "./useCredentialsReveal";
-
-type Props = {
- account: TPamAccount;
- onEdit: VoidFunction;
-};
-
-const CopyableField = ({ label, value }: { label: string; value: string }) => {
- const handleCopy = () => {
- navigator.clipboard.writeText(value);
- createNotification({
- text: `${label} copied to clipboard`,
- type: "info"
- });
- };
-
- return (
- <Detail>
- <DetailLabel>{label}</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-2">
- <Input value={value} readOnly className="flex-1 font-mono text-sm" />
- <IconButton variant="ghost" onClick={handleCopy} size="sm">
- <CopyIcon />
- </IconButton>
- </div>
- </DetailValue>
- </Detail>
- );
-};
-
-const SqlCredentialsContent = ({ credentials }: { credentials: TBaseSqlCredentials }) => (
- <CopyableField label="Username" value={credentials.username} />
-);
-
-const SSHCredentialsContent = ({ credentials }: { credentials: TSSHCredentials }) => {
- if (credentials.authMethod === SSHAuthMethod.Password) {
- return <CopyableField label="Username" value={credentials.username} />;
- }
-
- if (credentials.authMethod === SSHAuthMethod.PublicKey) {
- return <CopyableField label="Username" value={credentials.username} />;
- }
-
- // Certificate auth
- return <CopyableField label="Username" value={credentials.username} />;
-};
-
-const AwsIamCredentialsContent = ({ credentials }: { credentials: TAwsIamCredentials }) => (
- <>
- <CopyableField label="Target Role ARN" value={credentials.targetRoleArn} />
- <Detail>
- <DetailLabel>Default Session Duration</DetailLabel>
- <DetailValue>{Math.floor(credentials.defaultSessionDuration / 60)} minutes</DetailValue>
- </Detail>
- </>
-);
-
-const WindowsCredentialsContent = ({ account }: { account: TWindowsAccount }) => {
- return (
- <>
- <Detail>
- <DetailLabel>Account Type</DetailLabel>
- <DetailValue className="capitalize">{account.internalMetadata.accountType}</DetailValue>
- </Detail>
- <CopyableField label="Username" value={account.credentials.username} />
- </>
- );
-};
-
-const ActiveDirectoryCredentialsContent = ({ account }: { account: TActiveDirectoryAccount }) => {
- return (
- <>
- <Detail>
- <DetailLabel>Account Type</DetailLabel>
- <DetailValue className="capitalize">{account.internalMetadata?.accountType}</DetailValue>
- </Detail>
- <CopyableField label="Username" value={account.credentials.username} />
- </>
- );
-};
-
-const KubernetesCredentialsContent = ({ credentials }: { credentials: TKubernetesCredentials }) => {
- if (credentials.authMethod === KubernetesAuthMethod.GatewayKubernetesAuth) {
- return (
- <>
- <CopyableField label="Namespace" value={credentials.namespace} />
- <CopyableField label="Service Account Name" value={credentials.serviceAccountName} />
- </>
- );
- }
-
- // ServiceAccountToken: no non-sensitive fields (token is behind the reveal gate)
- return null;
-};
-
-const CredentialsContent = ({ account }: { account: TPamAccount }) => {
- if (account.domain) {
- switch (account.domain.domainType) {
- case "active-directory":
- return (
- <ActiveDirectoryCredentialsContent
- account={account as unknown as TActiveDirectoryAccount}
- />
- );
- default:
- return null;
- }
- }
-
- if (!account.resource) return null;
- const { resourceType } = account.resource;
-
- switch (resourceType) {
- case PamResourceType.Postgres:
- case PamResourceType.MySQL:
- case PamResourceType.MsSQL:
- case PamResourceType.OracleDB:
- case PamResourceType.MongoDB:
- case PamResourceType.Redis:
- return <SqlCredentialsContent credentials={account.credentials as TBaseSqlCredentials} />;
- case PamResourceType.SSH:
- return <SSHCredentialsContent credentials={account.credentials as TSSHCredentials} />;
- case PamResourceType.AwsIam:
- return <AwsIamCredentialsContent credentials={account.credentials as TAwsIamCredentials} />;
- case PamResourceType.Windows:
- return <WindowsCredentialsContent account={account as TWindowsAccount} />;
- case PamResourceType.Kubernetes:
- return (
- <KubernetesCredentialsContent credentials={account.credentials as TKubernetesCredentials} />
- );
- default:
- return null;
- }
-};
-
-const MASKED_VALUE = "••••••••••••";
-
-const SensitiveField = ({ label, value }: { label: string; value: string }) => {
- const [isVisible, toggleVisibility] = useReducer((prev) => !prev, false);
- const [, isCopied, setCopied] = useTimedReset<string>({
- initialState: ""
- });
-
- const handleCopy = async () => {
- try {
- await navigator.clipboard.writeText(value);
- setCopied("copied");
- } catch {
- createNotification({ type: "error", text: "Failed to copy to clipboard." });
- }
- };
-
- return (
- <Detail>
- <DetailLabel>{label}</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-2">
- <Input
- value={isVisible ? value : MASKED_VALUE}
- readOnly
- className="flex-1 font-mono text-sm"
- />
- <IconButton variant="ghost" size="sm" onClick={toggleVisibility}>
- {isVisible ? <EyeOffIcon /> : <EyeIcon />}
- </IconButton>
- <IconButton variant="ghost" size="sm" onClick={handleCopy}>
- {isCopied ? <CheckIcon /> : <CopyIcon />}
- </IconButton>
- </div>
- </DetailValue>
- </Detail>
- );
-};
-
-const MultilineSensitiveField = ({ label, value }: { label: string; value: string }) => {
- const [, isCopied, setCopied] = useTimedReset<string>({
- initialState: ""
- });
-
- const handleCopy = async () => {
- try {
- await navigator.clipboard.writeText(value);
- setCopied("copied");
- } catch {
- createNotification({ type: "error", text: "Failed to copy to clipboard." });
- }
- };
-
- return (
- <Detail>
- <DetailLabel>
- <div className="flex w-full items-center justify-between">
- {label}
- <IconButton variant="ghost" size="sm" onClick={handleCopy}>
- {isCopied ? <CheckIcon /> : <CopyIcon />}
- </IconButton>
- </div>
- </DetailLabel>
- <DetailValue>
- <pre className="max-h-32 thin-scrollbar overflow-auto rounded-md border border-border bg-transparent px-3 py-2 font-mono text-sm break-all whitespace-pre-wrap">
- {value}
- </pre>
- </DetailValue>
- </Detail>
- );
-};
-
-type SensitiveFieldDef = {
- key: string;
- label: string;
- multiline?: boolean;
-};
-
-// Returns sensitive fields that require the "View Credentials" flow to reveal.
-// Non-sensitive fields (username, auth method, etc.) are already shown by CredentialsContent above.
-// When adding a new resource type, add a case here if it has credentials hidden from the sanitized view.
-const getSensitiveFieldDefs = (account: TPamAccount): SensitiveFieldDef[] => {
- if (account.domain) {
- switch (account.domain.domainType) {
- case "active-directory":
- return [{ key: "password", label: "Password" }];
- default:
- return [];
- }
- }
-
- if (!account.resource) return [];
- const { resourceType } = account.resource;
-
- switch (resourceType) {
- case PamResourceType.Postgres:
- case PamResourceType.MySQL:
- case PamResourceType.MsSQL:
- case PamResourceType.OracleDB:
- case PamResourceType.MongoDB:
- case PamResourceType.Redis:
- case PamResourceType.Windows:
- return [{ key: "password", label: "Password" }];
-
- case PamResourceType.SSH: {
- const { authMethod } = account.credentials as TSSHCredentials;
- if (authMethod === SSHAuthMethod.Password) return [{ key: "password", label: "Password" }];
- if (authMethod === SSHAuthMethod.PublicKey)
- return [{ key: "privateKey", label: "Private Key", multiline: true }];
- return [];
- }
-
- case PamResourceType.Kubernetes: {
- const { authMethod } = account.credentials as TKubernetesCredentials;
- if (authMethod === KubernetesAuthMethod.ServiceAccountToken)
- return [{ key: "serviceAccountToken", label: "Service Account Token", multiline: true }];
- return [];
- }
-
- default:
- return [];
- }
-};
-
-const RevealedCredentials = ({
- credentialsData,
- fieldDefs
-}: {
- credentialsData: TPamAccountCredentialsResponse;
- fieldDefs: SensitiveFieldDef[];
-}) => {
- const { credentials } = credentialsData;
-
- const presentFields = fieldDefs.filter((f) => {
- const value = credentials[f.key];
- return value !== undefined && value !== null && String(value).length > 0;
- });
-
- if (presentFields.length === 0) return null;
-
- return (
- <div className="flex flex-col gap-3">
- {presentFields.map((field) =>
- field.multiline ? (
- <MultilineSensitiveField
- key={field.key}
- label={field.label}
- value={String(credentials[field.key])}
- />
- ) : (
- <SensitiveField
- key={field.key}
- label={field.label}
- value={String(credentials[field.key])}
- />
- )
- )}
- </div>
- );
-};
-
-export const PamAccountCredentialsSection = ({ account, onEdit }: Props) => {
- const { state, startReveal, reset } = useCredentialsReveal(account.id);
-
- if (Object.keys(account.credentials).length <= 0) return null;
-
- const sensitiveFieldDefs = getSensitiveFieldDefs(account);
- const hasSensitiveFields = sensitiveFieldDefs.length > 0;
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Credentials</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <CredentialsContent account={account} />
- {hasSensitiveFields && (
- <SensitiveCredentialsGate
- state={state}
- accountName={account.name}
- resourceName={account.resource?.name ?? ""}
- resourceType={account.resource?.resourceType ?? ("" as PamResourceType)}
- metadata={account.metadata}
- onReveal={() => {
- if (!account.credentialsConfigured) {
- createNotification({
- type: "error",
- text: "No password exists for this account."
- });
- return;
- }
- startReveal();
- }}
- onReset={reset}
- >
- {state.status === "revealed" && (
- <RevealedCredentials credentialsData={state.data} fieldDefs={sensitiveFieldDefs} />
- )}
- </SensitiveCredentialsGate>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx
deleted file mode 100644
index 82f83badcb..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import type { TPamAccount } from "@app/hooks/api/pam";
-import { useGetPamAccountDependencies } from "@app/hooks/api/pam";
-
-import { PamDependenciesTable } from "../../components/PamDependenciesTable";
-
-export const PamAccountDependenciesSection = ({ account }: { account: TPamAccount }) => {
- const { data: dependencies, isPending } = useGetPamAccountDependencies(account.id);
-
- return (
- <div>
- <h2 className="mb-4 text-xl font-semibold">Services & Tasks</h2>
- <PamDependenciesTable
- dependencies={dependencies}
- isPending={isPending}
- contextColumnLabel="Resource"
- getContextValue={(dep) => dep.resourceName}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
deleted file mode 100644
index ed199b8126..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
+++ /dev/null
@@ -1,167 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { format } from "date-fns";
-import { PencilIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Badge,
- Detail,
- DetailGroup,
- DetailLabel,
- DetailValue,
- IconButton
-} from "@app/components/v3";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import {
- isPamRotationSupported,
- PAM_RESOURCE_TYPE_MAP,
- PamAccountRotationStatus,
- TPamAccount
-} from "@app/hooks/api/pam";
-import { useGetPamAccountById } from "@app/hooks/api/pam/queries";
-
-type Props = {
- account: TPamAccount;
- onEdit: VoidFunction;
-};
-
-const rotationStatusVariant = (status?: string | null) => {
- switch (status) {
- case PamAccountRotationStatus.Success:
- return "success" as const;
- case PamAccountRotationStatus.Failed:
- return "danger" as const;
- case PamAccountRotationStatus.PartialSuccess:
- return "warning" as const;
- case PamAccountRotationStatus.Rotating:
- return "info" as const;
- default:
- return "neutral" as const;
- }
-};
-
-const rotationStatusLabel = (status?: string | null) => {
- switch (status) {
- case PamAccountRotationStatus.Success:
- return "Success";
- case PamAccountRotationStatus.Failed:
- return "Failed";
- case PamAccountRotationStatus.PartialSuccess:
- return "Partial";
- case PamAccountRotationStatus.Rotating:
- return "Rotating";
- default:
- return "Never";
- }
-};
-
-export const PamAccountDetailsSection = ({ account, onEdit }: Props) => {
- const resourceTypeInfo = account.resource
- ? PAM_RESOURCE_TYPE_MAP[account.resource.resourceType]
- : null;
- const isRotating = account.rotationStatus === PamAccountRotationStatus.Rotating;
- const rotationSupported = account.resource
- ? isPamRotationSupported(account.resource.resourceType)
- : false;
-
- // Poll for status updates while rotation is in progress
- useGetPamAccountById(account.id, {
- refetchInterval: isRotating ? 3000 : false
- });
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Details</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <DetailGroup>
- <Detail>
- <DetailLabel>Name</DetailLabel>
- <DetailValue>{account.name}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Description</DetailLabel>
- <DetailValue>{account.description || "-"}</DetailValue>
- </Detail>
- {resourceTypeInfo && (
- <Detail>
- <DetailLabel>Type</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-2">
- <img
- alt={resourceTypeInfo.name}
- src={`/images/integrations/${resourceTypeInfo.image}`}
- className="size-4"
- />
- {resourceTypeInfo.name} Account
- </div>
- </DetailValue>
- </Detail>
- )}
- <Detail>
- <DetailLabel>Parent Resource</DetailLabel>
- <DetailValue>{account.resource?.name ?? "—"}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Account Policy</DetailLabel>
- <DetailValue>{account.policyName ?? "None"}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Created</DetailLabel>
- <DetailValue>{format(new Date(account.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
- </Detail>
- {rotationSupported && (
- <>
- <Detail>
- <DetailLabel>Rotation Status</DetailLabel>
- <DetailValue>
- <Badge
- variant={rotationStatusVariant(account.rotationStatus)}
- className={isRotating ? "animate-pulse" : undefined}
- >
- {rotationStatusLabel(account.rotationStatus)}
- </Badge>
- </DetailValue>
- </Detail>
- {(account.rotationStatus === PamAccountRotationStatus.Failed ||
- account.rotationStatus === PamAccountRotationStatus.PartialSuccess) &&
- account.lastRotationMessage && (
- <Detail>
- <DetailLabel>Last Rotation Message</DetailLabel>
- <DetailValue
- className={`text-xs break-words ${
- account.rotationStatus === PamAccountRotationStatus.Failed
- ? "text-danger"
- : "text-warning"
- }`}
- >
- {account.lastRotationMessage}
- </DetailValue>
- </Detail>
- )}
- {"lastRotatedAt" in account && account.lastRotatedAt && (
- <Detail>
- <DetailLabel>Last Rotated</DetailLabel>
- <DetailValue>
- {format(new Date(account.lastRotatedAt as string), "MM/dd/yyyy, hh:mm a")}
- </DetailValue>
- </Detail>
- )}
- </>
- )}
- </DetailGroup>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx
deleted file mode 100644
index 7290208336..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx
+++ /dev/null
@@ -1,149 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useCallback, useEffect, useState } from "react";
-import { useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { PencilIcon } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, Modal, ModalContent } from "@app/components/v2";
-import { Badge, ButtonGroup, IconButton } from "@app/components/v3";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { TPamAccount, useUpdatePamAccount } from "@app/hooks/api/pam";
-import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";
-
-type Props = {
- account: TPamAccount;
-};
-
-const metadataFormSchema = z.object({
- metadata: z
- .object({
- key: z.string().trim().min(1, "Key is required"),
- value: z.string().trim().default("")
- })
- .array()
-});
-
-type MetadataFormData = z.infer<typeof metadataFormSchema>;
-
-export const PamAccountMetadataSection = ({ account }: Props) => {
- const metadata = account.metadata || [];
- const { mutateAsync: updateAccount } = useUpdatePamAccount();
- const [isModalOpen, setIsModalOpen] = useState(false);
-
- const { control, handleSubmit, reset, formState } = useForm<MetadataFormData>({
- resolver: zodResolver(metadataFormSchema),
- defaultValues: {
- metadata: metadata.length > 0 ? metadata : []
- }
- });
-
- useEffect(() => {
- if (metadata) {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- }
- }, [metadata, reset]);
-
- const handleCancel = useCallback(() => {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- setIsModalOpen(false);
- }, [metadata, reset]);
-
- const onSubmit = useCallback(
- async (formData: MetadataFormData) => {
- try {
- await updateAccount({
- accountId: account.id,
- parentType: account.parentType,
- metadata: formData.metadata || []
- });
- createNotification({
- text: "Account metadata updated successfully",
- type: "success"
- });
- setIsModalOpen(false);
- } catch (error) {
- createNotification({
- text: `Failed to update metadata: ${(error as Error)?.message || "Unknown error"}`,
- type: "error"
- });
- }
- },
- [account.id, account.resource?.resourceType, updateAccount]
- );
-
- return (
- <>
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Metadata</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- setIsModalOpen(true);
- }}
- isDisabled={!isAllowed}
- >
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- {metadata.length > 0 ? (
- <div className="flex flex-wrap gap-2">
- {metadata.map((item) =>
- item.value ? (
- <ButtonGroup className="max-w-full min-w-0" key={`${item.key}=${item.value}`}>
- <Badge isTruncatable className="max-w-[12rem] shrink-0">
- <span>{item.key}</span>
- </Badge>
- <Badge variant="outline" isTruncatable>
- <span>{item.value}</span>
- </Badge>
- </ButtonGroup>
- ) : (
- <Badge key={item.key} isTruncatable>
- <span>{item.key}</span>
- </Badge>
- )
- )}
- </div>
- ) : (
- <p className="text-sm text-mineshaft-400">No metadata attached to this account.</p>
- )}
- </div>
-
- <Modal isOpen={isModalOpen} onOpenChange={setIsModalOpen}>
- <ModalContent
- title="Edit Metadata"
- subTitle="Update metadata key-value pairs for this account."
- >
- <MetadataForm control={control} title="" />
- <div className="mt-4 flex justify-end gap-2">
- <Button variant="outline_bg" onClick={handleCancel}>
- Cancel
- </Button>
- <Button
- onClick={handleSubmit(onSubmit)}
- isLoading={formState.isSubmitting}
- isDisabled={formState.isSubmitting}
- >
- Save
- </Button>
- </div>
- </ModalContent>
- </Modal>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx
deleted file mode 100644
index 181908398f..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { format } from "date-fns";
-import { CopyIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { Detail, DetailLabel, DetailValue, IconButton, Input } from "@app/components/v3";
-import { PamResourceType, TPamAccount, TWindowsAccount } from "@app/hooks/api/pam";
-
-const CopyableField = ({ label, value }: { label: string; value: string }) => {
- const handleCopy = () => {
- navigator.clipboard.writeText(value);
- createNotification({
- text: `${label} copied to clipboard`,
- type: "info"
- });
- };
-
- return (
- <Detail>
- <DetailLabel>{label}</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-2">
- <Input value={value} readOnly className="flex-1 font-mono text-sm" />
- <IconButton variant="ghost" onClick={handleCopy} size="sm">
- <CopyIcon />
- </IconButton>
- </div>
- </DetailValue>
- </Detail>
- );
-};
-
-type TPropertyField = {
- label: string;
- value: string;
- type?: "text" | "date" | "plain";
-};
-
-const getAccountProperties = (account: TPamAccount): TPropertyField[] => {
- if (!account.resource) return [];
- switch (account.resource.resourceType) {
- case PamResourceType.Windows: {
- const { internalMetadata } = account as TWindowsAccount;
- const fields: TPropertyField[] = [];
-
- if (internalMetadata.sid) {
- fields.push({ label: "SID", value: internalMetadata.sid });
- }
- if (internalMetadata.enabled !== undefined) {
- fields.push({
- label: "Enabled",
- value: internalMetadata.enabled ? "Yes" : "No",
- type: "plain"
- });
- }
- if (internalMetadata.passwordLastSet) {
- fields.push({
- label: "Password Last Set",
- value: internalMetadata.passwordLastSet,
- type: "date"
- });
- }
- if (internalMetadata.lastLogon) {
- fields.push({ label: "Last Logon", value: internalMetadata.lastLogon, type: "date" });
- }
-
- return fields;
- }
- default:
- return [];
- }
-};
-
-type Props = {
- account: TPamAccount;
-};
-
-export const PamAccountPropertiesSection = ({ account }: Props) => {
- const properties = getAccountProperties(account);
-
- if (properties.length === 0) return null;
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="border-b border-border pb-2">
- <h3 className="text-lg font-medium">Properties</h3>
- </div>
- {properties.map((property) => {
- if (property.type === "date") {
- return (
- <Detail key={property.label}>
- <DetailLabel>{property.label}</DetailLabel>
- <DetailValue>{format(new Date(property.value), "MM/dd/yyyy, hh:mm a")}</DetailValue>
- </Detail>
- );
- }
- if (property.type === "plain") {
- return (
- <Detail key={property.label}>
- <DetailLabel>{property.label}</DetailLabel>
- <DetailValue>{property.value}</DetailValue>
- </Detail>
- );
- }
- return <CopyableField key={property.label} label={property.label} value={property.value} />;
- })}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx
deleted file mode 100644
index ea40af0d78..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { MonitorIcon } from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
-
-type Props = {
- account: TPamAccount;
- onAccessResource: (resourceId: string) => void;
-};
-
-type ResourceCardProps = {
- name: string;
- resourceId: string;
- onAccess: (resourceId: string) => void;
-};
-
-const ResourceCard = ({ name, resourceId, onAccess }: ResourceCardProps) => {
- return (
- <button
- type="button"
- onClick={() => onAccess(resourceId)}
- className="flex w-full cursor-pointer items-center justify-between rounded-lg border border-border bg-container p-4 text-left transition-colors hover:border-foreground/20 hover:bg-container-hover"
- >
- <div className="flex items-center gap-3">
- <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-foreground/5">
- <MonitorIcon className="size-5 text-muted" />
- </div>
- <div>
- <p className="font-medium">{name}</p>
- <p className="text-xs text-muted">{resourceId.slice(0, 8)}</p>
- </div>
- </div>
- </button>
- );
-};
-
-export const PamAccountResourcesSection = ({ account, onAccessResource }: Props) => {
- const { resource } = account;
-
- if (!resource) return null;
-
- return (
- <div className="rounded-lg border border-border bg-container">
- <div className="border-b border-border px-4 py-3">
- <h3 className="text-lg font-medium">Resources</h3>
- <p className="text-sm text-muted">Resources this account can access</p>
- </div>
- <div className="p-4">
- <div
- className={twMerge(
- "grid grid-cols-1 gap-4 md:grid-cols-2",
- // Temporarily disable connecting to Windows Server accounts
- resource.resourceType === PamResourceType.Windows && "pointer-events-none opacity-60"
- )}
- >
- <ResourceCard name={resource.name} resourceId={resource.id} onAccess={onAccessResource} />
- </div>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamSelectResourceModal.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamSelectResourceModal.tsx
deleted file mode 100644
index 01a5736a5d..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamSelectResourceModal.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import { useState } from "react";
-
-import { Button, Modal, ModalContent, Select, SelectItem } from "@app/components/v2";
-import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
-import { TPamDomainRelatedResource, useListDomainRelatedResources } from "@app/hooks/api/pamDomain";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- domainType: string;
- domainId: string;
- onSelect: (resource: TPamDomainRelatedResource) => void;
-};
-
-export const PamSelectResourceModal = ({
- isOpen,
- onOpenChange,
- domainType,
- domainId,
- onSelect
-}: Props) => {
- const [selectedResourceId, setSelectedResourceId] = useState<string>("");
- const { data: resources } = useListDomainRelatedResources(domainType, domainId, {
- enabled: isOpen
- });
-
- const handleAccess = () => {
- const resource = resources?.find((r) => r.id === selectedResourceId);
- if (resource) {
- onSelect(resource);
- onOpenChange(false);
- setSelectedResourceId("");
- }
- };
-
- return (
- <Modal
- isOpen={isOpen}
- onOpenChange={(open) => {
- onOpenChange(open);
- if (!open) setSelectedResourceId("");
- }}
- >
- <ModalContent
- title="Access Account"
- subTitle="Select a resource to access this domain account on."
- >
- <div className="mt-2">
- <Select
- value={selectedResourceId}
- onValueChange={setSelectedResourceId}
- placeholder="Select a resource..."
- className="w-full"
- position="popper"
- >
- {(resources || []).map((resource) => {
- const typeInfo = PAM_RESOURCE_TYPE_MAP[resource.resourceType as PamResourceType];
- return (
- <SelectItem key={resource.id} value={resource.id}>
- <div className="flex items-center gap-2">
- {typeInfo?.image && (
- <img
- alt={typeInfo.name}
- src={`/images/integrations/${typeInfo.image}`}
- className="size-4"
- />
- )}
- {resource.name}
- </div>
- </SelectItem>
- );
- })}
- </Select>
- </div>
- <div className="mt-4 flex gap-2">
- <Button onClick={handleAccess} isDisabled={!selectedResourceId} colorSchema="primary">
- Access
- </Button>
- <Button
- variant="outline_bg"
- onClick={() => {
- onOpenChange(false);
- setSelectedResourceId("");
- }}
- >
- Cancel
- </Button>
- </div>
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/SensitiveCredentialsGate.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/SensitiveCredentialsGate.tsx
deleted file mode 100644
index 3683650afa..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/SensitiveCredentialsGate.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import React from "react";
-import { subject } from "@casl/ability";
-import { EyeIcon, LoaderCircleIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-
-import { type RevealState } from "./useCredentialsReveal";
-
-type Props = {
- state: RevealState;
- accountName: string;
- resourceName: string;
- resourceType: string;
- metadata?: { key: string; value: string }[];
- onReveal: () => void;
- onReset: () => void;
- children: React.ReactNode;
-};
-
-const ButtonContent = ({ state }: { state: RevealState }) => {
- if (state.status === "loading") {
- return <LoaderCircleIcon className="animate-spin" />;
- }
-
- if (state.status === "mfa-verifying") {
- return (
- <>
- <LoaderCircleIcon className="animate-spin" />
- Waiting for MFA...
- </>
- );
- }
-
- return (
- <>
- <EyeIcon />
- View Credentials
- </>
- );
-};
-
-export const SensitiveCredentialsGate = ({
- state,
- accountName,
- resourceName,
- resourceType,
- metadata,
- onReveal,
- onReset,
- children
-}: Props) => {
- if (state.status === "revealed") {
- return <div>{children}</div>;
- }
-
- const isMfaVerifying = state.status === "mfa-verifying";
- const isLoading = state.status === "loading";
-
- return (
- <div className="flex flex-col gap-2">
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.ReadCredentials}
- a={subject(ProjectPermissionSub.PamAccounts, {
- resourceName,
- resourceType,
- accountName,
- metadata: metadata ?? []
- })}
- >
- {(isAllowed) => (
- <Tooltip>
- <TooltipTrigger asChild>
- <span className="w-full">
- <Button
- variant="outline"
- size="md"
- className="relative"
- isFullWidth
- isDisabled={!isAllowed || isLoading || isMfaVerifying}
- onClick={onReveal}
- >
- <ButtonContent state={state} />
- </Button>
- </span>
- </TooltipTrigger>
- {!isAllowed && (
- <TooltipContent side="right">
- You do not have permission to view credentials
- </TooltipContent>
- )}
- </Tooltip>
- )}
- </ProjectPermissionCan>
- {isMfaVerifying && (
- <Button variant="ghost" size="xs" isFullWidth onClick={onReset}>
- Cancel
- </Button>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts b/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts
deleted file mode 100644
index f22b6ae9a8..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export { PamAccountCredentialsSection } from "./PamAccountCredentialsSection";
-export { PamAccountDependenciesSection } from "./PamAccountDependenciesSection";
-export { PamAccountDetailsSection } from "./PamAccountDetailsSection";
-export { PamAccountMetadataSection } from "./PamAccountMetadataSection";
-export { PamAccountPropertiesSection } from "./PamAccountPropertiesSection";
-export { PamAccountResourcesSection } from "./PamAccountResourcesSection";
-export { PamSelectResourceModal } from "./PamSelectResourceModal";
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/useCredentialsReveal.ts b/frontend/src/pages/pam/PamAccountByIDPage/components/useCredentialsReveal.ts
deleted file mode 100644
index 52bc7b4e42..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/useCredentialsReveal.ts
+++ /dev/null
@@ -1,143 +0,0 @@
-import { useCallback, useEffect, useRef, useState } from "react";
-import axios from "axios";
-
-import { createNotification } from "@app/components/notifications";
-import { apiRequest } from "@app/config/request";
-import { MfaSessionStatus, TMfaSessionStatusResponse } from "@app/hooks/api/mfaSession";
-import { TPamAccountCredentialsResponse } from "@app/hooks/api/pam/queries";
-
-export type RevealState =
- | { status: "hidden" }
- | { status: "loading" }
- | { status: "mfa-verifying" }
- | { status: "revealed"; data: TPamAccountCredentialsResponse };
-
-const MFA_POLL_INTERVAL = 2000;
-const MFA_TIMEOUT = 5 * 60 * 1000;
-
-export const useCredentialsReveal = (accountId: string) => {
- const [state, setState] = useState<RevealState>({ status: "hidden" });
- const mfaPopupRef = useRef<Window | null>(null);
- const pollIntervalRef = useRef<NodeJS.Timeout | undefined>();
- const isPollingRef = useRef(false);
-
- const cleanup = useCallback(() => {
- if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
- if (mfaPopupRef.current && !mfaPopupRef.current.closed) {
- mfaPopupRef.current.close();
- }
- isPollingRef.current = false;
- }, []);
-
- const fetchCredentials = useCallback(
- async (mfaSessionId?: string) => {
- const { data } = await apiRequest.post<TPamAccountCredentialsResponse>(
- `/api/v1/pam/accounts/${accountId}/credentials`,
- mfaSessionId ? { mfaSessionId } : {}
- );
- return data;
- },
- [accountId]
- );
-
- const startMfaPolling = useCallback(
- (mfaSessionId: string) => {
- const startTime = Date.now();
-
- pollIntervalRef.current = setInterval(async () => {
- if (isPollingRef.current) return;
- isPollingRef.current = true;
-
- try {
- if (Date.now() - startTime > MFA_TIMEOUT) {
- clearInterval(pollIntervalRef.current);
- createNotification({
- type: "error",
- text: "MFA verification timed out. If a popup did not appear, check that popups are not blocked for this site."
- });
- setState({ status: "hidden" });
- return;
- }
-
- const resp = await apiRequest.get<TMfaSessionStatusResponse>(
- `/api/v2/mfa-sessions/${mfaSessionId}/status`
- );
- if (resp.data.status === MfaSessionStatus.ACTIVE) {
- clearInterval(pollIntervalRef.current);
- if (mfaPopupRef.current && !mfaPopupRef.current.closed) {
- mfaPopupRef.current.close();
- }
-
- setState({ status: "loading" });
- try {
- const data = await fetchCredentials(mfaSessionId);
- setState({ status: "revealed", data });
- } catch {
- createNotification({
- type: "error",
- text: "Failed to fetch credentials after MFA verification."
- });
- setState({ status: "hidden" });
- }
- }
- } catch {
- clearInterval(pollIntervalRef.current);
- createNotification({ type: "error", text: "MFA verification failed." });
- setState({ status: "hidden" });
- } finally {
- isPollingRef.current = false;
- }
- }, MFA_POLL_INTERVAL);
- },
- [fetchCredentials]
- );
-
- const startReveal = useCallback(async () => {
- setState({ status: "loading" });
-
- try {
- const data = await fetchCredentials();
- setState({ status: "revealed", data });
- } catch (err) {
- if (axios.isAxiosError(err) && err.response?.data?.error === "SESSION_MFA_REQUIRED") {
- const mfaSessionId = err.response.data.details?.mfaSessionId as string | undefined;
-
- if (!mfaSessionId) {
- createNotification({ type: "error", text: "MFA session could not be created." });
- setState({ status: "hidden" });
- return;
- }
-
- // Immediately open MFA popup and start polling
- const mfaUrl = `${window.location.origin}/mfa-session/${mfaSessionId}`;
- mfaPopupRef.current = window.open(mfaUrl, "_blank");
-
- if (!mfaPopupRef.current) {
- createNotification({
- type: "error",
- text: "Could not open MFA popup. Please allow popups for this site."
- });
- setState({ status: "hidden" });
- return;
- }
-
- setState({ status: "mfa-verifying" });
- startMfaPolling(mfaSessionId);
- } else {
- createNotification({ type: "error", text: "Failed to fetch credentials." });
- setState({ status: "hidden" });
- }
- }
- }, [fetchCredentials, startMfaPolling]);
-
- const reset = useCallback(() => {
- cleanup();
- setState({ status: "hidden" });
- }, [cleanup]);
-
- useEffect(() => {
- return cleanup;
- }, [cleanup]);
-
- return { state, startReveal, reset };
-};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/route.tsx b/frontend/src/pages/pam/PamAccountByIDPage/route.tsx
deleted file mode 100644
index 1e89f2526f..0000000000
--- a/frontend/src/pages/pam/PamAccountByIDPage/route.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { createFileRoute, linkOptions } from "@tanstack/react-router";
-
-import { PamAccountByIDPage } from "./PamAccountByIDPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/"
-)({
- component: PamAccountByIDPage,
- beforeLoad: ({ context, params }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Resources",
- link: linkOptions({
- to: "/organizations/$orgId/projects/pam/$projectId/resources",
- params: { orgId: params.orgId, projectId: params.projectId }
- })
- },
- {
- label: "Resource",
- link: linkOptions({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: params.orgId,
- projectId: params.projectId,
- resourceType: params.resourceType,
- resourceId: params.resourceId
- }
- })
- },
- {
- label: "Account Details"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/PamAccountPoliciesPage/PamAccountPoliciesPage.tsx b/frontend/src/pages/pam/PamAccountPoliciesPage/PamAccountPoliciesPage.tsx
deleted file mode 100644
index 1f4a9b9aac..0000000000
--- a/frontend/src/pages/pam/PamAccountPoliciesPage/PamAccountPoliciesPage.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Helmet } from "react-helmet";
-import { useTranslation } from "react-i18next";
-
-import { PageHeader } from "@app/components/v2/PageHeader";
-import { useProject } from "@app/context";
-import { ProjectType } from "@app/hooks/api/projects/types";
-
-import { PamAccountPoliciesSection } from "./components/PamAccountPoliciesSection";
-
-export const PamAccountPoliciesPage = () => {
- const { t } = useTranslation();
- const { currentProject } = useProject();
-
- return (
- <>
- <Helmet>
- <title>{t("common.head-title", { title: "Account Policies" })}</title>
- </Helmet>
- <div className="h-full bg-bunker-800">
- <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <PageHeader
- scope={ProjectType.PAM}
- title="Account Policies"
- description="Manage behavioral rules for accounts."
- />
- <PamAccountPoliciesSection projectId={currentProject.id} />
- </div>
- </div>
- </div>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountPoliciesPage/components/PamAccountPoliciesSection.tsx b/frontend/src/pages/pam/PamAccountPoliciesPage/components/PamAccountPoliciesSection.tsx
deleted file mode 100644
index 30ddc3af30..0000000000
--- a/frontend/src/pages/pam/PamAccountPoliciesPage/components/PamAccountPoliciesSection.tsx
+++ /dev/null
@@ -1,230 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { format } from "date-fns";
-import { EllipsisVerticalIcon, InfoIcon, PencilIcon, PlusIcon, TrashIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Input } from "@app/components/v2";
-import {
- Badge,
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionPamAccountPolicyActions } from "@app/context/ProjectPermissionContext/types";
-import { usePagination, usePopUp } from "@app/hooks";
-import {
- TPamAccountPolicy,
- useDeletePamAccountPolicy,
- useListPamAccountPolicies
-} from "@app/hooks/api/pam";
-
-import { PolicySheet } from "./PolicySheet";
-
-type Props = {
- projectId: string;
-};
-
-export const PamAccountPoliciesSection = ({ projectId }: Props) => {
- const { search, debouncedSearch, setSearch } = usePagination("", { initPerPage: 20 });
-
- const { data: policies, isPending } = useListPamAccountPolicies(projectId, debouncedSearch);
- const deletePolicy = useDeletePamAccountPolicy();
-
- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
- "createPolicy",
- "editPolicy",
- "deletePolicy"
- ] as const);
-
- const handleDelete = async () => {
- const policy = popUp.deletePolicy.data as TPamAccountPolicy | undefined;
- if (!policy) return;
-
- try {
- await deletePolicy.mutateAsync({ policyId: policy.id });
- createNotification({
- text: "Policy deleted successfully",
- type: "success"
- });
- handlePopUpClose("deletePolicy");
- } catch {
- createNotification({
- text: "Failed to delete policy",
- type: "error"
- });
- }
- };
-
- return (
- <div>
- <div className="flex gap-2">
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search account policies..."
- className="h-full flex-1"
- containerClassName="h-9"
- />
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountPolicyActions.Create}
- a={ProjectPermissionSub.PamAccountPolicies}
- >
- {(isAllowed) => (
- <Button
- variant="project"
- onClick={() => handlePopUpOpen("createPolicy")}
- isDisabled={!isAllowed}
- >
- <PlusIcon />
- Create Policy
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
-
- <div className="mt-4">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Created</TableHead>
- <TableHead className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={4} className="text-center text-muted">
- Loading account policies...
- </TableCell>
- </TableRow>
- )}
- {!isPending && (!policies || policies.length === 0) && (
- <TableRow>
- <TableCell colSpan={4}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>
- {search ? "No account policies match search" : "No account policies"}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- policies?.map((policy) => (
- <TableRow key={policy.id}>
- <TableCell>
- <div className="flex items-center">
- <span className="font-medium">{policy.name}</span>
- {policy.description && (
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="ml-1.5 size-3.5 text-muted" />
- </TooltipTrigger>
- <TooltipContent>{policy.description}</TooltipContent>
- </Tooltip>
- )}
- </div>
- </TableCell>
- <TableCell>
- <Badge variant={policy.isActive ? "success" : "neutral"}>
- {policy.isActive ? "Enabled" : "Disabled"}
- </Badge>
- </TableCell>
- <TableCell className="text-muted">
- {format(new Date(policy.createdAt), "MMM d, yyyy")}
- </TableCell>
- <TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton variant="ghost" size="xs">
- <EllipsisVerticalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountPolicyActions.Edit}
- a={ProjectPermissionSub.PamAccountPolicies}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onSelect={() => handlePopUpOpen("editPolicy", policy)}
- >
- <PencilIcon className="mr-2 size-4" />
- Edit
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountPolicyActions.Delete}
- a={ProjectPermissionSub.PamAccountPolicies}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- variant="danger"
- onSelect={() => handlePopUpOpen("deletePolicy", policy)}
- >
- <TrashIcon className="mr-2 size-4" />
- Delete
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- </div>
-
- <PolicySheet
- isOpen={popUp.createPolicy.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("createPolicy", isOpen)}
- projectId={projectId}
- />
-
- <PolicySheet
- isOpen={popUp.editPolicy.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("editPolicy", isOpen)}
- projectId={projectId}
- policy={popUp.editPolicy.data as TPamAccountPolicy | undefined}
- />
-
- <DeleteActionModal
- isOpen={popUp.deletePolicy.isOpen}
- title={`Delete policy "${(popUp.deletePolicy.data as TPamAccountPolicy | undefined)?.name}"?`}
- subTitle="This will permanently remove this policy. Accounts using it will have their policy detached."
- onChange={(isOpen) => handlePopUpToggle("deletePolicy", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={handleDelete}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountPoliciesPage/components/PolicySheet.tsx b/frontend/src/pages/pam/PamAccountPoliciesPage/components/PolicySheet.tsx
deleted file mode 100644
index 2598423e15..0000000000
--- a/frontend/src/pages/pam/PamAccountPoliciesPage/components/PolicySheet.tsx
+++ /dev/null
@@ -1,510 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useEffect, useState } from "react";
-import { Control, Controller, FieldErrors, useFieldArray, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { CircleMinus, Plus, Trash2 } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Badge,
- Button,
- Command,
- CommandGroup,
- CommandItem,
- CommandList,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- IconButton,
- Input,
- Label,
- Popover,
- PopoverContent,
- PopoverTrigger,
- Sheet,
- SheetContent,
- SheetDescription,
- SheetFooter,
- SheetHeader,
- SheetTitle,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import {
- PamAccountPolicyRuleType,
- TPamAccountPolicy,
- TPamAccountPolicyRules,
- useCreatePamAccountPolicy,
- useUpdatePamAccountPolicy
-} from "@app/hooks/api/pam";
-import { PAM_RESOURCE_TYPE_MAP } from "@app/hooks/api/pam/maps";
-
-import {
- PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS,
- PAM_ACCOUNT_POLICY_RULE_METADATA,
- PAM_ACCOUNT_POLICY_RULE_SUPPORTED_RESOURCES
-} from "./constants";
-
-const isValidRegex = (pattern: string) => {
- try {
- // eslint-disable-next-line no-new
- new RegExp(pattern);
- return true;
- } catch {
- return false;
- }
-};
-
-const RulePatternSchema = z.object({
- value: z
- .string()
- .min(1, "Pattern is required")
- .max(500, "Pattern must be at most 500 characters")
- .refine(isValidRegex, { message: "Invalid regular expression" })
-});
-
-const RuleSchema = z
- .object({
- ruleType: z.nativeEnum(PamAccountPolicyRuleType),
- patterns: z.array(RulePatternSchema).max(20, "A rule can have at most 20 patterns").optional()
- })
- .superRefine((rule, ctx) => {
- if (PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS[rule.ruleType]) return;
- if (!rule.patterns || rule.patterns.length < 1) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- path: ["patterns"],
- message: "At least one pattern is required"
- });
- }
- });
-
-const FormSchema = z.object({
- name: z.string().trim().min(1, "Name is required").max(255),
- description: z.string().trim().max(1000).optional(),
- rules: z.array(RuleSchema).min(1, "At least one rule is required")
-});
-
-type TFormData = z.infer<typeof FormSchema>;
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- policy?: TPamAccountPolicy;
-};
-
-const rulesToFormData = (rules: TPamAccountPolicyRules): TFormData["rules"] => {
- return (
- Object.entries(rules) as [PamAccountPolicyRuleType, { patterns?: string[] } | undefined][]
- )
- .filter(([ruleType, config]) => {
- if (PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS[ruleType]) return Boolean(config);
- return Boolean(config?.patterns);
- })
- .map(([ruleType, config]) => {
- if (PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS[ruleType]) {
- return { ruleType };
- }
- return {
- ruleType,
- patterns: (config?.patterns ?? []).map((p) => ({ value: p }))
- };
- });
-};
-
-const formDataToRules = (rules: TFormData["rules"]): TPamAccountPolicyRules => {
- return rules.reduce<TPamAccountPolicyRules>((acc, rule) => {
- if (PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS[rule.ruleType]) {
- acc[rule.ruleType] = {};
- } else {
- acc[rule.ruleType] = {
- patterns: (rule.patterns ?? []).map((p) => p.value)
- };
- }
- return acc;
- }, {});
-};
-
-const RuleSupportedResourceIndicator = ({ ruleType }: { ruleType: PamAccountPolicyRuleType }) => {
- const supported = PAM_ACCOUNT_POLICY_RULE_SUPPORTED_RESOURCES[ruleType];
-
- if (supported === "all") {
- return (
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge variant="neutral">All</Badge>
- </TooltipTrigger>
- <TooltipContent>Supported by all resource types</TooltipContent>
- </Tooltip>
- );
- }
-
- return (
- <Tooltip>
- <TooltipTrigger asChild>
- <div className="flex items-center gap-1">
- {supported.map((rt) => {
- const mapEntry = PAM_RESOURCE_TYPE_MAP[rt];
- if (!mapEntry) return null;
- return (
- <Badge key={rt} variant="neutral">
- {mapEntry.name}
- </Badge>
- );
- })}
- </div>
- </TooltipTrigger>
- <TooltipContent>
- Supported by{" "}
- {(() => {
- const names = supported.map((rt) => PAM_RESOURCE_TYPE_MAP[rt]?.name).filter(Boolean);
- if (names.length <= 1) return names[0];
- return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
- })()}
- </TooltipContent>
- </Tooltip>
- );
-};
-
-const RulePatterns = ({
- control,
- ruleIndex,
- errors
-}: {
- control: Control<TFormData>;
- ruleIndex: number;
- errors: FieldErrors<TFormData>;
-}) => {
- const { fields, append, remove } = useFieldArray({
- control,
- name: `rules.${ruleIndex}.patterns` as const
- });
-
- return (
- <div className="space-y-1.5">
- {fields.map((patternField, patternIndex) => {
- const patternError = errors?.rules?.[ruleIndex]?.patterns?.[patternIndex]?.value;
- return (
- <div key={patternField.id}>
- <div className="flex items-center gap-1.5">
- <Controller
- control={control}
- name={`rules.${ruleIndex}.patterns.${patternIndex}.value`}
- render={({ field }) => (
- <Input
- {...field}
- placeholder={"Regex pattern, e.g. rm\\s+-rf"}
- className="flex-1 font-mono text-xs"
- isError={!!patternError}
- />
- )}
- />
- <IconButton
- variant="ghost"
- size="xs"
- aria-label="Remove pattern"
- onClick={() => remove(patternIndex)}
- disabled={fields.length <= 1}
- >
- <CircleMinus className="h-3.5 w-3.5 text-mineshaft-400" />
- </IconButton>
- </div>
- {patternError && <p className="mt-1 text-xs text-danger">{patternError.message}</p>}
- </div>
- );
- })}
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- <Button
- variant="outline"
- size="xs"
- onClick={() => append({ value: "" })}
- disabled={fields.length >= 20}
- >
- <Plus className="mr-1 h-3 w-3" />
- Add Pattern
- </Button>
- </span>
- </TooltipTrigger>
- {fields.length >= 20 && <TooltipContent>Max of 20 allowed</TooltipContent>}
- </Tooltip>
- </div>
- );
-};
-
-export const PolicySheet = ({ isOpen, onOpenChange, projectId, policy }: Props) => {
- const isEditing = !!policy;
- const createPolicy = useCreatePamAccountPolicy();
- const updatePolicy = useUpdatePamAccountPolicy();
- const [addRuleOpen, setAddRuleOpen] = useState(false);
- const [isActive, setIsActive] = useState(true);
-
- const {
- control,
- handleSubmit,
- reset,
- formState: { isSubmitting, isDirty, errors },
- watch
- } = useForm<TFormData>({
- resolver: zodResolver(FormSchema),
- defaultValues: {
- name: "",
- description: "",
- rules: []
- }
- });
-
- const {
- fields: ruleFields,
- append: appendRule,
- remove: removeRule
- } = useFieldArray({ control, name: "rules" });
-
- const currentRules = watch("rules");
-
- useEffect(() => {
- if (isOpen) {
- if (policy) {
- reset({
- name: policy.name,
- description: policy.description ?? "",
- rules: rulesToFormData(policy.rules)
- });
- setIsActive(policy.isActive);
- } else {
- reset({ name: "", description: "", rules: [] });
- setIsActive(true);
- }
- }
- }, [isOpen, policy, reset]);
-
- const onSubmit = async (data: TFormData) => {
- try {
- const rules = formDataToRules(data.rules);
-
- if (isEditing) {
- await updatePolicy.mutateAsync({
- policyId: policy.id,
- name: data.name,
- description: data.description || null,
- rules,
- isActive
- });
- createNotification({ text: "Policy updated successfully", type: "success" });
- } else {
- await createPolicy.mutateAsync({
- projectId,
- name: data.name,
- description: data.description,
- rules
- });
- createNotification({ text: "Policy created successfully", type: "success" });
- }
- onOpenChange(false);
- } catch {
- createNotification({
- text: `Failed to ${isEditing ? "update" : "create"} policy`,
- type: "error"
- });
- }
- };
-
- const addedRuleTypes = new Set(currentRules.map((r) => r.ruleType));
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>{isEditing ? "Edit Policy" : "Create Policy"}</SheetTitle>
- <SheetDescription>
- {isEditing
- ? "Update the policy name, description, and rules."
- : "Configure behavioral rules for accounts."}
- </SheetDescription>
- </SheetHeader>
-
- {isEditing && (
- <div className="flex items-center justify-between border-b border-border px-6 py-3">
- <span className="text-xs text-muted">{isActive ? "Enabled" : "Disabled"}</span>
- <Switch checked={isActive} onCheckedChange={setIsActive} variant="project" />
- </div>
- )}
-
- <form onSubmit={handleSubmit(onSubmit)} className="flex flex-1 flex-col overflow-hidden">
- <div
- className={`flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8 transition-opacity ${!isActive ? "pointer-events-none opacity-40" : ""}`}
- >
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Name</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="e.g. Production SSH Policy"
- isError={Boolean(error)}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="description"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Description (optional)</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- className="max-h-32"
- placeholder="Brief description of this policy"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <div className="flex flex-col gap-3">
- <div className="flex items-center justify-between">
- <Label>Rules</Label>
- <Popover open={addRuleOpen} onOpenChange={setAddRuleOpen}>
- <PopoverTrigger asChild>
- <Button variant="outline" size="xs">
- <Plus className="mr-1 h-3 w-3" />
- Add Rule
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-72 p-0" align="end">
- <Command>
- <CommandList>
- <CommandGroup>
- {Object.values(PamAccountPolicyRuleType).map((ruleType) => {
- const meta = PAM_ACCOUNT_POLICY_RULE_METADATA[ruleType];
- const isAdded = addedRuleTypes.has(ruleType);
- return (
- <CommandItem
- key={ruleType}
- disabled={isAdded}
- onSelect={() => {
- if (!isAdded) {
- const isPatternless =
- PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS[ruleType];
- appendRule(
- isPatternless
- ? { ruleType }
- : { ruleType, patterns: [{ value: "" }] }
- );
- setAddRuleOpen(false);
- }
- }}
- className="flex items-center justify-between gap-2"
- >
- <span className="text-sm">
- {isAdded ? (
- <span className="text-mineshaft-400">{meta.name}</span>
- ) : (
- meta.name
- )}
- </span>
- </CommandItem>
- );
- })}
- </CommandGroup>
- </CommandList>
- </Command>
- </PopoverContent>
- </Popover>
- </div>
-
- {ruleFields.map((ruleField, ruleIndex) => {
- const ruleType = currentRules[ruleIndex]?.ruleType;
- if (!ruleType) return null;
- const meta = PAM_ACCOUNT_POLICY_RULE_METADATA[ruleType];
- const isPatternless = PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS[ruleType];
-
- return (
- <div key={ruleField.id} className="rounded-md border border-border bg-card p-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <span className="text-sm font-medium text-foreground">{meta.name}</span>
- {ruleType && <RuleSupportedResourceIndicator ruleType={ruleType} />}
- </div>
- <IconButton
- variant="danger"
- size="xs"
- aria-label="Remove rule"
- onClick={() => removeRule(ruleIndex)}
- >
- <Trash2 className="size-3.5" />
- </IconButton>
- </div>
- {meta.description && (
- <p className="mt-2 text-xs text-muted">{meta.description}</p>
- )}
-
- {!isPatternless && (
- <div className="mt-3">
- <RulePatterns control={control} ruleIndex={ruleIndex} errors={errors} />
- </div>
- )}
- </div>
- );
- })}
-
- {currentRules.length === 0 && (
- <div className="rounded-md border border-dashed border-border py-8 text-center">
- <p className="text-sm text-muted">No rules added yet</p>
- {(errors.rules?.root?.message || errors.rules?.message) && (
- <p className="mt-1 text-xs text-danger">
- {errors.rules?.root?.message || errors.rules?.message}
- </p>
- )}
- </div>
- )}
-
- {currentRules.length > 0 &&
- (errors.rules?.root?.message || errors.rules?.message) && (
- <p className="mt-1 text-xs text-danger">
- {errors.rules?.root?.message || errors.rules?.message}
- </p>
- )}
- </div>
- </div>
-
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || (!isDirty && isActive === policy?.isActive)}
- variant="project"
- type="submit"
- >
- {isEditing ? "Save Changes" : "Create Policy"}
- </Button>
- <Button
- onClick={() => onOpenChange(false)}
- variant="outline"
- className="mr-auto"
- type="button"
- >
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountPoliciesPage/components/constants.ts b/frontend/src/pages/pam/PamAccountPoliciesPage/components/constants.ts
deleted file mode 100644
index b15cb9e715..0000000000
--- a/frontend/src/pages/pam/PamAccountPoliciesPage/components/constants.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { PamResourceType } from "@app/hooks/api/pam/enums";
-import { PamAccountPolicyRuleType } from "@app/hooks/api/pam/types";
-
-export const PAM_ACCOUNT_POLICY_RULE_SUPPORTED_RESOURCES: Record<
- PamAccountPolicyRuleType,
- PamResourceType[] | "all"
-> = {
- [PamAccountPolicyRuleType.CommandBlocking]: [PamResourceType.SSH],
- [PamAccountPolicyRuleType.SessionLogMasking]: "all",
- [PamAccountPolicyRuleType.RequireReason]: "all"
-};
-
-export const PAM_ACCOUNT_POLICY_RULE_METADATA: Record<
- PamAccountPolicyRuleType,
- { name: string; description: string }
-> = {
- [PamAccountPolicyRuleType.CommandBlocking]: {
- name: "Command Blocking",
- description: "Block commands matching specified patterns"
- },
- [PamAccountPolicyRuleType.SessionLogMasking]: {
- name: "Session Log Masking",
- description: "Mask sensitive data in session logs matching specified patterns"
- },
- [PamAccountPolicyRuleType.RequireReason]: {
- name: "Require Access Reason",
- description: "Require users to provide a reason before they can start a session"
- }
-};
-
-export const PAM_ACCOUNT_POLICY_RULE_IS_PATTERNLESS: Record<PamAccountPolicyRuleType, boolean> = {
- [PamAccountPolicyRuleType.CommandBlocking]: false,
- [PamAccountPolicyRuleType.SessionLogMasking]: false,
- [PamAccountPolicyRuleType.RequireReason]: true
-};
diff --git a/frontend/src/pages/pam/PamAccountPoliciesPage/route.tsx b/frontend/src/pages/pam/PamAccountPoliciesPage/route.tsx
deleted file mode 100644
index b46a585b99..0000000000
--- a/frontend/src/pages/pam/PamAccountPoliciesPage/route.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-
-import { PamAccountPoliciesPage } from "./PamAccountPoliciesPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies"
-)({
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Account Policies"
- }
- ]
- };
- },
- component: PamAccountPoliciesPage
-});
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
deleted file mode 100644
index 5728dff13d..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
+++ /dev/null
@@ -1,240 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useMemo, useState } from "react";
-import { faCopy } from "@fortawesome/free-regular-svg-icons";
-import { faTerminal, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { Link } from "@tanstack/react-router";
-import ms from "ms";
-
-import { createNotification } from "@app/components/notifications";
-import { FormLabel, IconButton, Input, Modal, ModalContent } from "@app/components/v2";
-import { ROUTE_PATHS } from "@app/const/routes";
-import { useOrganization } from "@app/context";
-import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
-import {
- PamDomainType,
- TPamDomainRelatedResource,
- useGetPamDomainById
-} from "@app/hooks/api/pamDomain";
-
-import { PamAwsIamAccessSection } from "./PamAwsIamAccessSection";
-
-type Props = {
- account?: TPamAccount;
- // Required for domain accounts; local accounts fall back to account.resource.
- resource?: TPamDomainRelatedResource;
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- reason?: string;
-};
-
-export const PamAccessAccountModal = ({
- isOpen,
- onOpenChange,
- account,
- resource: selectedResource,
- projectId,
- reason
-}: Props) => {
- const { currentOrg } = useOrganization();
- const [duration, setDuration] = useState("4h");
-
- const { protocol, hostname, port } = window.location;
- const portSuffix = port && port !== "80" && port !== "443" ? `:${port}` : "";
- const siteURL = `${protocol}//${hostname}${portSuffix}`;
-
- const isDurationValid = useMemo(() => duration && ms(duration || "1s") > 0, [duration]);
-
- const cliDuration = useMemo(() => {
- if (!duration) return duration;
-
- const unit = duration.replace(/[\d\s.-]/g, "");
-
- const dayOrLargerUnits = [
- "d",
- "day",
- "days",
- "w",
- "week",
- "weeks",
- "y",
- "yr",
- "yrs",
- "year",
- "years"
- ];
-
- // ms library does not handle months (M) so we do it separately
- if (unit === "M") {
- const value = parseInt(duration, 10);
- if (!Number.isNaN(value) && value > 0) {
- const hours = value * 30 * 24;
- return `${hours}h`;
- }
- } else if (dayOrLargerUnits.includes(unit.toLowerCase())) {
- const valueInMs = ms(duration);
- const oneHourInMs = 1000 * 60 * 60;
-
- if (typeof valueInMs === "number" && valueInMs > 0) {
- const hours = Math.floor(valueInMs / oneHourInMs);
- return `${hours}h`;
- }
- }
-
- return duration;
- }, [duration]);
-
- const targetResource = selectedResource ?? account?.resource;
-
- // Domain accounts need the AD FQDN to disambiguate from a like-named local
- // account on the same resource. The list-accounts payload only carries the
- // domain slug; fetch the full domain row to read connectionDetails.domain.
- const { data: domain } = useGetPamDomainById(
- account?.domain?.domainType ?? PamDomainType.ActiveDirectory,
- account?.domainId || undefined,
- { enabled: !!account?.domainId }
- );
-
- const command = useMemo(() => {
- if (!account || !targetResource) return "";
- // For AD-domain accounts the wire identity is `<fqdn>:<slug>` so the
- // backend routes to the domain bucket; local accounts pass just `<slug>`.
- const accountArg =
- account.domainId && domain?.connectionDetails.domain
- ? `${domain.connectionDetails.domain}:${account.name}`
- : account.name;
- const base = (verb: string) =>
- `infisical pam ${verb} access --resource ${targetResource.name} --account ${accountArg} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;
-
- switch (targetResource.resourceType) {
- case PamResourceType.Postgres:
- case PamResourceType.MySQL:
- case PamResourceType.MsSQL:
- case PamResourceType.OracleDB:
- case PamResourceType.MongoDB:
- return base("db");
- case PamResourceType.Redis:
- return base("redis");
- case PamResourceType.SSH:
- return base("ssh");
- case PamResourceType.Kubernetes:
- return base("kubernetes");
- case PamResourceType.Windows:
- return base("rdp");
- default:
- return "";
- }
- }, [account, targetResource, domain, projectId, cliDuration, siteURL]);
-
- if (!account) return null;
-
- const isAwsIam = targetResource?.resourceType === PamResourceType.AwsIam;
-
- const showWebAccess =
- targetResource?.resourceType === PamResourceType.Postgres ||
- targetResource?.resourceType === PamResourceType.SSH ||
- targetResource?.resourceType === PamResourceType.Redis ||
- targetResource?.resourceType === PamResourceType.Windows;
-
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent
- className="max-w-2xl pb-2"
- title="Access Account"
- subTitle={`Connect to ${account.name}`}
- >
- {isAwsIam ? (
- <PamAwsIamAccessSection
- account={account}
- projectId={projectId}
- reason={reason}
- onClose={() => onOpenChange(false)}
- />
- ) : (
- <>
- <div className="py-1">
- <p className="text-sm font-medium text-mineshaft-400">Terminal</p>
- <p className="mb-2 text-xs text-mineshaft-400">Connect using the Infisical CLI</p>
- <FormLabel
- label="Duration"
- tooltipText="The maximum duration of your session. Ex: 1h, 3w, 30d"
- />
- <Input
- value={duration}
- onChange={(e) => setDuration(e.target.value)}
- placeholder="permanent"
- isError={!isDurationValid}
- />
- <FormLabel label="CLI Command" className="mt-4" />
- <div className="flex gap-2">
- <Input value={command} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => {
- navigator.clipboard.writeText(command);
-
- createNotification({
- text: "Command copied to clipboard",
- type: "info"
- });
-
- onOpenChange(false);
- }}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- <a
- href="https://infisical.com/docs/cli/overview"
- target="_blank"
- className="mt-2 flex h-4 w-fit items-center gap-2 border-b border-mineshaft-400 text-sm text-mineshaft-400 transition-colors duration-100 hover:border-yellow-400 hover:text-yellow-400"
- rel="noreferrer"
- >
- <span>Install the Infisical CLI</span>
- <FontAwesomeIcon icon={faUpRightFromSquare} className="size-3" />
- </a>
- </div>
- {showWebAccess && (
- <>
- <div className="relative my-6">
- <div className="absolute inset-0 flex items-center">
- <div className="w-full border-t border-mineshaft-600" />
- </div>
- <div className="relative flex justify-center text-xs">
- <span className="bg-mineshaft-800 px-2 text-mineshaft-400">OR</span>
- </div>
- </div>
- <div className="py-1">
- <p className="text-sm font-medium text-mineshaft-400">Browser</p>
- <p className="mb-2 text-xs text-mineshaft-400">
- Connect directly from your browser
- </p>
- <div className="flex gap-2">
- <Link
- to={ROUTE_PATHS.Pam.PamAccountAccessPage.path}
- params={{
- orgId: currentOrg.id,
- accountType: targetResource?.resourceType ?? "",
- accountId: account.id
- }}
- target="_blank"
- className="flex w-full items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-black transition-colors hover:bg-primary/80"
- >
- <FontAwesomeIcon icon={faTerminal} />
- Connect in Browser
- </Link>
- </div>
- </div>
- </>
- )}
- </>
- )}
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx
deleted file mode 100644
index 796f0cb0d0..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx
+++ /dev/null
@@ -1,171 +0,0 @@
-import { useState } from "react";
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
-import { Button, SheetFooter } from "@app/components/v3";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import {
- ActiveDirectoryAccountType,
- TActiveDirectoryAccount
-} from "@app/hooks/api/pamDomain/active-directory-types";
-
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TActiveDirectoryAccount;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: z.object({
- username: z.string().trim().min(1, "Username is required"),
- password: z.string().trim().min(1, "Password is required")
- }),
- internalMetadata: z.object({
- accountType: z.nativeEnum(ActiveDirectoryAccountType)
- }),
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const ActiveDirectoryAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
- const [showPassword, setShowPassword] = useState(false);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : {
- name: "",
- description: "",
- requireMfa: false,
- credentials: {
- username: "",
- password: ""
- },
- internalMetadata: {
- accountType: ActiveDirectoryAccountType.User
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <div className="mb-4 rounded-sm border border-mineshaft-600 bg-mineshaft-700/70 p-3">
- <Controller
- name="internalMetadata.accountType"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Account Type"
- >
- <Select
- value={value}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- >
- <SelectItem value={ActiveDirectoryAccountType.User}>User Account</SelectItem>
- <SelectItem value={ActiveDirectoryAccountType.Service}>
- Service Account
- </SelectItem>
- </Select>
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Username"
- >
- <Input {...field} autoComplete="off" />
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Password"
- >
- <Input
- {...field}
- type={showPassword ? "text" : "password"}
- autoComplete="new-password"
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- </FormControl>
- )}
- />
- </div>
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/AwsIamAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/AwsIamAccountForm.tsx
deleted file mode 100644
index 830a3914d3..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/AwsIamAccountForm.tsx
+++ /dev/null
@@ -1,293 +0,0 @@
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { zodResolver } from "@hookform/resolvers/zod";
-import ms from "ms";
-import { z } from "zod";
-
-import { TtlFormLabel } from "@app/components/features";
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
- FormControl,
- Input
-} from "@app/components/v2";
-import { CopyButton } from "@app/components/v2/CopyButton";
-import { Button, SheetFooter } from "@app/components/v3";
-import { useProject } from "@app/context";
-import {
- PamResourceType,
- TAwsIamAccount,
- TAwsIamResource,
- useGetPamResourceById
-} from "@app/hooks/api/pam";
-
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-
-const AWS_STS_MIN_SESSION_DURATION = 900; // 15 minutes
-const AWS_STS_MAX_SESSION_DURATION_ROLE_CHAINING = 3600; // 1 hour
-
-type SubmitData = {
- name: string;
- description?: string | null;
- credentials: {
- targetRoleArn: string;
- defaultSessionDuration: number;
- };
-};
-
-type Props = {
- account?: TAwsIamAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: SubmitData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const arnRoleRegex = /^arn:aws:iam::\d{12}:role\/[\w+=,.@/-]+$/;
-
-const AwsIamCredentialsSchema = z.object({
- targetRoleArn: z
- .string()
- .trim()
- .min(1, "Target Role ARN is required")
- .refine((val) => arnRoleRegex.test(val), {
- message: "ARN must be in the format 'arn:aws:iam::123456789012:role/RoleName'"
- }),
- defaultSessionDuration: z.string().superRefine((val, ctx) => {
- const valMs = ms(val);
- if (typeof valMs !== "number" || valMs <= 0) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message: "Invalid duration format. Use formats like 15m, 30m, 1h"
- });
- return;
- }
- const valSeconds = valMs / 1000;
- if (valSeconds < AWS_STS_MIN_SESSION_DURATION) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message: "Minimum session duration is 15 minutes (15m)"
- });
- }
- if (valSeconds > AWS_STS_MAX_SESSION_DURATION_ROLE_CHAINING) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message: "Maximum session duration is 1 hour (1h) due to AWS role chaining"
- });
- }
- })
-});
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: AwsIamCredentialsSchema
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const AwsIamAccountForm = ({
- account,
- resourceId,
- resourceType,
- onSubmit,
- closeSheet
-}: Props) => {
- const isUpdate = Boolean(account);
- const { projectId } = useProject();
-
- const resourceIdToFetch = account?.resourceId || resourceId;
- const resourceTypeToFetch = account?.resource?.resourceType || resourceType;
- const { data: resource } = useGetPamResourceById(resourceTypeToFetch, resourceIdToFetch, {
- enabled: !!resourceIdToFetch && !!resourceTypeToFetch
- });
-
- const resourceRoleArn =
- (resource?.resourceType === PamResourceType.AwsIam &&
- (resource as TAwsIamResource).connectionDetails?.roleArn) ||
- "arn:aws:iam::<YOUR_ACCOUNT_ID>:role/<YOUR_RESOURCE_ROLE_NAME>";
-
- const targetRoleTrustPolicy = `{
- "Version": "2012-10-17",
- "Statement": [{
- "Effect": "Allow",
- "Principal": {
- "AWS": "${resourceRoleArn}"
- },
- "Action": "sts:AssumeRole",
- "Condition": {
- "StringEquals": {
- "sts:ExternalId": "${projectId}"
- }
- }
- }]
-}`;
-
- // Convert seconds to human-readable format for existing accounts
- const getDefaultSessionDuration = () => {
- if (account?.credentials?.defaultSessionDuration) {
- const seconds = account.credentials.defaultSessionDuration;
- if (seconds >= 3600 && seconds % 3600 === 0) {
- return `${seconds / 3600}h`;
- }
- return `${seconds / 60}m`;
- }
- return "1h";
- };
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- defaultSessionDuration: getDefaultSessionDuration()
- }
- }
- : {
- name: "",
- description: "",
- credentials: {
- targetRoleArn: "",
- defaultSessionDuration: "1h"
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const handleFormSubmit = async (formData: FormData) => {
- const durationMs = ms(formData.credentials.defaultSessionDuration);
- const durationSeconds = Math.floor(durationMs / 1000);
-
- await onSubmit({
- name: formData.name,
- description: formData.description,
- credentials: {
- targetRoleArn: formData.credentials.targetRoleArn,
- defaultSessionDuration: durationSeconds
- }
- });
- };
-
- return (
- <FormProvider {...form}>
- <form
- className="flex flex-1 flex-col overflow-hidden"
- onSubmit={handleSubmit(handleFormSubmit)}
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
-
- <div className="mb-4 rounded-sm border border-mineshaft-600 bg-mineshaft-700/70 p-3">
- <h4 className="mb-3 text-sm font-medium text-mineshaft-200">AWS IAM Configuration</h4>
-
- <Controller
- name="credentials.targetRoleArn"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- helperText="The ARN of the IAM role that users will assume to access the AWS Console"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Target Role ARN"
- >
- <Input
- {...field}
- placeholder="arn:aws:iam::123456789012:role/infisical-pam-MyTargetRole"
- autoComplete="off"
- />
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.defaultSessionDuration"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- helperText="Min 15m, max 1h due to AWS role chaining limit."
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label={<TtlFormLabel label="Default Session Duration" />}
- >
- <Input {...field} placeholder="1h" />
- </FormControl>
- )}
- />
- </div>
-
- <Accordion
- type="single"
- collapsible
- className="mb-4 w-full rounded-r border-l-2 border-l-primary bg-mineshaft-300/5"
- >
- <AccordionItem value="target-role-setup" className="border-b-0">
- <AccordionTrigger className="px-4 py-2.5 hover:no-underline [&[data-state=open]]:pb-1">
- <div className="flex items-center text-sm transition-colors duration-150 hover:text-primary">
- <FontAwesomeIcon icon={faInfoCircle} size="sm" className="mr-1.5 text-primary" />
- Target Role Setup
- </div>
- </AccordionTrigger>
- <AccordionContent className="px-4 pb-2.5">
- <p className="mb-3 text-sm text-mineshaft-300">
- The target role must have a trust policy that allows the Resource Role (created in
- the &quot;Resources&quot; tab) to assume it. Ensure the target role&apos;s trust
- policy includes the Resource Role as a trusted principal.
- </p>
-
- <p className="mb-2 text-sm font-medium text-mineshaft-200">
- Target role trust policy:
- </p>
- <div className="relative mb-3">
- <div className="absolute top-1 right-3">
- <CopyButton value={targetRoleTrustPolicy} size="sm" variant="plain" />
- </div>
- <pre className="max-h-45 overflow-y-auto rounded-sm border border-mineshaft-600 bg-mineshaft-800 p-2 pr-8 text-xs whitespace-pre-wrap text-mineshaft-300">
- {targetRoleTrustPolicy}
- </pre>
- </div>
- <p className="text-xs text-mineshaft-400">
- <strong>Note:</strong> The Principal role ARN shown above is from the Resource
- selected for this account. The External ID{" "}
- <code className="rounded bg-mineshaft-700 px-1 font-bold">{projectId}</code> is
- your current project ID. If you configured granular permissions in your Resource
- Role&apos;s policy, ensure this target role&apos;s ARN is included.
- </p>
- </AccordionContent>
- </AccordionItem>
- </Accordion>
-
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx
deleted file mode 100644
index 26707cab50..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-import { InfoIcon } from "lucide-react";
-import { z } from "zod";
-
-import {
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- FilterableSelect,
- Input,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { useProject } from "@app/context";
-import { useListPamAccountPolicies } from "@app/hooks/api/pam";
-import { slugSchema } from "@app/lib/schemas";
-
-export const AccountPolicyField = () => {
- const { control } = useFormContext<{ policyId?: string | null }>();
- const { projectId } = useProject();
- const { data: policies, isPending: isPoliciesLoading } = useListPamAccountPolicies(projectId);
-
- const policyOptions = [
- { label: "None", value: "" },
- ...(policies?.map((p) => ({ label: p.name, value: p.id })) ?? [])
- ];
-
- return (
- <Controller
- name="policyId"
- control={control}
- render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => {
- const selectedOption =
- policyOptions.find((o) => o.value === (value ?? "")) ?? policyOptions[0];
-
- return (
- <Field>
- <FieldLabel>
- <div className="flex items-center gap-1">
- Account Policy
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="size-3.5 text-muted" />
- </TooltipTrigger>
- <TooltipContent className="max-w-xs text-wrap">
- Account policies define behavioral rules that are enforced when this account is
- accessed.
- </TooltipContent>
- </Tooltip>
- </div>
- </FieldLabel>
- <FieldContent>
- <FilterableSelect
- value={selectedOption}
- onChange={(opt) => {
- const selected = opt as { value: string } | null;
- onChange(selected?.value || null);
- }}
- onBlur={onBlur}
- options={policyOptions}
- isError={Boolean(error)}
- isLoading={isPoliciesLoading}
- placeholder="Select a policy..."
- getOptionLabel={(option) => option.label}
- getOptionValue={(option) => option.value}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- );
- }}
- />
- );
-};
-
-export const genericAccountFieldsSchema = z.object({
- name: slugSchema({ min: 1, max: 64, field: "Name" }),
- description: z.string().max(512).nullable().optional(),
- policyId: z.string().uuid().nullable().optional(),
- metadata: z
- .object({
- key: z.string().trim().min(1),
- value: z.string().trim().default("")
- })
- .array()
- .optional()
-});
-
-export const GenericAccountFields = () => {
- const { control } = useFormContext<{
- name: string;
- description: string;
- }>();
-
- return (
- <div className="flex flex-col gap-3">
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Name</FieldLabel>
- <FieldContent>
- <div className="relative">
- <Input
- {...field}
- autoFocus
- isError={Boolean(error)}
- placeholder="my-account-name"
- />
- </div>
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="description"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Description</FieldLabel>
- <FieldContent>
- <TextArea {...field} className="max-h-32" />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/KubernetesAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/KubernetesAccountForm.tsx
deleted file mode 100644
index 12334f219f..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/KubernetesAccountForm.tsx
+++ /dev/null
@@ -1,243 +0,0 @@
-import { Controller, FormProvider, useForm, useFormContext, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { FormControl, Input, Select, SelectItem, TextArea } from "@app/components/v2";
-import { Button, SheetFooter } from "@app/components/v3";
-import { KubernetesAuthMethod, PamResourceType, TKubernetesAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TKubernetesAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const KubernetesServiceAccountTokenCredentialsSchema = z.object({
- authMethod: z.literal(KubernetesAuthMethod.ServiceAccountToken),
- serviceAccountToken: z.string().trim().min(1, "Service account token is required")
-});
-
-const KubernetesGatewayAuthCredentialsSchema = z.object({
- authMethod: z.literal(KubernetesAuthMethod.GatewayKubernetesAuth),
- namespace: z.string().trim().min(1, "Namespace is required").max(63),
- serviceAccountName: z.string().trim().min(1, "Service account name is required").max(253)
-});
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: z.discriminatedUnion("authMethod", [
- KubernetesServiceAccountTokenCredentialsSchema,
- KubernetesGatewayAuthCredentialsSchema
- ]),
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-const KubernetesAccountFields = ({
- isUpdate,
- originalAuthMethod
-}: {
- isUpdate: boolean;
- originalAuthMethod?: KubernetesAuthMethod;
-}) => {
- const { control, setValue } = useFormContext<FormData>();
-
- const authMethod =
- useWatch({ control, name: "credentials.authMethod" }) ||
- KubernetesAuthMethod.ServiceAccountToken;
-
- return (
- <div className="mb-4 rounded-sm border border-mineshaft-600 bg-mineshaft-700/70 p-3">
- <Controller
- name="credentials.authMethod"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Authentication Method"
- >
- <Select
- value={value || KubernetesAuthMethod.ServiceAccountToken}
- onValueChange={(newAuthMethod) => {
- onChange(newAuthMethod);
- // Clear credentials from other auth methods, restoring sentinel in update mode
- setValue(
- "credentials.serviceAccountToken" as never,
- (newAuthMethod === KubernetesAuthMethod.ServiceAccountToken &&
- isUpdate &&
- originalAuthMethod === KubernetesAuthMethod.ServiceAccountToken
- ? UNCHANGED_PASSWORD_SENTINEL
- : undefined) as never,
- { shouldDirty: true }
- );
- setValue("credentials.namespace" as never, undefined as never, {
- shouldDirty: true
- });
- setValue("credentials.serviceAccountName" as never, undefined as never, {
- shouldDirty: true
- });
- }}
- className="w-full border border-mineshaft-500"
- >
- <SelectItem value={KubernetesAuthMethod.ServiceAccountToken}>
- Service Account Token
- </SelectItem>
- <SelectItem value={KubernetesAuthMethod.GatewayKubernetesAuth}>Gateway</SelectItem>
- </Select>
- </FormControl>
- )}
- />
-
- {authMethod === KubernetesAuthMethod.ServiceAccountToken && (
- <Controller
- name="credentials.serviceAccountToken"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Service Account Token"
- helperText="The bearer token for the service account"
- >
- <TextArea
- {...field}
- value={field.value === UNCHANGED_PASSWORD_SENTINEL ? "" : field.value || ""}
- className="min-h-32 resize-y font-mono text-xs"
- placeholder={
- isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL
- ? "Token unchanged - click to update"
- : "eyJhbGciOiJSUzI1NiIsImtpZCI6..."
- }
- />
- </FormControl>
- )}
- />
- )}
-
- {authMethod === KubernetesAuthMethod.GatewayKubernetesAuth && (
- <>
- <Controller
- name="credentials.serviceAccountName"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Service Account Name"
- helperText="Name of the Kubernetes service account to impersonate"
- >
- <Input {...field} placeholder="deploy-bot" autoComplete="off" />
- </FormControl>
- )}
- />
- <Controller
- name="credentials.namespace"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Namespace"
- helperText="Kubernetes namespace where the service account lives"
- >
- <Input {...field} placeholder="default" autoComplete="off" />
- </FormControl>
- )}
- />
- </>
- )}
- </div>
- );
-};
-
-export const KubernetesAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const getDefaultCredentials = () => {
- if (!account) return undefined;
-
- if (account.credentials.authMethod === KubernetesAuthMethod.ServiceAccountToken) {
- return {
- ...account.credentials,
- serviceAccountToken: UNCHANGED_PASSWORD_SENTINEL
- };
- }
-
- // Gateway auth has no sensitive fields
- return account.credentials;
- };
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: getDefaultCredentials()
- }
- : {
- name: "",
- description: "",
- requireMfa: false,
- credentials: {
- authMethod: KubernetesAuthMethod.ServiceAccountToken,
- serviceAccountToken: ""
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- className="flex flex-1 flex-col overflow-hidden"
- onSubmit={(e) => {
- handleSubmit(onSubmit)(e);
- }}
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <KubernetesAccountFields
- isUpdate={isUpdate}
- originalAuthMethod={account?.credentials.authMethod}
- />
- <AccountPolicyField />
- <RequireMfaField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MetadataFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MetadataFields.tsx
deleted file mode 100644
index e998f4fd04..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MetadataFields.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { useFormContext } from "react-hook-form";
-
-import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";
-
-export const MetadataFields = () => {
- const { control } = useFormContext();
- return <MetadataForm control={control} />;
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MongoDBAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MongoDBAccountForm.tsx
deleted file mode 100644
index fec4b4815e..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MongoDBAccountForm.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TMongoDBAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-import { BaseSqlAccountSchema } from "./shared/sql-account-schemas";
-import { SqlAccountFields } from "./shared/SqlAccountFields";
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TMongoDBAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: BaseSqlAccountSchema,
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const MongoDBAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : undefined
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <SqlAccountFields isUpdate={isUpdate} />
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Add Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MsSQLAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MsSQLAccountForm.tsx
deleted file mode 100644
index c5252a4665..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MsSQLAccountForm.tsx
+++ /dev/null
@@ -1,280 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, FormProvider, useForm, useFormContext, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TMsSQLAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import { MsSqlAuthMethod } from "@app/hooks/api/pam/types/mssql-resource";
-
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TMsSQLAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const MsSQLSqlLoginCredentialsSchema = z.object({
- authMethod: z.literal(MsSqlAuthMethod.SqlLogin),
- username: z.string().trim().min(1, "Username is required").max(63),
- password: z.string().trim().min(1, "Password is required").max(256)
-});
-
-const MsSQLNtlmCredentialsSchema = z.object({
- authMethod: z.literal(MsSqlAuthMethod.Ntlm),
- username: z.string().trim().min(1, "Username is required").max(63),
- password: z.string().trim().min(1, "Password is required").max(256),
- domain: z.string().trim().min(1, "Domain is required for NTLM authentication").max(255)
-});
-
-const MsSQLKerberosCredentialsSchema = z.object({
- authMethod: z.literal(MsSqlAuthMethod.Kerberos),
- username: z.string().trim().min(1, "Username is required").max(63),
- password: z.string().trim().min(1, "Password is required").max(256),
- realm: z.string().trim().min(1, "Realm is required for Kerberos authentication").max(255),
- kdcAddress: z.string().trim().max(255).optional(),
- spn: z.string().trim().min(1, "SPN is required for Kerberos authentication").max(500)
-});
-
-const MsSQLAccountCredentialsSchema = z.discriminatedUnion("authMethod", [
- MsSQLSqlLoginCredentialsSchema,
- MsSQLNtlmCredentialsSchema,
- MsSQLKerberosCredentialsSchema
-]);
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: MsSQLAccountCredentialsSchema,
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-const MsSQLAccountFields = ({ isUpdate }: { isUpdate: boolean }) => {
- const { control, setValue } = useFormContext();
- const [showPassword, setShowPassword] = useState(false);
- const password = useWatch({ control, name: "credentials.password" });
-
- const authMethod =
- useWatch({ control, name: "credentials.authMethod" }) || MsSqlAuthMethod.SqlLogin;
-
- useEffect(() => {
- if (password === UNCHANGED_PASSWORD_SENTINEL) {
- setShowPassword(false);
- }
- }, [password]);
-
- return (
- <div className="mb-4 flex flex-col gap-3 rounded-sm border border-mineshaft-600 bg-mineshaft-700/70 p-3">
- <Controller
- name="credentials.authMethod"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Authentication Method"
- >
- <Select
- value={value || MsSqlAuthMethod.SqlLogin}
- onValueChange={(newAuthMethod) => {
- onChange(newAuthMethod);
- setValue("credentials.domain", undefined, { shouldDirty: true });
- setValue("credentials.realm", undefined, { shouldDirty: true });
- setValue("credentials.kdcAddress", undefined, { shouldDirty: true });
- setValue("credentials.spn", undefined, { shouldDirty: true });
- }}
- className="w-full border border-mineshaft-500"
- >
- <SelectItem value={MsSqlAuthMethod.SqlLogin}>SQL Server Authentication</SelectItem>
- <SelectItem value={MsSqlAuthMethod.Ntlm}>Windows Authentication (NTLM)</SelectItem>
- <SelectItem value={MsSqlAuthMethod.Kerberos}>
- Windows Authentication (Kerberos)
- </SelectItem>
- </Select>
- </FormControl>
- )}
- />
-
- {authMethod === MsSqlAuthMethod.Ntlm && (
- <Controller
- name="credentials.domain"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Domain"
- >
- <Input {...field} autoComplete="off" placeholder="CORP.EXAMPLE.COM" />
- </FormControl>
- )}
- />
- )}
-
- {authMethod === MsSqlAuthMethod.Kerberos && (
- <>
- <Controller
- name="credentials.realm"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Realm"
- >
- <Input {...field} autoComplete="off" placeholder="CORP.EXAMPLE.COM" />
- </FormControl>
- )}
- />
- <Controller
- name="credentials.spn"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Service Principal Name (SPN)"
- >
- <Input
- {...field}
- autoComplete="off"
- placeholder="MSSQLSvc/sqlserver.corp.com:1433"
- />
- </FormControl>
- )}
- />
- <Controller
- name="credentials.kdcAddress"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="KDC Address (Optional)"
- >
- <Input {...field} autoComplete="off" placeholder="dc.corp.example.com" />
- </FormControl>
- )}
- />
- </>
- )}
-
- <div className="grid grid-cols-2 gap-2">
- <Controller
- name="credentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Username"
- >
- <Input {...field} autoComplete="off" placeholder="user" />
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Password"
- >
- <Input
- {...field}
- placeholder="••••••"
- autoComplete="new-password"
- type={showPassword ? "text" : "password"}
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
- );
-};
-
-export const MsSQLAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- authMethod: account.credentials.authMethod || MsSqlAuthMethod.SqlLogin,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : {
- name: "",
- description: "",
- requireMfa: false,
- credentials: {
- authMethod: MsSqlAuthMethod.SqlLogin,
- username: "",
- password: ""
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <MsSQLAccountFields isUpdate={isUpdate} />
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Add Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx
deleted file mode 100644
index 6956d0083f..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TMySQLAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-import { BaseSqlAccountSchema } from "./shared/sql-account-schemas";
-import { SqlAccountFields } from "./shared/SqlAccountFields";
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TMySQLAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: BaseSqlAccountSchema,
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const MySQLAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : undefined
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <SqlAccountFields isUpdate={isUpdate} />
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/OracleDBAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/OracleDBAccountForm.tsx
deleted file mode 100644
index 870918fdf6..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/OracleDBAccountForm.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TOracleDBAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-import { BaseSqlAccountSchema } from "./shared/sql-account-schemas";
-import { SqlAccountFields } from "./shared/SqlAccountFields";
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TOracleDBAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: BaseSqlAccountSchema,
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const OracleDBAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : undefined
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <SqlAccountFields isUpdate={isUpdate} />
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Add Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx
deleted file mode 100644
index 88c5f22cee..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx
+++ /dev/null
@@ -1,292 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { createNotification } from "@app/components/notifications";
-import {
- PamResourceType,
- TPamAccount,
- useCreatePamAccount,
- useUpdatePamAccount
-} from "@app/hooks/api/pam";
-import { PamDomainType } from "@app/hooks/api/pamDomain";
-import { DiscriminativePick } from "@app/types";
-
-import { ActiveDirectoryAccountForm } from "./ActiveDirectoryAccountForm";
-import { AwsIamAccountForm } from "./AwsIamAccountForm";
-import { KubernetesAccountForm } from "./KubernetesAccountForm";
-import { MongoDBAccountForm } from "./MongoDBAccountForm";
-import { MsSQLAccountForm } from "./MsSQLAccountForm";
-import { MySQLAccountForm } from "./MySQLAccountForm";
-import { OracleDBAccountForm } from "./OracleDBAccountForm";
-import { PostgresAccountForm } from "./PostgresAccountForm";
-import { RedisAccountForm } from "./RedisAccountForm";
-import { SshAccountForm } from "./SshAccountForm";
-import { WindowsAccountForm } from "./WindowsAccountForm";
-
-type FormProps = {
- closeSheet: (account?: TPamAccount) => void;
-};
-
-type CreateFormProps = FormProps & {
- projectId: string;
- resourceId: string;
- resourceType: PamResourceType;
- folderId?: string;
-};
-
-type UpdateFormProps = FormProps & {
- account: TPamAccount;
-};
-
-const CreateForm = ({
- closeSheet,
- projectId,
- resourceId,
- resourceType,
- folderId
-}: CreateFormProps) => {
- const createPamAccount = useCreatePamAccount();
-
- const onSubmit = async (
- formData: DiscriminativePick<
- TPamAccount,
- "name" | "description" | "credentials" | "requireMfa"
- > & {
- internalMetadata?: Record<string, unknown>;
- metadata?: { key: string; value: string }[];
- policyId?: string | null;
- }
- ) => {
- const { internalMetadata, policyId, ...rest } = formData;
- const account = await createPamAccount.mutateAsync({
- ...rest,
- folderId,
- resourceId,
- parentType: resourceType,
- projectId,
- internalMetadata,
- policyId
- });
- createNotification({
- text: "Successfully created account",
- type: "success"
- });
- closeSheet(account);
- };
-
- switch (resourceType) {
- case PamResourceType.Postgres:
- return (
- <PostgresAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.MySQL:
- return (
- <MySQLAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.MsSQL:
- return (
- <MsSQLAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.OracleDB:
- return (
- <OracleDBAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.MongoDB:
- return (
- <MongoDBAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.Redis:
- return (
- <RedisAccountForm
- onSubmit={onSubmit as Parameters<typeof RedisAccountForm>[0]["onSubmit"]}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.SSH:
- return (
- <SshAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.Kubernetes:
- return (
- <KubernetesAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.AwsIam:
- return (
- <AwsIamAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- case PamResourceType.Windows:
- return (
- <WindowsAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
- default:
- throw new Error(`Unhandled resource: ${resourceType}`);
- }
-};
-
-const UpdateForm = ({ account, closeSheet }: UpdateFormProps) => {
- const updatePamAccount = useUpdatePamAccount();
-
- const onSubmit = async (
- formData: DiscriminativePick<
- TPamAccount,
- "name" | "description" | "credentials" | "requireMfa"
- > & {
- internalMetadata?: Record<string, unknown>;
- metadata?: { key: string; value: string }[];
- policyId?: string | null;
- }
- ) => {
- const { internalMetadata, policyId, ...rest } = formData;
- const updatedAccount = await updatePamAccount.mutateAsync({
- accountId: account.id,
- parentType: account.parentType,
- ...rest,
- internalMetadata,
- policyId
- });
- createNotification({
- text: "Successfully updated account",
- type: "success"
- });
- closeSheet(updatedAccount);
- };
-
- switch (account.parentType) {
- case PamResourceType.Postgres:
- return (
- <PostgresAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.MySQL:
- return (
- <MySQLAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.MsSQL:
- return (
- <MsSQLAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.OracleDB:
- return (
- <OracleDBAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.MongoDB:
- return (
- <MongoDBAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.Redis:
- return (
- <RedisAccountForm
- account={account as any}
- onSubmit={onSubmit as Parameters<typeof RedisAccountForm>[0]["onSubmit"]}
- closeSheet={closeSheet}
- />
- );
- case PamResourceType.SSH:
- return (
- <SshAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.Kubernetes:
- return (
- <KubernetesAccountForm
- account={account as any}
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- />
- );
- case PamResourceType.AwsIam:
- return (
- <AwsIamAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.Windows:
- return (
- <WindowsAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamDomainType.ActiveDirectory:
- return (
- <ActiveDirectoryAccountForm
- account={account as any}
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- />
- );
- default:
- throw new Error(`Unhandled account type: ${account.parentType}`);
- }
-};
-
-type Props = {
- projectId: string;
-} & FormProps &
- (
- | {
- account: TPamAccount;
- resourceId?: undefined;
- resourceType?: undefined;
- folderId?: undefined;
- }
- | {
- account?: undefined;
- resourceId: string;
- resourceType: PamResourceType;
- folderId?: string;
- }
- );
-
-export const PamAccountForm = ({ projectId, ...props }: Props) => {
- const { account } = props;
-
- return (
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
- {account ? (
- <UpdateForm {...props} account={account} />
- ) : (
- <CreateForm {...props} projectId={projectId} />
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx
deleted file mode 100644
index fc3c669c88..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PostgresAccountForm.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TPostgresAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-import { BaseSqlAccountSchema } from "./shared/sql-account-schemas";
-import { SqlAccountFields } from "./shared/SqlAccountFields";
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TPostgresAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: BaseSqlAccountSchema,
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const PostgresAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : undefined
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <SqlAccountFields isUpdate={isUpdate} />
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Add Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RedisAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RedisAccountForm.tsx
deleted file mode 100644
index cf54fdb5fd..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RedisAccountForm.tsx
+++ /dev/null
@@ -1,234 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { FormControl, Input, Switch } from "@app/components/v2";
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TRedisAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-
-const formSchema = genericAccountFieldsSchema
- .extend({
- credentialsEnabled: z.boolean().default(true),
- credentials: z.object({
- username: z
- .string()
- .trim()
- .max(256, "Username must be 256 characters or less")
- .transform((value) => (value === "" ? undefined : value))
- .optional(),
- password: z
- .string()
- .max(256, "Password must be 256 characters or less")
- .transform((value) => (value === "" ? undefined : value))
- .optional()
- })
- })
- .superRefine((data, ctx) => {
- // Make credentials required when credentialsEnabled is true
- if (data.credentialsEnabled) {
- if (!data.credentials.username || data.credentials.username.trim() === "") {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message: "Username is required when credentials are enabled",
- path: ["credentials", "username"]
- });
- }
- if (
- !data.credentials.password ||
- (data.credentials.password !== UNCHANGED_PASSWORD_SENTINEL &&
- data.credentials.password.trim() === "")
- ) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message: "Password is required when credentials are enabled",
- path: ["credentials", "password"]
- });
- }
- }
- });
-
-type FormData = z.infer<typeof formSchema>;
-type SubmitData = Omit<FormData, "credentialsEnabled">;
-
-type Props = {
- account?: TRedisAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: SubmitData) => Promise<void>;
- closeSheet: () => void;
-};
-
-export const RedisAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentialsEnabled: Boolean(
- account.credentials?.username || account.credentials?.password
- ),
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : {
- name: "",
- description: "",
- credentialsEnabled: true,
- credentials: {
- username: undefined,
- password: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- control,
- setValue,
- clearErrors,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const [showPassword, setShowPassword] = useState(false);
- const password = useWatch({ control, name: "credentials.password" });
- const credentialsEnabled = useWatch({ control, name: "credentialsEnabled" });
-
- useEffect(() => {
- if (password === UNCHANGED_PASSWORD_SENTINEL) {
- setShowPassword(false);
- }
- }, [password]);
-
- const handleFormSubmit = async (data: FormData) => {
- // Remove credentialsEnabled from the data before submitting
- // If credentials are disabled, send empty credentials
- const { credentialsEnabled: isEnabled, ...rest } = data;
- const submitData: SubmitData = {
- ...rest,
- credentials: isEnabled
- ? data.credentials
- : {
- username: undefined,
- password: undefined
- }
- };
- await onSubmit(submitData);
- };
-
- return (
- <FormProvider {...form}>
- <form
- className="flex flex-1 flex-col overflow-hidden"
- onSubmit={(e) => {
- handleSubmit(handleFormSubmit)(e);
- }}
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <Controller
- name="credentialsEnabled"
- control={control}
- render={({ field: { value, onChange } }) => (
- <div className="mt-4 mb-4">
- <Switch
- id="credentials-enabled"
- isChecked={value}
- onCheckedChange={(checked) => {
- onChange(checked);
- if (checked) {
- setValue("credentials.username", "", { shouldDirty: true });
- setValue("credentials.password", "", { shouldDirty: true });
- } else {
- setValue("credentials.username", undefined, { shouldDirty: true });
- setValue("credentials.password", undefined, { shouldDirty: true });
- clearErrors("credentials");
- }
- form.trigger("credentials");
- }}
- >
- Use Credentials
- </Switch>
- </div>
- )}
- />
- {credentialsEnabled && (
- <div className="mt-4 flex gap-2">
- <Controller
- name="credentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Username"
- >
- <Input {...field} autoComplete="off" />
- </FormControl>
- )}
- />
- <Controller
- name="credentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Password"
- >
- <Input
- {...field}
- type={showPassword ? "text" : "password"}
- autoComplete="new-password"
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- </FormControl>
- )}
- />
- </div>
- )}
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RequireMfaField.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RequireMfaField.tsx
deleted file mode 100644
index 18ecb1b6e8..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RequireMfaField.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-
-import { Field, FieldError, FieldLabel, Switch } from "@app/components/v3";
-
-export const RequireMfaField = () => {
- const { control } = useFormContext<{
- requireMfa?: boolean | null;
- }>();
-
- return (
- <Controller
- control={control}
- name="requireMfa"
- defaultValue={false}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Require MFA for Access</FieldLabel>
- <Switch
- variant="project"
- checked={field.value || false}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
deleted file mode 100644
index 2695d11d27..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-import { twMerge } from "tailwind-merge";
-import { z } from "zod";
-
-import { FormControl, Select, SelectItem, Switch, Tooltip } from "@app/components/v2";
-
-export const rotateAccountFieldsSchema = z.object({
- rotationEnabled: z.boolean(),
- rotationIntervalSeconds: z.number()
-});
-
-export const RotateAccountFields = ({
- rotationCredentialsConfigured
-}: {
- rotationCredentialsConfigured: boolean;
-}) => {
- const { control, watch } = useFormContext<{
- rotationEnabled: boolean;
- rotationIntervalSeconds: number;
- }>();
-
- const rotationEnabled = watch("rotationEnabled");
-
- return (
- <Tooltip
- content="The resource which owns this account does not have rotation credentials configured."
- isDisabled={rotationCredentialsConfigured}
- >
- <div
- className={twMerge(
- "flex h-9 w-fit items-center gap-3",
- !rotationCredentialsConfigured && "opacity-50"
- )}
- >
- <Controller
- control={control}
- name="rotationEnabled"
- defaultValue={false}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message} className="mb-0">
- <Switch
- className="ml-0 bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
- id="rotation-enabled"
- thumbClassName="bg-mineshaft-800"
- onCheckedChange={onChange}
- isChecked={value}
- isDisabled={!rotationCredentialsConfigured}
- />
- </FormControl>
- )}
- />
- <span className="text-sm">Rotate Credentials Every</span>
-
- <Controller
- name="rotationIntervalSeconds"
- control={control}
- defaultValue={2592000}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- className="mb-0"
- >
- <Select
- value={value.toString()}
- onValueChange={(val) => onChange(parseInt(val, 10))}
- className="w-full border border-mineshaft-500 capitalize"
- position="popper"
- placeholder="Select an interval..."
- dropdownContainerClassName="max-w-none"
- isDisabled={!rotationEnabled || !rotationCredentialsConfigured}
- dropdownContainerStyle={{
- width: "130px"
- }}
- >
- <SelectItem value="2592000">30 Days</SelectItem>
- <SelectItem value="604800">7 Days</SelectItem>
- <SelectItem value="259200">3 Days</SelectItem>
- <SelectItem value="86400">1 Day</SelectItem>
- </Select>
- </FormControl>
- )}
- />
- </div>
- </Tooltip>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx
deleted file mode 100644
index fee11a6dfb..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx
+++ /dev/null
@@ -1,271 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, FormProvider, useForm, useFormContext, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { FormControl, Input, Select, SelectItem, TextArea } from "@app/components/v2";
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TSSHAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import { SSHAuthMethod } from "@app/hooks/api/pam/types/ssh-resource";
-
-import { SshCaSetupSection } from "../../../components/SshCaSetupSection";
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TSSHAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const SSHPasswordCredentialsSchema = z.object({
- authMethod: z.literal(SSHAuthMethod.Password),
- username: z.string().trim().min(1, "Username is required"),
- password: z.string().trim().min(1, "Password is required")
-});
-
-const SSHPublicKeyCredentialsSchema = z.object({
- authMethod: z.literal(SSHAuthMethod.PublicKey),
- username: z.string().trim().min(1, "Username is required"),
- privateKey: z.string().trim().min(1, "Private key is required")
-});
-
-const SSHCertificateCredentialsSchema = z.object({
- authMethod: z.literal(SSHAuthMethod.Certificate),
- username: z.string().trim().min(1, "Username is required")
-});
-
-const BaseSshAccountSchema = z.discriminatedUnion("authMethod", [
- SSHPasswordCredentialsSchema,
- SSHPublicKeyCredentialsSchema,
- SSHCertificateCredentialsSchema
-]);
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: BaseSshAccountSchema,
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-const SshAccountFields = ({ isUpdate, resourceId }: { isUpdate: boolean; resourceId: string }) => {
- const { control, setValue } = useFormContext();
- const [showPassword, setShowPassword] = useState(false);
-
- const authMethod =
- useWatch({ control, name: "credentials.authMethod" }) || SSHAuthMethod.Password;
- const password = useWatch({ control, name: "credentials.password" });
-
- useEffect(() => {
- if (password === UNCHANGED_PASSWORD_SENTINEL) {
- setShowPassword(false);
- }
- }, [password]);
-
- return (
- <div className="mb-4 rounded-sm border border-mineshaft-600 bg-mineshaft-700/70 p-3">
- <Controller
- name="credentials.authMethod"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Authentication Method"
- >
- <Select
- value={value || SSHAuthMethod.Password}
- onValueChange={(newAuthMethod) => {
- onChange(newAuthMethod);
- // Clear out credentials from other auth methods
- setValue("credentials.password", undefined, { shouldDirty: true });
- setValue("credentials.privateKey", undefined, { shouldDirty: true });
- }}
- className="w-full border border-mineshaft-500"
- >
- <SelectItem value={SSHAuthMethod.Password}>Password</SelectItem>
- <SelectItem value={SSHAuthMethod.PublicKey}>SSH Key</SelectItem>
- <SelectItem value={SSHAuthMethod.Certificate}>Certificate</SelectItem>
- </Select>
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Username"
- >
- <Input {...field} autoComplete="off" />
- </FormControl>
- )}
- />
-
- {authMethod === SSHAuthMethod.Password && (
- <Controller
- name="credentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Password"
- >
- <Input
- {...field}
- type={showPassword ? "text" : "password"}
- autoComplete="new-password"
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- </FormControl>
- )}
- />
- )}
-
- {authMethod === SSHAuthMethod.PublicKey && (
- <Controller
- name="credentials.privateKey"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Private Key"
- >
- <TextArea
- {...field}
- value={field.value === UNCHANGED_PASSWORD_SENTINEL ? "" : field.value}
- className="min-h-32 resize-y font-mono text-xs"
- placeholder={
- isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL
- ? "Private key unchanged - click to update"
- : "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----"
- }
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- }}
- />
- </FormControl>
- )}
- />
- )}
-
- {authMethod === SSHAuthMethod.Certificate && <SshCaSetupSection resourceId={resourceId} />}
- </div>
- );
-};
-
-export const SshAccountForm = ({ account, resourceId, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
- const effectiveResourceId = resourceId || account?.resource?.id || "";
-
- const getDefaultCredentials = () => {
- if (!account) return undefined;
-
- if (account.credentials.authMethod === SSHAuthMethod.Password) {
- return {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- };
- }
-
- if (account.credentials.authMethod === SSHAuthMethod.PublicKey) {
- return {
- ...account.credentials,
- privateKey: UNCHANGED_PASSWORD_SENTINEL
- };
- }
-
- return account.credentials;
- };
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: getDefaultCredentials()
- }
- : {
- name: "",
- description: "",
- requireMfa: false,
- credentials: {
- authMethod: SSHAuthMethod.Password,
- username: "",
- password: ""
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- className="flex flex-1 flex-col overflow-hidden"
- onSubmit={(e) => {
- handleSubmit(onSubmit)(e);
- }}
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <SshAccountFields isUpdate={isUpdate} resourceId={effectiveResourceId} />
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/WindowsAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/WindowsAccountForm.tsx
deleted file mode 100644
index d88bebbb68..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/WindowsAccountForm.tsx
+++ /dev/null
@@ -1,169 +0,0 @@
-import { useState } from "react";
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TWindowsAccount } from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import { WindowsAccountType } from "@app/hooks/api/pam/types/windows-server-resource";
-
-import {
- AccountPolicyField,
- GenericAccountFields,
- genericAccountFieldsSchema
-} from "./GenericAccountFields";
-import { MetadataFields } from "./MetadataFields";
-import { RequireMfaField } from "./RequireMfaField";
-
-type Props = {
- account?: TWindowsAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericAccountFieldsSchema.extend({
- credentials: z.object({
- username: z.string().trim().min(1, "Username is required"),
- password: z.string().trim().min(1, "Password is required")
- }),
- internalMetadata: z.object({
- accountType: z.nativeEnum(WindowsAccountType)
- }),
- requireMfa: z.boolean().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const WindowsAccountForm = ({ account, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(account);
- const [showPassword, setShowPassword] = useState(false);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: account
- ? {
- ...account,
- credentials: {
- ...account.credentials,
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : {
- name: "",
- description: "",
- requireMfa: false,
- credentials: {
- username: "",
- password: ""
- },
- internalMetadata: {
- accountType: WindowsAccountType.User
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form className="flex flex-1 flex-col overflow-hidden" onSubmit={handleSubmit(onSubmit)}>
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericAccountFields />
- <div className="mb-4 rounded-sm border border-mineshaft-600 bg-mineshaft-700/70 p-3">
- <Controller
- name="internalMetadata.accountType"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Account Type"
- >
- <Select
- value={value}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- >
- <SelectItem value={WindowsAccountType.User}>User Account</SelectItem>
- <SelectItem value={WindowsAccountType.Service}>Service Account</SelectItem>
- </Select>
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-3"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Username"
- >
- <Input {...field} autoComplete="off" />
- </FormControl>
- )}
- />
-
- <Controller
- name="credentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Password"
- >
- <Input
- {...field}
- type={showPassword ? "text" : "password"}
- autoComplete="new-password"
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- </FormControl>
- )}
- />
- </div>
- <RequireMfaField />
- <AccountPolicyField />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Account" : "Create Account"}
- </Button>
- <Button onClick={() => closeSheet()} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/shared/SqlAccountFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/shared/SqlAccountFields.tsx
deleted file mode 100644
index 9aafbc9cbf..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/shared/SqlAccountFields.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, useFormContext, useWatch } from "react-hook-form";
-
-import { Field, FieldContent, FieldError, FieldLabel, Input } from "@app/components/v3";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-export const SqlAccountFields = ({ isUpdate }: { isUpdate: boolean }) => {
- const { control } = useFormContext();
- const [showPassword, setShowPassword] = useState(false);
- const password = useWatch({ control, name: "credentials.password" });
-
- useEffect(() => {
- if (password === UNCHANGED_PASSWORD_SENTINEL) {
- setShowPassword(false);
- }
- }, [password]);
-
- return (
- <div className="grid grid-cols-2 gap-2">
- <Controller
- name="credentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Username</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} autoComplete="off" placeholder="user" />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="credentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Password</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="••••••"
- isError={Boolean(error)}
- autoComplete="new-password"
- type={showPassword ? "text" : "password"}
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/shared/sql-account-schemas.ts b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/shared/sql-account-schemas.ts
deleted file mode 100644
index 37efd67d4b..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/shared/sql-account-schemas.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { z } from "zod";
-
-export const BaseSqlAccountSchema = z.object({
- username: z
- .string()
- .trim()
- .min(1, "Username required")
- .max(63, "Username must be 63 characters or less"),
- password: z
- .string()
- .trim()
- .min(1, "Password required")
- .max(256, "Password must be 256 characters or less")
-});
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAddAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAddAccountModal.tsx
deleted file mode 100644
index 9e9a7c21df..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAddAccountModal.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
-
-import { PamAccountForm } from "./PamAccountForm/PamAccountForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- onComplete?: (account: TPamAccount) => void;
- currentFolderId: string | null;
- resource: {
- id: string;
- name: string;
- resourceType: PamResourceType;
- };
-};
-
-export const PamAddAccountModal = ({
- isOpen,
- onOpenChange,
- projectId,
- onComplete,
- currentFolderId,
- resource
-}: Props) => {
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Create Account</SheetTitle>
- <SheetDescription>Input account connection credentials</SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
- <PamAccountForm
- closeSheet={(account) => {
- if (account && onComplete) onComplete(account);
- onOpenChange(false);
- }}
- resourceId={resource.id}
- resourceType={resource.resourceType}
- projectId={projectId}
- folderId={currentFolderId ?? undefined}
- />
- </div>
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAwsIamAccessReasonModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAwsIamAccessReasonModal.tsx
deleted file mode 100644
index 9e0a962634..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAwsIamAccessReasonModal.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useEffect, useState } from "react";
-
-import { Button, Modal, ModalContent, TextArea } from "@app/components/v2";
-import { TPamAccount } from "@app/hooks/api/pam";
-
-type Props = {
- account?: TPamAccount;
- isOpen: boolean;
- isPending?: boolean;
- onOpenChange: (isOpen: boolean) => void;
- onSubmit: (reason: string) => void;
-};
-
-export const PamAwsIamAccessReasonModal = ({
- account,
- isOpen,
- isPending,
- onOpenChange,
- onSubmit
-}: Props) => {
- const [reason, setReason] = useState("");
- const [touched, setTouched] = useState(false);
-
- useEffect(() => {
- if (isOpen) {
- setReason("");
- setTouched(false);
- }
- }, [isOpen, account?.id]);
-
- if (!account) return null;
-
- const isReasonRequired = Boolean(account.requireReason);
- const trimmed = reason.trim();
- const canSubmit = !isReasonRequired || trimmed.length > 0;
- const showError = touched && isReasonRequired && trimmed.length === 0;
-
- const handleSubmit = () => {
- if (!canSubmit) {
- setTouched(true);
- return;
- }
- onSubmit(trimmed);
- };
-
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent
- className="max-w-md"
- title={isReasonRequired ? "Reason Required" : "Open AWS Console"}
- subTitle={
- isReasonRequired
- ? "This account's policy requires a reason for access."
- : "Optionally provide a reason for this session."
- }
- >
- <div className="mt-1 flex flex-col gap-2">
- <TextArea
- value={reason}
- onChange={(e) => setReason(e.target.value)}
- placeholder={
- isReasonRequired
- ? "e.g. Investigating incident INC-1234"
- : "Optional, e.g. Reviewing IAM permissions"
- }
- rows={3}
- maxLength={1000}
- isError={showError}
- />
- {showError && <p className="text-xs text-red">A reason is required to continue.</p>}
- <div className="mt-2 flex justify-end gap-2">
- <Button
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => onOpenChange(false)}
- >
- Cancel
- </Button>
- <Button isLoading={isPending} onClick={handleSubmit}>
- {!isReasonRequired && trimmed.length === 0 ? "Skip & Continue" : "Continue"}
- </Button>
- </div>
- </div>
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAwsIamAccessSection.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAwsIamAccessSection.tsx
deleted file mode 100644
index 3db69e7e7d..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAwsIamAccessSection.tsx
+++ /dev/null
@@ -1,207 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useEffect, useRef, useState } from "react";
-import { CopyIcon, ExternalLinkIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ContentLoader } from "@app/components/v2";
-import { Button, IconButton, Input, Label } from "@app/components/v3";
-import { TPamAccount, useAccessPamAccount, useGetAwsIamConsoleUrl } from "@app/hooks/api/pam";
-import { TAwsIamCredentials } from "@app/hooks/api/pam/types";
-
-const formatExpiry = (expiresAt: string) => {
- const remainingMs = new Date(expiresAt).getTime() - Date.now();
- if (remainingMs <= 0) return "Expired";
-
- const totalMinutes = Math.floor(remainingMs / 60_000);
- const hours = Math.floor(totalMinutes / 60);
- const minutes = totalMinutes % 60;
- return hours > 0 ? `Expires in ${hours}h ${minutes}m` : `Expires in ${minutes}m`;
-};
-
-type TStsCredentials = {
- accessKeyId: string;
- secretAccessKey: string;
- sessionToken: string;
- expiresAt: string;
-};
-
-type Props = {
- account: TPamAccount;
- projectId: string;
- reason?: string;
- onClose: () => void;
-};
-
-export const PamAwsIamAccessSection = ({ account, projectId, reason, onClose }: Props) => {
- const accessPamAccount = useAccessPamAccount();
- const getAwsIamConsoleUrl = useGetAwsIamConsoleUrl();
-
- const [credentials, setCredentials] = useState<TStsCredentials | null>(null);
- const [sessionId, setSessionId] = useState<string | null>(null);
- const [error, setError] = useState<string | null>(null);
- const [, setNow] = useState(Date.now());
-
- // Guards against React 18 StrictMode's double-invoked effect, which would
- // otherwise issue two STS sessions for a single modal open
- const hasRequestedRef = useRef(false);
-
- useEffect(() => {
- const id = window.setInterval(() => setNow(Date.now()), 60_000);
- return () => window.clearInterval(id);
- }, []);
-
- useEffect(() => {
- if (hasRequestedRef.current) return;
- hasRequestedRef.current = true;
-
- const run = async () => {
- try {
- const response = await accessPamAccount.mutateAsync({
- accountId: account.id,
- resourceName: account.resource?.name ?? "",
- accountName: account.name,
- projectId,
- duration: `${(account.credentials as TAwsIamCredentials).defaultSessionDuration}s`,
- reason
- });
-
- if (
- !response.accessKeyId ||
- !response.secretAccessKey ||
- !response.sessionToken ||
- !response.expiresAt
- ) {
- setError("Backend did not return AWS credentials");
- return;
- }
-
- setCredentials({
- accessKeyId: response.accessKeyId,
- secretAccessKey: response.secretAccessKey,
- sessionToken: response.sessionToken,
- expiresAt: response.expiresAt
- });
- setSessionId(response.sessionId);
- } catch (err) {
- setError(err instanceof Error ? err.message : "Failed to generate AWS session credentials");
- }
- };
-
- run().catch(() => {});
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
- const handleCopy = (text: string, label: string) => {
- navigator.clipboard.writeText(text).catch(() => {});
- createNotification({ text: `${label} copied to clipboard`, type: "info" });
- };
-
- const handleOpenConsole = async () => {
- if (!sessionId || !credentials) return;
- try {
- const { consoleUrl } = await getAwsIamConsoleUrl.mutateAsync({
- sessionId,
- projectId,
- accessKeyId: credentials.accessKeyId,
- secretAccessKey: credentials.secretAccessKey,
- sessionToken: credentials.sessionToken
- });
- window.open(consoleUrl, "_blank", "noopener,noreferrer");
- createNotification({ text: "AWS Console opened in a new tab", type: "success" });
- onClose();
- } catch (err) {
- createNotification({
- text: err instanceof Error ? err.message : "Failed to open AWS Console",
- type: "error"
- });
- }
- };
-
- if (error) {
- return (
- <div
- role="alert"
- className="rounded-md border border-danger/20 bg-danger/5 p-4 text-sm text-danger"
- >
- {error}
- </div>
- );
- }
-
- if (!credentials) {
- return (
- <div className="flex h-40 items-center justify-center">
- <ContentLoader />
- </div>
- );
- }
-
- const fields = [
- { label: "Access Key ID", value: credentials.accessKeyId },
- { label: "Secret Access Key", value: credentials.secretAccessKey },
- { label: "Session Token", value: credentials.sessionToken }
- ];
-
- return (
- <div className="flex flex-col gap-4">
- <div>
- <div className="flex items-center justify-between">
- <div>
- <p className="text-sm font-medium text-foreground">Credentials</p>
- <p className="text-xs text-muted">
- Use with the AWS CLI, SDKs, or paste into <code>~/.aws/credentials</code>
- </p>
- </div>
- <p className="text-xs text-muted">{formatExpiry(credentials.expiresAt)}</p>
- </div>
-
- <div className="mt-3 flex flex-col gap-3">
- {fields.map(({ label, value }) => (
- <div key={label}>
- <Label className="mb-1 text-label">{label}</Label>
- <div className="flex gap-2">
- <Input value={value} readOnly />
- <IconButton
- aria-label={`Copy ${label}`}
- variant="outline"
- onClick={() => handleCopy(value, label)}
- >
- <CopyIcon />
- </IconButton>
- </div>
- </div>
- ))}
- </div>
- </div>
-
- <div className="relative my-2">
- <div className="absolute inset-0 flex items-center">
- <div className="w-full border-t border-border" />
- </div>
- <div className="relative flex justify-center text-xs">
- <span className="bg-mineshaft-800 px-2 text-muted">OR</span>
- </div>
- </div>
-
- <div>
- <p className="text-sm font-medium text-foreground">Browser</p>
- <p className="mb-2 text-xs text-muted">
- Open the AWS Console signed in as the same temporary session
- </p>
- <Button
- variant="project"
- size="md"
- isFullWidth
- isPending={getAwsIamConsoleUrl.isPending}
- onClick={() => {
- handleOpenConsole().catch(() => {});
- }}
- >
- <ExternalLinkIcon />
- Open in AWS Console
- </Button>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx
deleted file mode 100644
index 662127fa61..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
-import { TPamAccount, useDeletePamAccount } from "@app/hooks/api/pam";
-
-type Props = {
- account?: TPamAccount;
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- onDeleted?: () => void;
-};
-
-export const PamDeleteAccountModal = ({ isOpen, onOpenChange, account, onDeleted }: Props) => {
- const deletePamAccount = useDeletePamAccount();
-
- if (!account || !account.parentType) return null;
-
- const { id: accountId, name, parentType } = account;
-
- const handleDelete = async () => {
- await deletePamAccount.mutateAsync({
- accountId,
- parentType
- });
-
- createNotification({
- text: "Successfully deleted account",
- type: "success"
- });
-
- onOpenChange(false);
- if (onDeleted) onDeleted();
- };
-
- return (
- <DeleteActionModal
- isOpen={isOpen}
- onChange={onOpenChange}
- title={`Are you sure you want to delete ${name}?`}
- deleteKey={name}
- onDeleteApproved={handleDelete}
- />
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsx
deleted file mode 100644
index 4ac29acd7e..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsx
+++ /dev/null
@@ -1,241 +0,0 @@
-import { useMemo } from "react";
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon } from "lucide-react";
-import ms from "ms";
-import { z } from "zod";
-
-import { TtlFormLabel } from "@app/components/features";
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- FormControl,
- Input,
- Modal,
- ModalClose,
- ModalContent,
- TextArea
-} from "@app/components/v2";
-import { Alert, AlertDescription, AlertTitle } from "@app/components/v3";
-import { useProject } from "@app/context";
-import { ApprovalPolicyScope, ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
-import { useCreateApprovalRequest } from "@app/hooks/api/approvalRequests/mutations";
-
-type Props = {
- resourceName?: string;
- accountName?: string;
- accountAccessed?: boolean;
- accessDurationMax?: string;
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
-};
-
-type ContentProps = {
- resourceName?: string;
- accountName?: string;
- accountAccessed?: boolean;
- accessDurationMax: string;
- onOpenChange: (isOpen: boolean) => void;
-};
-
-const buildFormSchema = (max: string) =>
- z.object({
- accessDuration: z
- .string()
- .min(1, "Access duration is required")
- .refine(
- (value) => {
- try {
- return ms(value) > 0;
- } catch {
- return false;
- }
- },
- { message: "Invalid duration format. Use formats like: 1h, 3d, 30m" }
- )
- .refine(
- (value) => {
- try {
- return ms(value) >= ms("30s");
- } catch {
- return true;
- }
- },
- { message: "Access duration must be at least 30s" }
- )
- .refine(
- (value) => {
- try {
- return ms(value) <= ms(max);
- } catch {
- return true;
- }
- },
- { message: `Access duration cannot exceed ${max}` }
- ),
- justification: z.string().max(512).optional()
- });
-
-type FormData = z.infer<ReturnType<typeof buildFormSchema>>;
-
-const Content = ({
- onOpenChange,
- resourceName,
- accountName,
- accountAccessed,
- accessDurationMax
-}: ContentProps) => {
- const { projectId } = useProject();
- const { mutateAsync: createApprovalRequest, isPending: isSubmitting } =
- useCreateApprovalRequest();
-
- const resolver = useMemo(
- () => zodResolver(buildFormSchema(accessDurationMax)),
- [accessDurationMax]
- );
-
- const form = useForm<FormData>({
- resolver,
- mode: "onChange",
- defaultValues: {
- accessDuration: accessDurationMax,
- justification: ""
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isValid }
- } = form;
-
- const onSubmit = async (formData: FormData) => {
- try {
- await createApprovalRequest({
- policyType: ApprovalPolicyType.PamAccess,
- scope: ApprovalPolicyScope.Project,
- scopeId: projectId,
- justification: formData.justification || null,
- requestData: {
- accessDuration: formData.accessDuration,
- ...(resourceName && { resourceName }),
- ...(accountName && { accountName })
- }
- });
-
- createNotification({
- text: "Access request submitted successfully",
- type: "success"
- });
-
- onOpenChange(false);
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to submit access request",
- type: "error"
- });
- }
- };
-
- return (
- <form onSubmit={handleSubmit(onSubmit)}>
- {accountAccessed && (
- <Alert variant="info" className="mb-3">
- <InfoIcon />
- <AlertTitle>This account is protected by an approval policy</AlertTitle>
- <AlertDescription>
- You must request access by filling out the fields below.
- </AlertDescription>
- </Alert>
- )}
- {resourceName && accountName && (
- <div className="mb-4 rounded-md border border-mineshaft-600 bg-mineshaft-700/50 p-3">
- <div className="grid grid-cols-2 gap-4">
- <div>
- <span className="text-xs text-mineshaft-400">Resource</span>
- <p className="text-sm text-mineshaft-100">{resourceName}</p>
- </div>
- <div>
- <span className="text-xs text-mineshaft-400">Account</span>
- <p className="text-sm text-mineshaft-100">{accountName}</p>
- </div>
- </div>
- </div>
- )}
- <Controller
- name="accessDuration"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="Access Duration" />}
- errorText={error?.message}
- isError={Boolean(error?.message)}
- >
- <Input placeholder={accessDurationMax} {...field} />
- </FormControl>
- )}
- />
- <Controller
- name="justification"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Justification"
- isOptional
- >
- <TextArea placeholder="I need access to debug production issue..." {...field} />
- </FormControl>
- )}
- />
- <div className="mt-6 flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- colorSchema="secondary"
- isLoading={isSubmitting}
- isDisabled={isSubmitting || !isValid}
- >
- Request Access
- </Button>
- <ModalClose asChild>
- <Button colorSchema="secondary" variant="plain">
- Cancel
- </Button>
- </ModalClose>
- </div>
- </form>
- );
-};
-
-export const PamRequestAccountAccessModal = ({
- isOpen,
- onOpenChange,
- accessDurationMax,
- resourceName,
- accountName,
- accountAccessed
-}: Props) => {
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent
- className="max-w-2xl pb-2"
- title="Request Account Access"
- subTitle="Request access to a protected account"
- >
- {accessDurationMax && (
- <Content
- onOpenChange={onOpenChange}
- resourceName={resourceName}
- accountName={accountName}
- accountAccessed={accountAccessed}
- accessDurationMax={accessDurationMax}
- />
- )}
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamResourceOption.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamResourceOption.tsx
deleted file mode 100644
index 278ac3a622..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamResourceOption.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { components, OptionProps } from "react-select";
-import { faCheckCircle } from "@fortawesome/free-regular-svg-icons";
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { Badge } from "@app/components/v3";
-import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
-
-export const PamResourceOption = ({
- isSelected,
- children,
- ...props
-}: OptionProps<{ id: string; name: string; resourceType: PamResourceType }>) => {
- const isCreateOption = props.data.id === "_create";
-
- const { name, image } = PAM_RESOURCE_TYPE_MAP[props.data.resourceType];
-
- return (
- <components.Option isSelected={isSelected} {...props}>
- <div className="flex flex-row items-center justify-between">
- {isCreateOption ? (
- <div className="flex items-center gap-x-1 text-mineshaft-400">
- <FontAwesomeIcon icon={faPlus} size="sm" />
- <span className="mr-auto">Create New Resource</span>
- </div>
- ) : (
- <>
- <p className="truncate">{children}</p>
- <div className="mr-auto ml-2">
- <Badge variant="neutral">
- <img
- alt={`${name} logo`}
- src={`/images/integrations/${image}`}
- className="size-3"
- />
- {name}
- </Badge>
- </div>
- {isSelected && (
- <FontAwesomeIcon className="ml-2 text-primary" icon={faCheckCircle} size="sm" />
- )}
- </>
- )}
- </div>
- </components.Option>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamUpdateAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamUpdateAccountModal.tsx
deleted file mode 100644
index 8b7c182243..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamUpdateAccountModal.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { TPamAccount } from "@app/hooks/api/pam";
-
-import { PamAccountForm } from "./PamAccountForm/PamAccountForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- account?: TPamAccount;
-};
-
-export const PamUpdateAccountModal = ({ isOpen, onOpenChange, account }: Props) => {
- if (!account) return null;
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Edit Account</SheetTitle>
- <SheetDescription>Update account details.</SheetDescription>
- </SheetHeader>
- <PamAccountForm
- closeSheet={() => onOpenChange(false)}
- account={account}
- projectId={account.projectId}
- />
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx b/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx
deleted file mode 100644
index 648395ae05..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx
+++ /dev/null
@@ -1,1240 +0,0 @@
-import { useCallback, useEffect, useState } from "react";
-import { Helmet } from "react-helmet";
-import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useQuery } from "@tanstack/react-query";
-import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
-import { format } from "date-fns";
-import {
- BanIcon,
- ChevronDownIcon,
- ChevronRightIcon,
- EllipsisVerticalIcon,
- InfoIcon,
- PencilIcon,
- PlayIcon,
- TrashIcon
-} from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import {
- Alert,
- AlertDescription,
- AlertTitle,
- Badge,
- Button,
- Card,
- CardContent,
- CardHeader,
- Detail,
- DetailLabel,
- DetailValue,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- PageLoader,
- Pagination,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { ProjectPermissionSub, useOrganization } from "@app/context";
-import { ProjectPermissionPamDiscoveryActions } from "@app/context/ProjectPermissionContext/types";
-import { usePagination } from "@app/hooks";
-import { gatewaysQueryKeys } from "@app/hooks/api";
-import { useListGatewayPools } from "@app/hooks/api/gateway-pools/queries";
-import type {
- TPamDiscoverySource,
- TPamDiscoverySourceRunProgress
-} from "@app/hooks/api/pamDiscovery";
-import {
- PAM_DISCOVERY_TYPE_MAP,
- PamDiscoveryType,
- useDeletePamDiscoverySource,
- useGetDiscoveredAccounts,
- useGetDiscoveredResources,
- useGetPamDiscoverySource,
- useListPamDiscoverySourceRuns,
- useTriggerPamDiscoveryScan
-} from "@app/hooks/api/pamDiscovery";
-import { PAM_DOMAIN_TYPE_MAP, PamDomainType, useListPamDomains } from "@app/hooks/api/pamDomain";
-
-import { PamUpdateDiscoverySourceModal } from "../PamDiscoveryPage/components/PamUpdateDiscoverySourceModal";
-
-const STATUS_BADGE_MAP: Record<string, "success" | "danger" | "info"> = {
- active: "success",
- paused: "info",
- error: "danger",
- completed: "success",
- running: "info",
- failed: "danger",
- pending: "info"
-};
-
-const DiscoveryDetailsSection = ({
- source,
- onEdit
-}: {
- source: TPamDiscoverySource;
- onEdit: VoidFunction;
-}) => {
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Details</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Edit}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="space-y-4">
- <Detail>
- <DetailLabel>Name</DetailLabel>
- <DetailValue>{source.name}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Status</DetailLabel>
- <DetailValue>
- <Badge variant={STATUS_BADGE_MAP[source.status] || "info"}>{source.status}</Badge>
- </DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Schedule</DetailLabel>
- <DetailValue className="capitalize">{source.schedule || "Manual"}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Last Run</DetailLabel>
- <DetailValue>
- {source.lastRunAt ? format(new Date(source.lastRunAt), "MM/dd/yyyy, hh:mm a") : "Never"}
- </DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Created</DetailLabel>
- <DetailValue>{format(new Date(source.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
- </Detail>
- </div>
- </div>
- );
-};
-
-const DiscoveryConfigurationSection = ({
- source,
- onEdit
-}: {
- source: TPamDiscoverySource;
- onEdit: VoidFunction;
-}) => {
- const { data: gateways } = useQuery(gatewaysQueryKeys.list());
- const { data: pools } = useListGatewayPools();
- const gateway = gateways?.find((g) => g.id === source.gatewayId);
- const pool = pools?.find((p) => p.id === source.gatewayPoolId);
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Configuration</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Edit}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="space-y-4">
- {source.gatewayId && (
- <Detail>
- <DetailLabel>Gateway</DetailLabel>
- <DetailValue>{gateway?.name ?? "Unknown"}</DetailValue>
- </Detail>
- )}
- {source.gatewayPoolId && (
- <Detail>
- <DetailLabel>Gateway Pool</DetailLabel>
- <DetailValue>{pool?.name ?? "Unknown"}</DetailValue>
- </Detail>
- )}
- <Detail>
- <DetailLabel>Domain FQDN</DetailLabel>
- <DetailValue>{(source.discoveryConfiguration?.domainFQDN as string) || "-"}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>DC Address</DetailLabel>
- <DetailValue>{(source.discoveryConfiguration?.dcAddress as string) || "-"}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>LDAP Port</DetailLabel>
- <DetailValue>
- {(source.discoveryConfiguration?.ldapPort as number) ||
- (source.discoveryConfiguration?.port as number) ||
- "-"}
- {Boolean(source.discoveryConfiguration?.useLdaps) && (
- <Badge variant="info" className="ml-2">
- LDAPS
- </Badge>
- )}
- </DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>WinRM Port</DetailLabel>
- <DetailValue>
- {(source.discoveryConfiguration?.winrmPort as number) ?? "-"}
- {Boolean(source.discoveryConfiguration?.useWinrmHttps) && (
- <Badge variant="info" className="ml-2">
- HTTPS
- </Badge>
- )}
- </DetailValue>
- </Detail>
- {(source.discoveryConfiguration?.ldapCaCert as string) && (
- <Detail>
- <DetailLabel>LDAP CA Certificate</DetailLabel>
- <DetailValue>
- <Badge variant="success">Provided</Badge>
- </DetailValue>
- </Detail>
- )}
- {(source.discoveryConfiguration?.winrmCaCert as string) && (
- <Detail>
- <DetailLabel>WinRM CA Certificate</DetailLabel>
- <DetailValue>
- <Badge variant="success">Provided</Badge>
- </DetailValue>
- </Detail>
- )}
- <Detail>
- <DetailLabel>Dependency Discovery</DetailLabel>
- <DetailValue>
- {source.discoveryConfiguration?.discoverDependencies ? (
- <Badge variant="success">Enabled</Badge>
- ) : (
- <Badge variant="neutral">Disabled</Badge>
- )}
- </DetailValue>
- </Detail>
- </div>
- </div>
- );
-};
-
-const DiscoveryCredentialsSection = ({
- source,
- onEdit
-}: {
- source: TPamDiscoverySource;
- onEdit: VoidFunction;
-}) => {
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Credentials</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Edit}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="space-y-4">
- <Detail>
- <DetailLabel>Username</DetailLabel>
- <DetailValue>{(source.discoveryCredentials?.username as string) || "-"}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Password</DetailLabel>
- <DetailValue>••••••••</DetailValue>
- </Detail>
- </div>
- </div>
- );
-};
-
-const DiscoveryDomainSection = ({
- source,
- projectId,
- orgId
-}: {
- source: TPamDiscoverySource;
- projectId: string;
- orgId: string;
-}) => {
- const navigate = useNavigate();
- const domainFQDN = source.discoveryConfiguration?.domainFQDN as string | undefined;
- const fingerprint = domainFQDN?.toLowerCase();
-
- const { data: domainsData } = useListPamDomains({
- projectId,
- discoveryFingerprint: fingerprint
- });
-
- const domain = domainsData?.domains[0];
-
- const domainTypeInfo = domain
- ? PAM_DOMAIN_TYPE_MAP[domain.domainType as keyof typeof PAM_DOMAIN_TYPE_MAP]
- : null;
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="border-b border-border pb-2">
- <h3 className="text-lg font-medium">Domain</h3>
- </div>
- {domain ? (
- <button
- type="button"
- className="flex items-center gap-3 rounded-md p-2 text-left transition-colors hover:bg-mineshaft-700"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
- params: {
- orgId,
- projectId,
- domainType: domain.domainType,
- domainId: domain.id
- }
- })
- }
- >
- {domainTypeInfo?.image && (
- <img
- alt={domainTypeInfo.name}
- src={`/images/integrations/${domainTypeInfo.image}`}
- className="size-6"
- />
- )}
- <div>
- <p className="text-sm font-medium text-mineshaft-100">{domain.name}</p>
- <p className="text-xs text-muted">{domainTypeInfo?.name}</p>
- </div>
- </button>
- ) : (
- <p className="text-sm text-muted">
- No domain has been created yet. Run a scan to automatically create the domain.
- </p>
- )}
- </div>
- );
-};
-
-const formatDuration = (startedAt?: string | null, completedAt?: string | null): string => {
- if (!startedAt) return "-";
- const end = completedAt ? new Date(completedAt) : new Date();
- const seconds = Math.floor((end.getTime() - new Date(startedAt).getTime()) / 1000);
- if (seconds < 60) return `${seconds}s`;
- const mins = Math.floor(seconds / 60);
- const secs = seconds % 60;
- return secs > 0 ? `${mins}m ${secs}s` : `${mins}m`;
-};
-
-const formatIsoDate = (isoDate?: string): string => {
- if (!isoDate) return "-";
- try {
- return format(new Date(isoDate), "MM/dd/yy, HH:mm");
- } catch {
- return "-";
- }
-};
-
-const LiveDuration = ({ startedAt }: { startedAt: string }) => {
- const [, setTick] = useState(0);
- useEffect(() => {
- const id = setInterval(() => setTick((t) => t + 1), 1000);
- return () => clearInterval(id);
- }, []);
- return <>{formatDuration(startedAt, null)}</>;
-};
-
-const PROGRESS_BADGE_MAP: Record<string, "success" | "danger" | "info" | "neutral"> = {
- completed: "success",
- failed: "danger",
- running: "info",
- skipped: "neutral"
-};
-
-const RunExpandedContent = ({
- progress,
- errorMessage
-}: {
- progress?: TPamDiscoverySourceRunProgress;
- errorMessage?: string | null;
-}) => {
- const adEnum = progress?.adEnumeration;
- const depScan = progress?.machineEnumeration;
- const machineErrors = progress?.machineErrors;
- const hasMachineErrors = machineErrors && Object.keys(machineErrors).length > 0;
-
- return (
- <div className="flex flex-col gap-4 px-8 py-4">
- <div className="flex gap-10">
- {adEnum && (
- <div className="flex flex-col gap-1.5">
- <span className="text-xs font-medium tracking-wider text-label uppercase">
- Directory Scan
- </span>
- <Badge
- variant={PROGRESS_BADGE_MAP[adEnum.status] || "info"}
- className={adEnum.status === "running" ? "animate-pulse" : undefined}
- >
- {adEnum.status}
- </Badge>
- {adEnum.error && adEnum.error !== errorMessage && (
- <span className="text-xs whitespace-pre-wrap text-danger">{adEnum.error}</span>
- )}
- </div>
- )}
- {depScan && (
- <div className="flex flex-col gap-1.5">
- <span className="text-xs font-medium tracking-wider text-label uppercase">
- Host Scan
- </span>
- <Badge
- variant={PROGRESS_BADGE_MAP[depScan.status] || "info"}
- className={depScan.status === "running" ? "animate-pulse" : undefined}
- >
- {depScan.status}
- </Badge>
- {depScan.totalMachines !== undefined && (
- <span className="text-xs text-muted">
- {depScan.scannedMachines ?? 0}/{depScan.totalMachines} hosts
- {(depScan.failedMachines ?? 0) > 0 && (
- <span className="ml-1 text-danger">({depScan.failedMachines} failed)</span>
- )}
- </span>
- )}
- {depScan.statusMessage && depScan.statusMessage !== errorMessage && (
- <span className="text-xs text-muted">{depScan.statusMessage}</span>
- )}
- </div>
- )}
- </div>
- {errorMessage && (
- <div className="flex flex-col gap-1.5">
- <span className="text-xs font-medium tracking-wider text-muted uppercase">Error</span>
- <span className="rounded border border-red-500/30 bg-red-500/10 px-3 py-2 font-mono text-xs whitespace-pre-wrap text-danger">
- {errorMessage}
- </span>
- </div>
- )}
- {hasMachineErrors && (
- <div className="flex flex-col gap-1.5">
- <span className="text-xs font-medium tracking-wider text-label uppercase">
- Host Errors
- </span>
- <div className="mb-0.5 flex items-center gap-2 rounded border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400">
- <InfoIcon className="size-4 shrink-0" />
- <span className="whitespace-pre-wrap">
- Hosts without WinRM enabled will fail with &quot;socket hang up&quot;. This is
- expected for domain controllers and hosts not configured for remote management.
- </span>
- </div>
- <div className="flex flex-col gap-1">
- {Object.entries(machineErrors).map(([host, err]) => (
- <div
- key={host}
- className="rounded border border-red-500/30 bg-red-500/10 px-3 py-2 font-mono text-xs"
- >
- <span className="font-semibold text-foreground">{host}</span>
- <span className="ml-2 whitespace-pre-wrap text-label">{err}</span>
- </div>
- ))}
- </div>
- </div>
- )}
- </div>
- );
-};
-
-const RunsTab = ({
- discoverySourceId,
- discoveryType,
- autoExpandLatestRunning,
- onAutoExpandConsumed,
- isDependencyDiscoveryDisabled
-}: {
- discoverySourceId: string;
- discoveryType: PamDiscoveryType;
- autoExpandLatestRunning?: boolean;
- onAutoExpandConsumed?: () => void;
- isDependencyDiscoveryDisabled?: boolean;
-}) => {
- const [expandedRunId, setExpandedRunId] = useState<string | null>(null);
- const { page, perPage, setPage, setPerPage, offset } = usePagination("", {
- initPerPage: 20
- });
-
- const [isPolling, setIsPolling] = useState(false);
-
- const { data, isPending } = useListPamDiscoverySourceRuns(
- discoverySourceId,
- discoveryType,
- { offset, limit: perPage },
- { refetchInterval: isPolling ? 10_000 : false }
- );
-
- const runs = data?.runs || [];
- const totalCount = data?.totalCount || 0;
- const hasActiveRun = runs.some((r) => r.status === "running");
-
- // Enable/disable polling based on whether any run is active
- useEffect(() => {
- setIsPolling(hasActiveRun);
- }, [hasActiveRun]);
-
- // Auto-expand the latest running run
- useEffect(() => {
- if (!autoExpandLatestRunning) return;
- const runningRun = runs.find((r) => r.status === "running");
- if (runningRun) {
- setExpandedRunId(runningRun.id);
- onAutoExpandConsumed?.();
- }
- }, [runs, autoExpandLatestRunning, onAutoExpandConsumed]);
- const COL_COUNT = 8;
-
- return (
- <div>
- {discoveryType === PamDiscoveryType.ActiveDirectory && isDependencyDiscoveryDisabled && (
- <Alert variant="org" className="mb-4">
- <InfoIcon />
- <AlertTitle>Dependency discovery is disabled</AlertTitle>
- <AlertDescription>
- Windows Services, Scheduled Tasks, and IIS App Pools will not be discovered. Enable
- &quot;Discover Dependencies&quot; in the source configuration to scan for dependencies
- </AlertDescription>
- </Alert>
- )}
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="w-8" />
- <TableHead>Started</TableHead>
- <TableHead>Duration</TableHead>
- <TableHead>Triggered By</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Resources</TableHead>
- <TableHead>Accounts</TableHead>
- <TableHead>Dependencies</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={COL_COUNT} className="text-center text-muted">
- Loading runs...
- </TableCell>
- </TableRow>
- )}
- {!isPending && runs.length === 0 && (
- <TableRow>
- <TableCell colSpan={COL_COUNT}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>No discovery runs yet</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- runs.map((run) => {
- const isExpanded = expandedRunId === run.id;
- const hasDetails =
- run.progress?.adEnumeration ||
- run.progress?.machineEnumeration ||
- run.errorMessage ||
- (run.progress?.machineErrors && Object.keys(run.progress.machineErrors).length > 0);
-
- return (
- <>
- <TableRow
- key={run.id}
- className={hasDetails ? "cursor-pointer" : undefined}
- onClick={
- hasDetails ? () => setExpandedRunId(isExpanded ? null : run.id) : undefined
- }
- >
- <TableCell>
- {hasDetails &&
- (isExpanded ? (
- <ChevronDownIcon className="size-4 text-muted" />
- ) : (
- <ChevronRightIcon className="size-4 text-muted" />
- ))}
- </TableCell>
- <TableCell className="text-muted">
- {run.startedAt ? format(new Date(run.startedAt), "MMM d, yyyy hh:mm a") : "-"}
- </TableCell>
- <TableCell className="text-muted">
- {run.status === "running" && run.startedAt ? (
- <LiveDuration startedAt={run.startedAt} />
- ) : (
- formatDuration(run.startedAt, run.completedAt)
- )}
- </TableCell>
- <TableCell className="text-muted capitalize">{run.triggeredBy}</TableCell>
- <TableCell>
- <Badge
- variant={STATUS_BADGE_MAP[run.status] || "info"}
- className={run.status === "running" ? "animate-pulse" : undefined}
- >
- {run.status}
- </Badge>
- </TableCell>
- <TableCell>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- {run.resourcesDiscoveredCount}
- {run.newResourcesCount > 0 && (
- <span className="ml-1 text-green-400">
- (+{run.newResourcesCount})
- </span>
- )}
- {run.staleResourcesCount > 0 && (
- <span className="ml-1 text-red-400">
- (-{run.staleResourcesCount})
- </span>
- )}
- </span>
- </TooltipTrigger>
- <TooltipContent
- side="bottom"
- hidden={!run.newResourcesCount && !run.staleResourcesCount}
- >
- {run.newResourcesCount > 0 && (
- <p>{run.newResourcesCount} new resources</p>
- )}
- {run.staleResourcesCount > 0 && (
- <p>{run.staleResourcesCount} stale resources</p>
- )}
- </TooltipContent>
- </Tooltip>
- </TableCell>
- <TableCell>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- {run.accountsDiscoveredCount}
- {run.newAccountsCount > 0 && (
- <span className="ml-1 text-green-400">(+{run.newAccountsCount})</span>
- )}
- {run.staleAccountsCount > 0 && (
- <span className="ml-1 text-red-400">(-{run.staleAccountsCount})</span>
- )}
- </span>
- </TooltipTrigger>
- <TooltipContent
- side="bottom"
- hidden={!run.newAccountsCount && !run.staleAccountsCount}
- >
- {run.newAccountsCount > 0 && <p>{run.newAccountsCount} new accounts</p>}
- {run.staleAccountsCount > 0 && (
- <p>{run.staleAccountsCount} stale accounts</p>
- )}
- </TooltipContent>
- </Tooltip>
- </TableCell>
- <TableCell>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- {run.dependenciesDiscoveredCount}
- {run.newDependenciesCount > 0 && (
- <span className="ml-1 text-green-400">
- (+{run.newDependenciesCount})
- </span>
- )}
- {run.staleDependenciesCount > 0 && (
- <span className="ml-1 text-red-400">
- (-{run.staleDependenciesCount})
- </span>
- )}
- </span>
- </TooltipTrigger>
- <TooltipContent
- side="bottom"
- hidden={!run.newDependenciesCount && !run.staleDependenciesCount}
- >
- {run.newDependenciesCount > 0 && (
- <p>{run.newDependenciesCount} new dependencies</p>
- )}
- {run.staleDependenciesCount > 0 && (
- <p>{run.staleDependenciesCount} stale dependencies</p>
- )}
- </TooltipContent>
- </Tooltip>
- </TableCell>
- </TableRow>
- {isExpanded && (
- <TableRow key={`${run.id}-expanded`}>
- <TableCell colSpan={COL_COUNT} className="p-0">
- <RunExpandedContent
- progress={run.progress}
- errorMessage={run.errorMessage}
- />
- </TableCell>
- </TableRow>
- )}
- </>
- );
- })}
- </TableBody>
- </Table>
- {Boolean(totalCount) && !isPending && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- </div>
- );
-};
-
-const ResourcesTab = ({
- discoverySourceId,
- discoveryType,
- projectId
-}: {
- discoverySourceId: string;
- discoveryType: PamDiscoveryType;
- projectId: string;
-}) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const { page, perPage, setPage, setPerPage, offset } = usePagination("", {
- initPerPage: 20
- });
-
- const { data, isPending } = useGetDiscoveredResources(discoverySourceId, discoveryType, {
- offset,
- limit: perPage
- });
-
- const resources = data?.resources || [];
- const totalCount = data?.totalCount || 0;
-
- return (
- <div>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Type</TableHead>
- <TableHead>OS Version</TableHead>
- <TableHead>Deps.</TableHead>
- <TableHead>Last Discovered</TableHead>
- <TableHead>Status</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={6} className="text-center text-muted">
- Loading resources...
- </TableCell>
- </TableRow>
- )}
- {!isPending && resources.length === 0 && (
- <TableRow>
- <TableCell colSpan={6}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>No discovered resources</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- resources.map((resource) => (
- <TableRow
- key={resource.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: currentOrg.id,
- projectId,
- resourceType: resource.resourceType,
- resourceId: resource.resourceId
- }
- })
- }
- >
- <TableCell className="font-medium">{resource.resourceName}</TableCell>
- <TableCell className="text-muted">{resource.resourceType}</TableCell>
- <TableCell className="text-muted" isTruncatable>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>{resource.resourceInternalMetadata?.osVersion || "-"}</span>
- </TooltipTrigger>
- <TooltipContent side="left">
- {resource.resourceInternalMetadata?.osVersion || "-"}
- {resource.resourceInternalMetadata?.osVersionDetail &&
- ` ${resource.resourceInternalMetadata?.osVersionDetail}`}
- </TooltipContent>
- </Tooltip>
- </TableCell>
- <TableCell
- className={resource.dependencyCount ? "text-muted" : "text-mineshaft-500"}
- >
- {resource.dependencyCount ?? 0}
- </TableCell>
- <TableCell className="text-muted">
- {format(new Date(resource.lastDiscoveredAt), "MMM d, yyyy HH:mm")}
- </TableCell>
- <TableCell>
- {resource.isStale ? (
- <Badge variant="danger">Stale</Badge>
- ) : (
- <Badge variant="success">Active</Badge>
- )}
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- {Boolean(totalCount) && !isPending && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- </div>
- );
-};
-
-const AccountsTab = ({
- discoverySourceId,
- discoveryType,
- projectId
-}: {
- discoverySourceId: string;
- discoveryType: PamDiscoveryType;
- projectId: string;
-}) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const { page, perPage, setPage, setPerPage, offset } = usePagination("", {
- initPerPage: 20
- });
-
- const { data, isPending } = useGetDiscoveredAccounts(discoverySourceId, discoveryType, {
- offset,
- limit: perPage
- });
-
- const accounts = data?.accounts || [];
- const totalCount = data?.totalCount || 0;
-
- return (
- <div>
- <Alert variant="org" className="mb-4">
- <InfoIcon />
- <AlertTitle>Account passwords must be configured manually</AlertTitle>
- <AlertDescription>
- Discovered accounts are auto-imported with empty passwords by default
- </AlertDescription>
- </Alert>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Resource</TableHead>
- <TableHead>Type</TableHead>
- <TableHead>Deps.</TableHead>
- <TableHead>Last Logon</TableHead>
- <TableHead>Last Discovered</TableHead>
- <TableHead>Status</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={7} className="text-center text-muted">
- Loading accounts...
- </TableCell>
- </TableRow>
- )}
- {!isPending && accounts.length === 0 && (
- <TableRow>
- <TableCell colSpan={7}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>No discovered accounts</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- accounts.map((account) => (
- <TableRow
- key={account.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId",
- params: {
- orgId: currentOrg.id,
- projectId,
- resourceType: account.resourceType,
- resourceId: account.resourceId,
- accountId: account.accountId
- }
- })
- }
- >
- <TableCell className="font-medium">{account.accountName}</TableCell>
- <TableCell className="text-muted">
- <Tooltip>
- <TooltipTrigger asChild>
- <div className="flex max-w-36">
- <span className="truncate">{account.resourceName}</span>
- </div>
- </TooltipTrigger>
- <TooltipContent>{account.resourceName}</TooltipContent>
- </Tooltip>
- </TableCell>
- <TableCell>
- <div className="flex items-center gap-2">
- {account.resourceType === PamDomainType.ActiveDirectory && (
- <Badge variant="info">AD</Badge>
- )}
- <span className="text-muted capitalize">
- {account.internalMetadata?.accountType ?? "-"}
- </span>
- </div>
- </TableCell>
- <TableCell
- className={account.dependencyCount ? "text-muted" : "text-mineshaft-500"}
- >
- {account.dependencyCount ?? 0}
- </TableCell>
- <TableCell className="text-muted">
- {formatIsoDate(account.internalMetadata?.lastLogon)}
- </TableCell>
- <TableCell className="text-muted">
- {format(new Date(account.lastDiscoveredAt), "MM/dd/yy, HH:mm")}
- </TableCell>
- <TableCell>
- {account.isStale ? (
- <Badge variant="danger">Stale</Badge>
- ) : (
- <Badge variant="success">Active</Badge>
- )}
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- {Boolean(totalCount) && !isPending && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- </div>
- );
-};
-
-const PageContent = () => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({ strict: false }) as {
- discoverySourceId?: string;
- discoveryType?: string;
- projectId?: string;
- };
- const selectedTab = useSearch({
- strict: false,
- select: (el) => el.selectedTab
- });
-
- const { discoverySourceId, projectId } = params;
- const discoveryType = params.discoveryType as PamDiscoveryType;
-
- const handleTabChange = (tab: string) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId",
- search: (prev) => ({ ...prev, selectedTab: tab }),
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- discoveryType,
- discoverySourceId: discoverySourceId!
- }
- });
- };
-
- const [isEditModalOpen, setIsEditModalOpen] = useState(false);
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
- const [shouldAutoExpand, setShouldAutoExpand] = useState(false);
- const handleAutoExpandConsumed = useCallback(() => setShouldAutoExpand(false), []);
-
- const { data: source, isPending } = useGetPamDiscoverySource(
- discoverySourceId || "",
- discoveryType,
- {
- enabled: Boolean(discoverySourceId) && Boolean(discoveryType)
- }
- );
-
- const deleteMutation = useDeletePamDiscoverySource();
- const triggerScanMutation = useTriggerPamDiscoveryScan();
-
- if (isPending) {
- return <PageLoader />;
- }
-
- if (!source) {
- return (
- <div className="flex h-full w-full items-center justify-center px-20">
- <Empty className="max-w-2xl">
- <EmptyHeader>
- <BanIcon className="size-8 text-muted" />
- <EmptyTitle className="text-muted">
- Could not find discovery source with ID {discoverySourceId}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </div>
- );
- }
-
- const discoveryTypeInfo = PAM_DISCOVERY_TYPE_MAP[source.discoveryType];
-
- const handleBack = () => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/discovery",
- params: { orgId: currentOrg.id, projectId: projectId! }
- });
- };
-
- const handleTriggerScan = async () => {
- try {
- await triggerScanMutation.mutateAsync({
- discoverySourceId: source.id,
- discoveryType: source.discoveryType
- });
- createNotification({ text: "Scan triggered successfully", type: "success" });
- handleTabChange("runs");
- setShouldAutoExpand(true);
- } catch {
- createNotification({ text: "Failed to trigger scan", type: "error" });
- }
- };
-
- const handleDeleteConfirm = async () => {
- try {
- await deleteMutation.mutateAsync({
- discoverySourceId: source.id,
- discoveryType: source.discoveryType
- });
- createNotification({ text: "Discovery source deleted", type: "success" });
- handleBack();
- } catch {
- createNotification({ text: "Failed to delete discovery source", type: "error" });
- }
- };
-
- return (
- <div className="container mx-auto flex max-w-7xl flex-col px-6 py-6 text-mineshaft-50">
- <button
- type="button"
- onClick={handleBack}
- className="mb-4 flex items-center gap-1 text-sm text-bunker-300 hover:text-primary-400"
- >
- <FontAwesomeIcon icon={faChevronLeft} className="text-xs" />
- Discovery Sources
- </button>
-
- <div className="mb-6 flex items-center justify-between">
- <div className="flex items-center gap-4">
- <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
- <img
- alt={discoveryTypeInfo.name}
- src={`/images/integrations/${discoveryTypeInfo.image}`}
- className="size-6"
- />
- </div>
- <div>
- <h1 className="text-2xl font-semibold text-mineshaft-100">{source.name}</h1>
- <p className="text-sm text-bunker-300">{discoveryTypeInfo.name} Discovery Source</p>
- </div>
- </div>
- <div className="flex items-center gap-3">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm">
- <EllipsisVerticalIcon />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" sideOffset={2}>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Edit}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsEditModalOpen(true)}
- isDisabled={!isAllowed}
- >
- Edit Source
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Delete}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsDeleteModalOpen(true)}
- variant="danger"
- isDisabled={!isAllowed}
- >
- <TrashIcon className="size-4" />
- Delete Source
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
-
- <div className="flex gap-6">
- {/* Left Column */}
- <div className="flex w-80 shrink-0 flex-col gap-4">
- <DiscoveryDetailsSection source={source} onEdit={() => setIsEditModalOpen(true)} />
- <DiscoveryDomainSection source={source} projectId={projectId!} orgId={currentOrg.id} />
- <DiscoveryConfigurationSection source={source} onEdit={() => setIsEditModalOpen(true)} />
- <DiscoveryCredentialsSection source={source} onEdit={() => setIsEditModalOpen(true)} />
- </div>
-
- {/* Right Column - Tabbed Content */}
- <div className="min-w-0 flex-1">
- <Tabs value={selectedTab} onValueChange={handleTabChange} className="w-full">
- <Card className="py-3">
- <CardHeader>
- <div className="flex items-center justify-between gap-2">
- <TabList className="w-fit">
- <Tab value="runs">Runs</Tab>
- <Tab value="resources">Resources</Tab>
- <Tab value="accounts">Accounts</Tab>
- </TabList>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.RunScan}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <Button
- variant="neutral"
- onClick={handleTriggerScan}
- isDisabled={!isAllowed}
- isPending={triggerScanMutation.isPending}
- >
- <PlayIcon className="size-4" />
- Trigger Scan
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
- </CardHeader>
- <CardContent>
- <TabPanel value="runs" className="p-0">
- <RunsTab
- discoverySourceId={source.id}
- discoveryType={source.discoveryType}
- autoExpandLatestRunning={shouldAutoExpand}
- onAutoExpandConsumed={handleAutoExpandConsumed}
- isDependencyDiscoveryDisabled={
- !source.discoveryConfiguration?.discoverDependencies
- }
- />
- </TabPanel>
- <TabPanel value="resources" className="p-0">
- <ResourcesTab
- discoverySourceId={source.id}
- discoveryType={source.discoveryType}
- projectId={projectId!}
- />
- </TabPanel>
- <TabPanel value="accounts" className="p-0">
- <AccountsTab
- discoverySourceId={source.id}
- discoveryType={source.discoveryType}
- projectId={projectId!}
- />
- </TabPanel>
- </CardContent>
- </Card>
- </Tabs>
- </div>
- </div>
-
- <PamUpdateDiscoverySourceModal
- isOpen={isEditModalOpen}
- onOpenChange={setIsEditModalOpen}
- source={source}
- />
-
- <DeleteActionModal
- isOpen={isDeleteModalOpen}
- title={`Delete discovery source "${source.name}"?`}
- subTitle="This will permanently remove this discovery source and all its run history."
- onChange={(isOpen) => setIsDeleteModalOpen(isOpen)}
- deleteKey="confirm"
- onDeleteApproved={handleDeleteConfirm}
- />
- </div>
- );
-};
-
-export const PamDiscoveryDetailPage = () => {
- return (
- <>
- <Helmet>
- <title>Discovery Source | Infisical</title>
- <link rel="icon" href="/infisical.ico" />
- </Helmet>
- <PageContent />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryDetailPage/route.tsx b/frontend/src/pages/pam/PamDiscoveryDetailPage/route.tsx
deleted file mode 100644
index c346b9c0fb..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryDetailPage/route.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { createFileRoute, stripSearchParams } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { PamDiscoveryDetailPage } from "./PamDiscoveryDetailPage";
-
-export enum DiscoveryDetailTab {
- Runs = "runs",
- Resources = "resources",
- Accounts = "accounts"
-}
-
-const DiscoveryDetailSearchSchema = z.object({
- selectedTab: z.nativeEnum(DiscoveryDetailTab).catch(DiscoveryDetailTab.Runs)
-});
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId"
-)({
- validateSearch: zodValidator(DiscoveryDetailSearchSchema),
- component: PamDiscoveryDetailPage,
- search: {
- middlewares: [stripSearchParams({ selectedTab: DiscoveryDetailTab.Runs })]
- },
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [...context.breadcrumbs, { label: "Discovery" }, { label: "Details" }]
- };
- }
-});
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/PamDiscoveryPage.tsx b/frontend/src/pages/pam/PamDiscoveryPage/PamDiscoveryPage.tsx
deleted file mode 100644
index 466452f625..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/PamDiscoveryPage.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Helmet } from "react-helmet";
-import { useTranslation } from "react-i18next";
-
-import { PageHeader } from "@app/components/v2/PageHeader";
-import { useProject } from "@app/context";
-import { ProjectType } from "@app/hooks/api/projects/types";
-
-import { PamDiscoverySourcesTable } from "./components/PamDiscoverySourcesTable";
-
-export const PamDiscoveryPage = () => {
- const { t } = useTranslation();
- const { currentProject } = useProject();
-
- return (
- <>
- <Helmet>
- <title>{t("common.head-title", { title: "PAM Discovery" })}</title>
- </Helmet>
- <div className="h-full bg-bunker-800">
- <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <PageHeader
- scope={ProjectType.PAM}
- title="Discovery"
- description="Discover resources, accounts, and dependencies automatically."
- />
- <PamDiscoverySourcesTable projectId={currentProject.id} />
- </div>
- </div>
- </div>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryTypeSelect.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryTypeSelect.tsx
deleted file mode 100644
index cedde93da3..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryTypeSelect.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import { Button, Label } from "@app/components/v3";
-import {
- PAM_DISCOVERY_TYPE_MAP,
- PamDiscoveryType,
- useListPamDiscoverySourceOptions
-} from "@app/hooks/api/pamDiscovery";
-
-type Props = {
- onSelect: (discoveryType: PamDiscoveryType) => void;
-};
-
-export const DiscoveryTypeSelect = ({ onSelect }: Props) => {
- const { isPending, data: discoveryOptions } = useListPamDiscoverySourceOptions();
-
- if (isPending) {
- return (
- <div className="flex h-full items-center justify-center">
- <Label>Loading options...</Label>
- </div>
- );
- }
-
- return (
- <div className="flex flex-col gap-2 p-4">
- {(discoveryOptions || []).map((option) => {
- const details = PAM_DISCOVERY_TYPE_MAP[option.discoveryType];
- return (
- <Button
- key={option.discoveryType}
- onClick={() => onSelect(option.discoveryType)}
- size="lg"
- variant="neutral"
- className="w-full"
- >
- <img
- src={`/images/integrations/${details.image}`}
- className="size-6"
- alt={`${details.name} logo`}
- />
- <Label className="pointer-events-none">{details.name}</Label>
- </Button>
- );
- })}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamAddDiscoverySourceModal.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamAddDiscoverySourceModal.tsx
deleted file mode 100644
index 24af268502..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamAddDiscoverySourceModal.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { Dispatch, SetStateAction, useState } from "react";
-
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PamDiscoveryType } from "@app/hooks/api/pamDiscovery";
-
-import { PamDiscoverySourceForm } from "./PamDiscoverySourceForm/PamDiscoverySourceForm";
-import { DiscoveryTypeSelect } from "./DiscoveryTypeSelect";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
-};
-
-type ContentProps = {
- closeSheet: () => void;
- projectId: string;
- selectedType: PamDiscoveryType | null;
- setSelectedType: Dispatch<SetStateAction<PamDiscoveryType | null>>;
-};
-
-const Content = ({ closeSheet, projectId, selectedType, setSelectedType }: ContentProps) => {
- if (selectedType) {
- return (
- <PamDiscoverySourceForm
- closeSheet={closeSheet}
- onBack={() => setSelectedType(null)}
- discoveryType={selectedType}
- projectId={projectId}
- />
- );
- }
-
- return <DiscoveryTypeSelect onSelect={setSelectedType} />;
-};
-
-export const PamAddDiscoverySourceModal = ({ isOpen, onOpenChange, projectId }: Props) => {
- const [selectedType, setSelectedType] = useState<PamDiscoveryType | null>(null);
-
- return (
- <Sheet
- open={isOpen}
- onOpenChange={(e) => {
- onOpenChange(e);
- setSelectedType(null);
- }}
- >
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Create Discovery Source</SheetTitle>
- <SheetDescription>
- {selectedType
- ? "Input discovery source connection details"
- : "Select a discovery source type"}
- </SheetDescription>
- </SheetHeader>
- <Content
- projectId={projectId}
- closeSheet={() => {
- onOpenChange(false);
- setSelectedType(null);
- }}
- selectedType={selectedType}
- setSelectedType={setSelectedType}
- />
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/ActiveDirectoryDiscoveryForm.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/ActiveDirectoryDiscoveryForm.tsx
deleted file mode 100644
index 8b90f26efe..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/ActiveDirectoryDiscoveryForm.tsx
+++ /dev/null
@@ -1,572 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon, TriangleAlertIcon } from "lucide-react";
-import { z } from "zod";
-
-import {
- Alert,
- AlertDescription,
- AlertTitle,
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- SheetFooter,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import { PamDiscoveryType, TPamDiscoverySource } from "@app/hooks/api/pamDiscovery";
-
-import { GenericDiscoveryFields, genericDiscoveryFieldsSchema } from "./GenericDiscoveryFields";
-
-type Props = {
- source?: TPamDiscoverySource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericDiscoveryFieldsSchema.extend({
- discoveryType: z.literal(PamDiscoveryType.ActiveDirectory),
- discoveryConfiguration: z.object({
- domainFQDN: z.string().trim().min(1, "Domain FQDN is required").max(255),
- dcAddress: z.string().trim().min(1, "DC Address is required").max(255),
- // LDAP
- ldapPort: z.coerce.number().int().min(1).max(65535),
- useLdaps: z.boolean().default(true),
- ldapRejectUnauthorized: z.boolean().default(true),
- ldapCaCert: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional(),
- ldapTlsServerName: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional(),
- // WinRM
- winrmPort: z.coerce.number().int().min(1).max(65535),
- useWinrmHttps: z.boolean().default(true),
- winrmRejectUnauthorized: z.boolean().default(true),
- winrmCaCert: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional(),
- // Dependencies
- discoverDependencies: z.boolean().default(false)
- }),
- discoveryCredentials: z.object({
- username: z.string().trim().min(1, "Username is required").max(255),
- password: z.string().max(255)
- })
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const ActiveDirectoryDiscoveryForm = ({ source, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(source);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: source
- ? {
- discoveryType: PamDiscoveryType.ActiveDirectory,
- name: source.name,
- gatewayId: source.gatewayId ?? null,
- gatewayPoolId: source.gatewayPoolId ?? null,
- schedule: source.schedule || "manual",
- discoveryConfiguration: {
- domainFQDN: (source.discoveryConfiguration?.domainFQDN as string) || "",
- dcAddress: (source.discoveryConfiguration?.dcAddress as string) || "",
- ldapPort:
- (source.discoveryConfiguration?.ldapPort as number) ||
- (source.discoveryConfiguration?.port as number) ||
- 636,
- useLdaps: source.discoveryConfiguration?.useLdaps !== false,
- ldapRejectUnauthorized: source.discoveryConfiguration?.ldapRejectUnauthorized !== false,
- ldapCaCert:
- (source.discoveryConfiguration?.ldapCaCert as string) ||
- (source.discoveryConfiguration?.caCert as string) ||
- "",
- ldapTlsServerName: (source.discoveryConfiguration?.ldapTlsServerName as string) || "",
- winrmPort: (source.discoveryConfiguration?.winrmPort as number) || 5986,
- useWinrmHttps: source.discoveryConfiguration?.useWinrmHttps !== false,
- winrmRejectUnauthorized:
- source.discoveryConfiguration?.winrmRejectUnauthorized !== false,
- winrmCaCert:
- (source.discoveryConfiguration?.winrmCaCert as string) ||
- (source.discoveryConfiguration?.caCert as string) ||
- "",
- discoverDependencies: Boolean(source.discoveryConfiguration?.discoverDependencies)
- },
- discoveryCredentials: {
- username: (source.discoveryCredentials?.username as string) || "",
- password: UNCHANGED_PASSWORD_SENTINEL
- }
- }
- : {
- discoveryType: PamDiscoveryType.ActiveDirectory,
- schedule: "manual",
- gatewayId: null,
- gatewayPoolId: null,
- discoveryConfiguration: {
- domainFQDN: "",
- dcAddress: "",
- ldapPort: 636,
- useLdaps: true,
- ldapRejectUnauthorized: true,
- ldapCaCert: "",
- ldapTlsServerName: "",
- winrmPort: 5986,
- useWinrmHttps: true,
- winrmRejectUnauthorized: true,
- winrmCaCert: "",
- discoverDependencies: false
- },
- discoveryCredentials: {
- username: "",
- password: ""
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const [showPassword, setShowPassword] = useState(false);
- const password = useWatch({ control, name: "discoveryCredentials.password" });
- const useLdaps = useWatch({ control, name: "discoveryConfiguration.useLdaps" });
- const ldapRejectUnauthorized = useWatch({
- control,
- name: "discoveryConfiguration.ldapRejectUnauthorized"
- });
- const useWinrmHttps = useWatch({ control, name: "discoveryConfiguration.useWinrmHttps" });
- const discoverDependencies = useWatch({
- control,
- name: "discoveryConfiguration.discoverDependencies"
- });
-
- useEffect(() => {
- if (password === UNCHANGED_PASSWORD_SENTINEL) {
- setShowPassword(false);
- }
- }, [password]);
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- {/* Generic Discovery Fields */}
- <GenericDiscoveryFields />
-
- {/* Connection */}
- <div className="flex flex-col gap-3">
- <Label>Connection</Label>
-
- <Controller
- name="discoveryConfiguration.domainFQDN"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Domain FQDN
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The fully qualified domain name of the Active Directory domain (e.g.
- corp.example.com)
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} placeholder="corp.example.com" />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.dcAddress"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- DC Address
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The hostname or IP address of the Domain Controller to connect to
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- isError={Boolean(error)}
- placeholder="dc01.corp.example.com"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- {/* Username & Password */}
- <div className="grid grid-cols-2 gap-2">
- <Controller
- name="discoveryCredentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Username
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The username of an Active Directory account with read access to query the
- directory
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="Administrator"
- isError={Boolean(error)}
- autoComplete="off"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="discoveryCredentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Password
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The password for the Active Directory account used to authenticate with
- the Domain Controller
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="••••••"
- isError={Boolean(error)}
- autoComplete="new-password"
- type={showPassword ? "text" : "password"}
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (isUpdate && field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
-
- {/* Discover Dependencies */}
- <Controller
- name="discoveryConfiguration.discoverDependencies"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Discover Dependencies</FieldLabel>
- <Switch
- variant="project"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- {discoverDependencies && (
- <Alert variant="info">
- <TriangleAlertIcon />
- <AlertTitle>Warning</AlertTitle>
- <AlertDescription>
- When an account password is rotated, discovered Windows Services, Scheduled Tasks,
- and IIS App Pools that run under that account will have their credentials
- automatically updated to match. You can disable this per-dependency on the
- account&apos;s dependencies tab.
- </AlertDescription>
- </Alert>
- )}
- </div>
-
- {/* LDAP Configuration */}
- <div className="flex flex-col gap-3">
- <Label>LDAP</Label>
-
- <Controller
- name="discoveryConfiguration.ldapPort"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Port
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The LDAP port on the Domain Controller. Default is 389 for LDAP or 636 for
- LDAPS
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input {...field} type="number" placeholder="636" isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.useLdaps"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable LDAPS</FieldLabel>
- <Switch
- variant="project"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.ldapCaCert"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- className="max-h-32"
- disabled={!useLdaps}
- placeholder="-----BEGIN CERTIFICATE-----..."
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.ldapRejectUnauthorized"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to the Domain Controller if it has a
- valid, trusted TLS certificate
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!useLdaps}
- checked={useLdaps ? field.value : false}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.ldapTlsServerName"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- TLS Server Name
- <Tooltip>
- <TooltipTrigger>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The expected hostname in the server&apos;s TLS certificate. Required when DC
- Address is an IP address and Reject Unauthorized is enabled.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="dc.corp.example.com"
- disabled={!useLdaps || !ldapRejectUnauthorized}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
-
- <div className="flex flex-col gap-3">
- <Label>WinRM</Label>
-
- <Controller
- name="discoveryConfiguration.winrmPort"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Port
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The WinRM port on target machines. Default is 5985 for HTTP or 5986 for
- HTTPS
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input {...field} type="number" placeholder="5986" isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.useWinrmHttps"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable HTTPS</FieldLabel>
- <Switch
- variant="project"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.winrmCaCert"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- className="max-h-32"
- disabled={!useWinrmHttps}
- placeholder="-----BEGIN CERTIFICATE-----..."
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="discoveryConfiguration.winrmRejectUnauthorized"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to target machines if they have a
- valid, trusted TLS certificate
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!useWinrmHttps}
- checked={useWinrmHttps ? field.value : false}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- </div>
- </div>
-
- {/* Sheet Footer */}
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="project"
- type="submit"
- >
- {isUpdate ? "Update Discovery Source" : "Create Discovery Source"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsx
deleted file mode 100644
index fff9850189..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-import { z } from "zod";
-
-import {
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue
-} from "@app/components/v3";
-import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";
-
-// No .refine() — would turn into ZodEffects and break .extend() in per-type discovery forms.
-export const genericDiscoveryFieldsSchema = z.object({
- name: z.string().trim().min(1, "Name is required").max(255),
- gatewayId: z.string().nullable().optional(),
- gatewayPoolId: z.string().nullable().optional(),
- schedule: z.string().default("manual")
-});
-
-type GenericFormValues = {
- name: string;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- schedule: string;
-};
-
-export const GenericDiscoveryFields = () => {
- const { control, watch, setValue } = useFormContext<GenericFormValues>();
- const gatewayId = watch("gatewayId");
- const gatewayPoolId = watch("gatewayPoolId");
-
- return (
- <div className="flex flex-col gap-3">
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Name</FieldLabel>
- <FieldContent>
- <div className="relative">
- <Input
- {...field}
- autoFocus
- isError={Boolean(error)}
- placeholder="my-discovery-source"
- />
- </div>
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="gatewayId"
- render={({ fieldState: { error } }) => (
- <Field>
- <FieldLabel>Gateway</FieldLabel>
- <FieldContent>
- <GatewayPicker
- isRequired
- placeholder="Select a Gateway..."
- value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}
- onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {
- setValue("gatewayId", newGwId, { shouldDirty: true, shouldValidate: true });
- setValue("gatewayPoolId", newPoolId, {
- shouldDirty: true,
- shouldValidate: true
- });
- }}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="schedule"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Schedule</FieldLabel>
- <FieldContent>
- <Select value={value} onValueChange={onChange}>
- <SelectTrigger className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent position="popper" align="start">
- <SelectItem value="manual">Manual</SelectItem>
- <SelectItem value="daily">Daily</SelectItem>
- <SelectItem value="weekly">Weekly</SelectItem>
- </SelectContent>
- </Select>
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/PamDiscoverySourceForm.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/PamDiscoverySourceForm.tsx
deleted file mode 100644
index 10cb0753f8..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/PamDiscoverySourceForm.tsx
+++ /dev/null
@@ -1,126 +0,0 @@
-import { createNotification } from "@app/components/notifications";
-import {
- PAM_DISCOVERY_TYPE_MAP,
- PamDiscoveryType,
- TPamDiscoverySource,
- useCreatePamDiscoverySource,
- useUpdatePamDiscoverySource
-} from "@app/hooks/api/pamDiscovery";
-
-import { PamDiscoverySourceHeader } from "../PamDiscoverySourceHeader";
-import { ActiveDirectoryDiscoveryForm } from "./ActiveDirectoryDiscoveryForm";
-
-type FormProps = {
- closeSheet: () => void;
-} & ({ source: TPamDiscoverySource } | { discoveryType: PamDiscoveryType });
-
-type CreateFormProps = FormProps & {
- discoveryType: PamDiscoveryType;
- projectId: string;
-};
-
-type UpdateFormProps = FormProps & {
- source: TPamDiscoverySource;
-};
-
-const CreateForm = ({ discoveryType, closeSheet, projectId }: CreateFormProps) => {
- const createPamDiscoverySource = useCreatePamDiscoverySource();
- const { name: discoveryName } = PAM_DISCOVERY_TYPE_MAP[discoveryType];
-
- const onSubmit = async (formData: {
- name: string;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- schedule: string;
- discoveryType: PamDiscoveryType;
- discoveryConfiguration: Record<string, unknown>;
- discoveryCredentials: Record<string, unknown>;
- }) => {
- await createPamDiscoverySource.mutateAsync({
- projectId,
- name: formData.name,
- discoveryType: formData.discoveryType,
- gatewayId: formData.gatewayId ?? undefined,
- gatewayPoolId: formData.gatewayPoolId ?? undefined,
- discoveryConfiguration: formData.discoveryConfiguration,
- discoveryCredentials: formData.discoveryCredentials,
- schedule: formData.schedule
- });
- createNotification({
- text: `Successfully created ${discoveryName} discovery source`,
- type: "success"
- });
- closeSheet();
- };
-
- switch (discoveryType) {
- case PamDiscoveryType.ActiveDirectory:
- return <ActiveDirectoryDiscoveryForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- default:
- throw new Error(`Unhandled discovery type: ${discoveryType}`);
- }
-};
-
-const UpdateForm = ({ source, closeSheet }: UpdateFormProps) => {
- const updatePamDiscoverySource = useUpdatePamDiscoverySource();
- const { name: discoveryName } = PAM_DISCOVERY_TYPE_MAP[source.discoveryType];
-
- const onSubmit = async (formData: {
- name: string;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- schedule: string;
- discoveryType: PamDiscoveryType;
- discoveryConfiguration: Record<string, unknown>;
- discoveryCredentials: Record<string, unknown>;
- }) => {
- await updatePamDiscoverySource.mutateAsync({
- discoverySourceId: source.id,
- discoveryType: formData.discoveryType,
- name: formData.name,
- gatewayId: formData.gatewayId ?? undefined,
- gatewayPoolId: formData.gatewayPoolId ?? undefined,
- discoveryConfiguration: formData.discoveryConfiguration,
- discoveryCredentials: formData.discoveryCredentials,
- schedule: formData.schedule
- });
- createNotification({
- text: `Successfully updated ${discoveryName} discovery source`,
- type: "success"
- });
- closeSheet();
- };
-
- switch (source.discoveryType) {
- case PamDiscoveryType.ActiveDirectory:
- return (
- <ActiveDirectoryDiscoveryForm source={source} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- default:
- throw new Error(`Unhandled discovery type: ${source.discoveryType}`);
- }
-};
-
-type Props = { onBack?: () => void; projectId: string } & Pick<FormProps, "closeSheet"> &
- (
- | { discoveryType: PamDiscoveryType; source?: undefined }
- | { discoveryType?: undefined; source: TPamDiscoverySource }
- );
-
-export const PamDiscoverySourceForm = ({ onBack, projectId, ...props }: Props) => {
- const { source, discoveryType } = props;
-
- return (
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
- <PamDiscoverySourceHeader
- discoveryType={discoveryType || source.discoveryType}
- onBack={onBack}
- />
- {source ? (
- <UpdateForm {...props} source={source} />
- ) : (
- <CreateForm {...props} discoveryType={discoveryType} projectId={projectId} />
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceHeader.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceHeader.tsx
deleted file mode 100644
index f861615f4f..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceHeader.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { PencilIcon } from "lucide-react";
-
-import { Button, Label } from "@app/components/v3";
-import { PAM_DISCOVERY_TYPE_MAP, PamDiscoveryType } from "@app/hooks/api/pamDiscovery";
-
-type Props = {
- discoveryType: PamDiscoveryType;
- onBack?: () => void;
-};
-
-export const PamDiscoverySourceHeader = ({ discoveryType, onBack }: Props) => {
- const details = PAM_DISCOVERY_TYPE_MAP[discoveryType];
-
- return (
- <div className="flex w-full items-center gap-2.5 border-b border-border p-3">
- <img
- alt={`${details.name} logo`}
- src={`/images/integrations/${details.image}`}
- className="size-9"
- />
- <div className="flex w-full flex-col gap-1">
- <Label>{details.name}</Label>
- <p className="text-xs text-muted">Discovery Source</p>
- </div>
- {onBack && (
- <Button size="xs" variant="neutral" onClick={onBack}>
- <PencilIcon />
- Change
- </Button>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourcesTable.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourcesTable.tsx
deleted file mode 100644
index 7312a304a2..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourcesTable.tsx
+++ /dev/null
@@ -1,282 +0,0 @@
-import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate } from "@tanstack/react-router";
-import { format } from "date-fns";
-import { EllipsisVerticalIcon, PlayIcon, PlusIcon, TrashIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Input } from "@app/components/v2";
-import {
- Badge,
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Pagination,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
-} from "@app/components/v3";
-import { ProjectPermissionSub, useOrganization, useProject } from "@app/context";
-import { ProjectPermissionPamDiscoveryActions } from "@app/context/ProjectPermissionContext/types";
-import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
-import type { TPamDiscoverySource } from "@app/hooks/api/pamDiscovery";
-import {
- useDeletePamDiscoverySource,
- useListPamDiscoverySources,
- useTriggerPamDiscoveryScan
-} from "@app/hooks/api/pamDiscovery";
-
-import { PamAddDiscoverySourceModal } from "./PamAddDiscoverySourceModal";
-
-const STATUS_BADGE_MAP: Record<string, "success" | "danger" | "info"> = {
- active: "success",
- paused: "info",
- error: "danger"
-};
-
-type Props = {
- projectId: string;
-};
-
-export const PamDiscoverySourcesTable = ({ projectId }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const { currentProject } = useProject();
-
- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
- "addSource",
- "deleteSource"
- ] as const);
-
- const { search, debouncedSearch, setSearch, setPage, page, perPage, setPerPage, offset } =
- usePagination("", { initPerPage: 20 });
-
- const { data, isPending } = useListPamDiscoverySources({
- projectId,
- offset,
- limit: perPage,
- search: debouncedSearch
- });
-
- const sources = data?.sources || [];
- const totalCount = data?.totalCount || 0;
-
- useResetPageHelper({ totalCount, offset, setPage });
-
- const deleteMutation = useDeletePamDiscoverySource();
- const triggerScanMutation = useTriggerPamDiscoveryScan();
-
- const handleDelete = async () => {
- const source = popUp.deleteSource.data as TPamDiscoverySource;
- if (!source) return;
- try {
- await deleteMutation.mutateAsync({
- discoverySourceId: source.id,
- discoveryType: source.discoveryType
- });
- createNotification({ text: "Discovery source deleted", type: "success" });
- handlePopUpClose("deleteSource");
- } catch {
- createNotification({ text: "Failed to delete discovery source", type: "error" });
- }
- };
-
- const handleTriggerScan = async (source: TPamDiscoverySource) => {
- try {
- await triggerScanMutation.mutateAsync({
- discoverySourceId: source.id,
- discoveryType: source.discoveryType
- });
- createNotification({ text: "Scan triggered successfully", type: "success" });
- } catch {
- createNotification({ text: "Failed to trigger scan", type: "error" });
- }
- };
-
- return (
- <div>
- <div className="flex gap-2">
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search discovery sources..."
- className="h-full flex-1"
- containerClassName="h-9"
- />
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Create}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <Button
- variant="project"
- onClick={() => handlePopUpOpen("addSource")}
- isDisabled={!isAllowed}
- >
- <PlusIcon />
- Add Discovery Source
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
-
- <div className="mt-4">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Domain</TableHead>
- <TableHead>Schedule</TableHead>
- <TableHead>Resources</TableHead>
- <TableHead>Accounts</TableHead>
- <TableHead>Dependencies</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Last Run</TableHead>
- <TableHead className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={9} className="text-center text-muted">
- Loading discovery sources...
- </TableCell>
- </TableRow>
- )}
- {!isPending && sources.length === 0 && (
- <TableRow>
- <TableCell colSpan={9}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>
- {search ? "No discovery sources match search" : "No discovery sources"}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- sources.map((source) => (
- <TableRow
- key={source.id}
- className="group cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId",
- params: {
- orgId: currentOrg.id,
- projectId: currentProject.id,
- discoveryType: source.discoveryType,
- discoverySourceId: source.id
- }
- })
- }
- >
- <TableCell className="font-medium">{source.name}</TableCell>
- <TableCell className="text-muted">
- {(source.discoveryConfiguration?.domainFQDN as string) || "-"}
- </TableCell>
- <TableCell className="text-muted capitalize">{source.schedule ?? "-"}</TableCell>
- <TableCell className="text-muted">{source.totalResources}</TableCell>
- <TableCell className="text-muted">{source.totalAccounts}</TableCell>
- <TableCell className="text-muted">{source.totalDependencies}</TableCell>
- <TableCell>
- <Badge variant={STATUS_BADGE_MAP[source.status] || "info"}>
- {source.status}
- </Badge>
- </TableCell>
- <TableCell className="text-muted">
- {source.lastRunAt
- ? format(new Date(source.lastRunAt), "MMM d, yyyy HH:mm")
- : "Never"}
- </TableCell>
- <TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton variant="ghost" size="xs" onClick={(e) => e.stopPropagation()}>
- <EllipsisVerticalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.RunScan}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- handleTriggerScan(source);
- }}
- >
- <PlayIcon className="size-4" />
- Trigger Scan
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamDiscoveryActions.Delete}
- a={ProjectPermissionSub.PamDiscovery}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteSource", source);
- }}
- >
- <TrashIcon className="size-4" />
- Delete
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- {Boolean(totalCount) && !isPending && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- </div>
-
- <PamAddDiscoverySourceModal
- isOpen={popUp.addSource.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("addSource", isOpen)}
- projectId={projectId}
- />
-
- <DeleteActionModal
- isOpen={popUp.deleteSource.isOpen}
- title={`Delete discovery source "${(popUp.deleteSource.data as TPamDiscoverySource)?.name}"?`}
- subTitle="This will permanently remove this discovery source and all its run history."
- onChange={(isOpen) => handlePopUpToggle("deleteSource", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={handleDelete}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamUpdateDiscoverySourceModal.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamUpdateDiscoverySourceModal.tsx
deleted file mode 100644
index e11684962f..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamUpdateDiscoverySourceModal.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PAM_DISCOVERY_TYPE_MAP, TPamDiscoverySource } from "@app/hooks/api/pamDiscovery";
-
-import { PamDiscoverySourceForm } from "./PamDiscoverySourceForm/PamDiscoverySourceForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- source?: TPamDiscoverySource;
-};
-
-export const PamUpdateDiscoverySourceModal = ({ isOpen, onOpenChange, source }: Props) => {
- if (!source) return null;
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Edit Discovery Source</SheetTitle>
- <SheetDescription>
- Update details for this {PAM_DISCOVERY_TYPE_MAP[source.discoveryType].name} discovery
- source.
- </SheetDescription>
- </SheetHeader>
- <PamDiscoverySourceForm
- closeSheet={() => onOpenChange(false)}
- source={source}
- projectId={source.projectId}
- />
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/route.tsx b/frontend/src/pages/pam/PamDiscoveryPage/route.tsx
deleted file mode 100644
index f200db55ac..0000000000
--- a/frontend/src/pages/pam/PamDiscoveryPage/route.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { PamDiscoveryPage } from "./PamDiscoveryPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/"
-)({
- validateSearch: zodValidator(
- z.object({
- search: z.string().optional()
- })
- ),
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Discovery"
- }
- ]
- };
- },
- component: PamDiscoveryPage
-});
diff --git a/frontend/src/pages/pam/PamDomainAccountByIDPage/route.tsx b/frontend/src/pages/pam/PamDomainAccountByIDPage/route.tsx
deleted file mode 100644
index 84900c7f86..0000000000
--- a/frontend/src/pages/pam/PamDomainAccountByIDPage/route.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { createFileRoute, linkOptions } from "@tanstack/react-router";
-
-import { PamAccountByIDPage } from "../PamAccountByIDPage/PamAccountByIDPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/"
-)({
- component: PamAccountByIDPage,
- beforeLoad: ({ context, params }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Domains",
- link: linkOptions({
- to: "/organizations/$orgId/projects/pam/$projectId/domains",
- params: { orgId: params.orgId, projectId: params.projectId }
- })
- },
- {
- label: "Domain",
- link: linkOptions({
- to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
- params: {
- orgId: params.orgId,
- projectId: params.projectId,
- domainType: params.domainType,
- domainId: params.domainId
- }
- })
- },
- {
- label: "Account Details"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/PamDomainByIDPage.tsx b/frontend/src/pages/pam/PamDomainByIDPage/PamDomainByIDPage.tsx
deleted file mode 100644
index eca8d4b8a9..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/PamDomainByIDPage.tsx
+++ /dev/null
@@ -1,237 +0,0 @@
-import { useState } from "react";
-import { Helmet } from "react-helmet";
-import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
-import { BanIcon, EllipsisVerticalIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- PageLoader
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
-import {
- PAM_DOMAIN_TYPE_MAP,
- PamDomainType,
- useDeletePamDomain,
- useGetPamDomainById
-} from "@app/hooks/api/pamDomain";
-
-import {
- PamDomainAccountsSection,
- PamDomainConnectionSection,
- PamDomainDetailsSection,
- PamDomainMetadataSection,
- PamDomainRelatedResourcesSection,
- PamUpdateDomainModal
-} from "./components";
-
-const PageContent = () => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({
- strict: false
- }) as { domainId?: string; domainType?: string; projectId?: string; orgId?: string };
-
- const { domainId, domainType, projectId } = params;
-
- const selectedTab = useSearch({
- strict: false,
- select: (el) => el.selectedTab
- });
-
- const handleTabChange = (tab: string) => {
- navigate({
- to: ".",
- search: { selectedTab: tab }
- });
- };
-
- const [isEditModalOpen, setIsEditModalOpen] = useState(false);
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
-
- const { data: domain, isPending } = useGetPamDomainById(domainType as PamDomainType, domainId, {
- enabled: Boolean(domainId) && Boolean(domainType)
- });
-
- const deleteDomain = useDeletePamDomain();
-
- if (isPending) {
- return <PageLoader />;
- }
-
- if (!domain) {
- return (
- <div className="flex h-full w-full items-center justify-center px-20">
- <Empty className="max-w-2xl">
- <EmptyHeader>
- <BanIcon className="size-8 text-muted" />
- <EmptyTitle className="text-muted">
- Could not find PAM Domain with ID {domainId}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </div>
- );
- }
-
- const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType];
-
- const handleBack = () => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/domains",
- params: { orgId: currentOrg.id, projectId: projectId! }
- });
- };
-
- const handleDeleteConfirm = async () => {
- if (!domain) return;
-
- try {
- await deleteDomain.mutateAsync({
- domainId: domain.id,
- domainType: domain.domainType
- });
- createNotification({
- text: `Domain "${domain.name}" deleted successfully`,
- type: "success"
- });
- handleBack();
- } catch (error) {
- console.error("Failed to delete domain:", error);
- createNotification({
- text: "Failed to delete domain",
- type: "error"
- });
- }
- };
-
- return (
- <div className="container mx-auto flex max-w-7xl flex-col px-6 py-6 text-mineshaft-50">
- <button
- type="button"
- onClick={handleBack}
- className="mb-4 flex items-center gap-1 text-sm text-bunker-300 hover:text-primary-400"
- >
- <FontAwesomeIcon icon={faChevronLeft} className="text-xs" />
- Domains
- </button>
-
- <div className="mb-6 flex items-center justify-between">
- <div className="flex items-center gap-4">
- <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
- <img
- alt={domainTypeInfo.name}
- src={`/images/integrations/${domainTypeInfo.image}`}
- className="size-6"
- />
- </div>
- <div>
- <h1 className="text-2xl font-semibold text-mineshaft-100">{domain.name}</h1>
- <p className="text-sm text-bunker-300">{domainTypeInfo.name} Domain</p>
- </div>
- </div>
- <div className="flex items-center gap-3">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm">
- <EllipsisVerticalIcon />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" sideOffset={2}>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamDomains}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsEditModalOpen(true)}
- isDisabled={!isAllowed}
- >
- Edit Domain
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.PamDomains}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsDeleteModalOpen(true)}
- variant="danger"
- isDisabled={!isAllowed}
- >
- Delete Domain
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
-
- <div className="flex gap-6">
- {/* Left Column */}
- <div className="flex w-80 shrink-0 flex-col gap-4">
- <PamDomainDetailsSection domain={domain} onEdit={() => setIsEditModalOpen(true)} />
- <PamDomainConnectionSection domain={domain} onEdit={() => setIsEditModalOpen(true)} />
- <PamDomainMetadataSection domain={domain} />
- </div>
-
- {/* Right Column - Tabbed Content */}
- <div className="min-w-0 flex-1">
- <Tabs value={selectedTab || "accounts"} onValueChange={handleTabChange}>
- <TabList>
- <Tab value="accounts">Accounts</Tab>
- <Tab value="related-resources">Resources</Tab>
- </TabList>
- <TabPanel value="accounts">
- <PamDomainAccountsSection domain={domain} />
- </TabPanel>
- <TabPanel value="related-resources">
- <PamDomainRelatedResourcesSection domain={domain} />
- </TabPanel>
- </Tabs>
- </div>
- </div>
-
- <PamUpdateDomainModal
- isOpen={isEditModalOpen}
- onOpenChange={setIsEditModalOpen}
- domain={domain}
- />
-
- <DeleteActionModal
- isOpen={isDeleteModalOpen}
- title={`Delete Domain "${domain.name}"?`}
- subTitle="This will permanently remove this domain. Associated resources will be unlinked but not deleted."
- onChange={(isOpen) => setIsDeleteModalOpen(isOpen)}
- deleteKey={domain.name}
- onDeleteApproved={handleDeleteConfirm}
- />
- </div>
- );
-};
-
-export const PamDomainByIDPage = () => {
- return (
- <>
- <Helmet>
- <title>PAM Domain | Infisical</title>
- <link rel="icon" href="/infisical.ico" />
- </Helmet>
- <PageContent />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamAddDomainAccountModal.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamAddDomainAccountModal.tsx
deleted file mode 100644
index c604b8d507..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamAddDomainAccountModal.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import { createNotification } from "@app/components/notifications";
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { useCreatePamAccount } from "@app/hooks/api/pam";
-import { PAM_DOMAIN_TYPE_MAP, PamDomainType, TPamDomain } from "@app/hooks/api/pamDomain";
-
-import { ActiveDirectoryAccountForm } from "../../PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- domain: TPamDomain;
-};
-
-export const PamAddDomainAccountModal = ({ isOpen, onOpenChange, projectId, domain }: Props) => {
- const createPamAccount = useCreatePamAccount();
- const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType];
-
- const handleSubmit = async (formData: Record<string, unknown>) => {
- try {
- await createPamAccount.mutateAsync({
- ...formData,
- parentType: domain.domainType,
- domainId: domain.id,
- projectId
- } as any);
- createNotification({
- text: "Successfully created account",
- type: "success"
- });
- onOpenChange(false);
- } catch {
- createNotification({
- text: "Failed to create account",
- type: "error"
- });
- }
- };
-
- const renderForm = () => {
- switch (domain.domainType) {
- case PamDomainType.ActiveDirectory:
- return (
- <ActiveDirectoryAccountForm
- onSubmit={handleSubmit as any}
- closeSheet={() => onOpenChange(false)}
- />
- );
- default:
- throw new Error(`Unhandled domain type: ${domain.domainType}`);
- }
- };
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Create Domain Account</SheetTitle>
- <SheetDescription>Add an account to this {domainTypeInfo?.name} domain</SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">{renderForm()}</div>
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainAccountsSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainAccountsSection.tsx
deleted file mode 100644
index 60c19e98f7..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainAccountsSection.tsx
+++ /dev/null
@@ -1,284 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useCallback, useState } from "react";
-import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate, useParams } from "@tanstack/react-router";
-import {
- CheckIcon,
- CopyIcon,
- EllipsisVerticalIcon,
- KeyRoundIcon,
- PencilIcon,
- PlusIcon,
- TrashIcon
-} from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Input as V2Input } from "@app/components/v2";
-import {
- Badge,
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
-} from "@app/components/v3";
-import { ProjectPermissionSub, useOrganization } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { useDebounce, usePopUp, useToggle } from "@app/hooks";
-import { TPamAccount, useListPamAccounts } from "@app/hooks/api/pam";
-import { TPamDomain } from "@app/hooks/api/pamDomain";
-
-import { PamDeleteAccountModal } from "../../PamAccountsPage/components/PamDeleteAccountModal";
-import { PamUpdateAccountModal } from "../../PamAccountsPage/components/PamUpdateAccountModal";
-import { PamAddDomainAccountModal } from "./PamAddDomainAccountModal";
-
-type Props = {
- domain: TPamDomain;
-};
-
-export const PamDomainAccountsSection = ({ domain }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({ strict: false }) as { projectId?: string };
- const { projectId } = params;
-
- const [search, setSearch] = useState("");
- const [debouncedSearch] = useDebounce(search);
-
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
- "addAccount",
- "updateAccount",
- "deleteAccount"
- ] as const);
-
- const [copiedAccountId, setCopiedAccountId] = useToggle(false);
-
- const handleCopyId = useCallback(
- (id: string) => {
- setCopiedAccountId.on();
- navigator.clipboard.writeText(id);
- createNotification({ text: "Account ID copied to clipboard", type: "info" });
- setTimeout(() => setCopiedAccountId.off(), 2000);
- },
- [setCopiedAccountId]
- );
-
- const { data: accountsData, isPending } = useListPamAccounts({
- projectId: projectId || "",
- search: debouncedSearch || undefined,
- filterDomainIds: domain.id
- });
-
- const accounts = accountsData?.accounts || [];
-
- const handleAccountClick = (accountId: string) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- domainType: domain.domainType,
- domainId: domain.id,
- accountId
- }
- });
- };
-
- return (
- <div className="rounded-lg border border-border bg-container">
- <div className="flex items-center justify-between border-b border-border px-4 py-3">
- <div>
- <h3 className="text-lg font-medium">Domain Accounts</h3>
- <p className="text-sm text-muted">
- Accounts associated with this domain that can be used for access
- </p>
- </div>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Create}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <Button
- variant="neutral"
- size="sm"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("addAccount")}
- >
- <PlusIcon />
- Add Account
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="p-4">
- <div className="mb-4 flex gap-2">
- <V2Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search accounts..."
- className="h-full flex-1"
- containerClassName="h-9"
- />
- </div>
-
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Account Name</TableHead>
- <TableHead>Type</TableHead>
- <TableHead>Created</TableHead>
- <TableHead className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={4} className="text-center text-muted">
- Loading accounts...
- </TableCell>
- </TableRow>
- )}
- {!isPending && accounts.length === 0 && (
- <TableRow>
- <TableCell colSpan={4}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>{search ? "No accounts match search" : "No accounts"}</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- accounts.map((account) => {
- const internalMeta = (account as Record<string, unknown>).internalMetadata as
- | Record<string, string>
- | undefined;
- return (
- <TableRow
- key={account.id}
- className="group cursor-pointer"
- onClick={() => handleAccountClick(account.id)}
- >
- <TableCell>
- <div className="flex items-center gap-3">
- <span className="font-medium">{account.name}</span>
- {!account.credentialsConfigured && (
- <Badge variant="warning" className="text-xs">
- <KeyRoundIcon className="size-3" />
- <span>No password</span>
- </Badge>
- )}
- </div>
- </TableCell>
- <TableCell className="text-muted capitalize">
- {internalMeta?.accountType || "-"}
- </TableCell>
- <TableCell className="text-muted">
- {new Date(account.createdAt).toLocaleDateString()}
- </TableCell>
- <TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={(e) => e.stopPropagation()}
- >
- <EllipsisVerticalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- handleCopyId(account.id);
- }}
- >
- {copiedAccountId ? (
- <CheckIcon className="size-4" />
- ) : (
- <CopyIcon className="size-4" />
- )}
- Copy Account ID
- </DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("updateAccount", account);
- }}
- >
- <PencilIcon className="size-4" />
- Edit Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Delete}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteAccount", account);
- }}
- >
- <TrashIcon className="size-4" />
- Delete Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- </div>
-
- <PamAddDomainAccountModal
- isOpen={popUp.addAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("addAccount", isOpen)}
- projectId={projectId!}
- domain={domain}
- />
-
- <PamUpdateAccountModal
- isOpen={popUp.updateAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("updateAccount", isOpen)}
- account={popUp.updateAccount.data as TPamAccount}
- />
-
- <PamDeleteAccountModal
- isOpen={popUp.deleteAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("deleteAccount", isOpen)}
- account={popUp.deleteAccount.data as TPamAccount}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainConnectionSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainConnectionSection.tsx
deleted file mode 100644
index 0fe38222e3..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainConnectionSection.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-import { PencilIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Detail, DetailGroup, DetailLabel, DetailValue, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { gatewaysQueryKeys } from "@app/hooks/api";
-import { useListGatewayPools } from "@app/hooks/api/gateway-pools/queries";
-import { PamDomainType, TPamDomain } from "@app/hooks/api/pamDomain";
-
-type Props = {
- domain: TPamDomain;
- onEdit: VoidFunction;
-};
-
-const ActiveDirectoryConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { domain: string; dcAddress: string; port: number };
-}) => (
- <DetailGroup>
- <Detail>
- <DetailLabel>Domain</DetailLabel>
- <DetailValue>{connectionDetails.domain}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>DC Address</DetailLabel>
- <DetailValue>{connectionDetails.dcAddress}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Port</DetailLabel>
- <DetailValue>{connectionDetails.port}</DetailValue>
- </Detail>
- </DetailGroup>
-);
-
-export const PamDomainConnectionSection = ({ domain, onEdit }: Props) => {
- const { data: gateways } = useQuery(gatewaysQueryKeys.list());
- const { data: pools } = useListGatewayPools();
- const gateway = gateways?.find((g) => g.id === domain.gatewayId);
- const pool = pools?.find((p) => p.id === domain.gatewayPoolId);
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Connection</h3>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.PamDomains}>
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="space-y-4">
- {domain.gatewayId && (
- <Detail>
- <DetailLabel>Gateway</DetailLabel>
- <DetailValue>{gateway?.name ?? "Unknown"}</DetailValue>
- </Detail>
- )}
- {domain.gatewayPoolId && (
- <Detail>
- <DetailLabel>Gateway Pool</DetailLabel>
- <DetailValue>{pool?.name ?? "Unknown"}</DetailValue>
- </Detail>
- )}
- {domain.domainType === PamDomainType.ActiveDirectory && (
- <ActiveDirectoryConnectionDetails connectionDetails={domain.connectionDetails} />
- )}
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainDetailsSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainDetailsSection.tsx
deleted file mode 100644
index c0320acfe8..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainDetailsSection.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { format } from "date-fns";
-import { PencilIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Detail, DetailGroup, DetailLabel, DetailValue, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { TPamDomain } from "@app/hooks/api/pamDomain";
-
-type Props = {
- domain: TPamDomain;
- onEdit: VoidFunction;
-};
-
-export const PamDomainDetailsSection = ({ domain, onEdit }: Props) => {
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Details</h3>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.PamDomains}>
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <DetailGroup>
- <Detail>
- <DetailLabel>Name</DetailLabel>
- <DetailValue>{domain.name}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Created</DetailLabel>
- <DetailValue>{format(new Date(domain.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
- </Detail>
- </DetailGroup>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainMetadataSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainMetadataSection.tsx
deleted file mode 100644
index 2968623cf4..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainMetadataSection.tsx
+++ /dev/null
@@ -1,146 +0,0 @@
-import { useCallback, useEffect, useState } from "react";
-import { useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { PencilIcon } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, Modal, ModalContent } from "@app/components/v2";
-import { Badge, ButtonGroup, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { TPamDomain, useUpdatePamDomain } from "@app/hooks/api/pamDomain";
-import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";
-
-type Props = {
- domain: TPamDomain;
-};
-
-const metadataFormSchema = z.object({
- metadata: z
- .object({
- key: z.string().trim().min(1, "Key is required"),
- value: z.string().trim().default("")
- })
- .array()
-});
-
-type MetadataFormData = z.infer<typeof metadataFormSchema>;
-
-export const PamDomainMetadataSection = ({ domain }: Props) => {
- const metadata = domain.metadata || [];
- const { mutateAsync: updateDomain } = useUpdatePamDomain();
- const [isModalOpen, setIsModalOpen] = useState(false);
-
- const { control, handleSubmit, reset, formState } = useForm<MetadataFormData>({
- resolver: zodResolver(metadataFormSchema),
- defaultValues: {
- metadata: metadata.length > 0 ? metadata : []
- }
- });
-
- useEffect(() => {
- if (metadata) {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- }
- }, [metadata, reset]);
-
- const handleCancel = useCallback(() => {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- setIsModalOpen(false);
- }, [metadata, reset]);
-
- const onSubmit = useCallback(
- async (formData: MetadataFormData) => {
- try {
- await updateDomain({
- domainId: domain.id,
- domainType: domain.domainType,
- metadata: formData.metadata || []
- });
- createNotification({
- text: "Domain metadata updated successfully",
- type: "success"
- });
- setIsModalOpen(false);
- } catch (error) {
- createNotification({
- text: `Failed to update metadata: ${(error as Error)?.message || "Unknown error"}`,
- type: "error"
- });
- }
- },
- [domain.id, domain.domainType, updateDomain]
- );
-
- return (
- <>
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Metadata</h3>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamDomains}
- >
- {(isAllowed) => (
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- setIsModalOpen(true);
- }}
- isDisabled={!isAllowed}
- >
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- {metadata.length > 0 ? (
- <div className="flex flex-wrap gap-2">
- {metadata.map((item) =>
- item.value ? (
- <ButtonGroup className="max-w-full min-w-0" key={`${item.key}=${item.value}`}>
- <Badge isTruncatable className="max-w-[12rem] shrink-0">
- <span>{item.key}</span>
- </Badge>
- <Badge variant="outline" isTruncatable>
- <span>{item.value}</span>
- </Badge>
- </ButtonGroup>
- ) : (
- <Badge key={item.key} isTruncatable>
- <span>{item.key}</span>
- </Badge>
- )
- )}
- </div>
- ) : (
- <p className="text-sm text-mineshaft-400">No metadata attached to this domain.</p>
- )}
- </div>
-
- <Modal isOpen={isModalOpen} onOpenChange={setIsModalOpen}>
- <ModalContent
- title="Edit Metadata"
- subTitle="Update metadata key-value pairs for this domain."
- >
- <MetadataForm control={control} title="" />
- <div className="mt-4 flex justify-end gap-2">
- <Button variant="outline_bg" onClick={handleCancel}>
- Cancel
- </Button>
- <Button
- onClick={handleSubmit(onSubmit)}
- isLoading={formState.isSubmitting}
- isDisabled={formState.isSubmitting}
- >
- Save
- </Button>
- </div>
- </ModalContent>
- </Modal>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainRelatedResourcesSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainRelatedResourcesSection.tsx
deleted file mode 100644
index 467ad4ab4a..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainRelatedResourcesSection.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { useNavigate, useParams } from "@tanstack/react-router";
-
-import {
- Empty,
- EmptyHeader,
- EmptyTitle,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
-} from "@app/components/v3";
-import { useOrganization } from "@app/context";
-import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
-import {
- PAM_DOMAIN_TYPE_MAP,
- TPamDomain,
- useListDomainRelatedResources
-} from "@app/hooks/api/pamDomain";
-
-type Props = {
- domain: TPamDomain;
-};
-
-export const PamDomainRelatedResourcesSection = ({ domain }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({ strict: false }) as { projectId?: string };
- const { projectId } = params;
-
- const { data: relatedResources, isPending } = useListDomainRelatedResources(
- domain.domainType,
- domain.id
- );
-
- const resources = relatedResources || [];
- const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType as keyof typeof PAM_DOMAIN_TYPE_MAP];
-
- return (
- <div className="rounded-lg border border-border bg-container">
- <div className="border-b border-border px-4 py-3">
- <h3 className="text-lg font-medium">Domain Resources</h3>
- <p className="text-sm text-muted">
- Resources that belong to this {domainTypeInfo?.name || domain.domainType} domain
- </p>
- </div>
- <div className="p-4">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Resource</TableHead>
- <TableHead>Type</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={2} className="text-center text-muted">
- Loading resources...
- </TableCell>
- </TableRow>
- )}
- {!isPending && resources.length === 0 && (
- <TableRow>
- <TableCell colSpan={2}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>No domain resources found</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- resources.map((resource) => {
- const typeInfo = PAM_RESOURCE_TYPE_MAP[resource.resourceType as PamResourceType];
- return (
- <TableRow
- key={resource.id}
- className="group cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resource.resourceType,
- resourceId: resource.id
- }
- })
- }
- >
- <TableCell>
- <div className="flex items-center gap-3">
- {typeInfo?.image && (
- <img
- alt={typeInfo.name}
- src={`/images/integrations/${typeInfo.image}`}
- className="size-5"
- />
- )}
- <span className="font-medium">{resource.name}</span>
- </div>
- </TableCell>
- <TableCell className="text-muted">
- {typeInfo?.name || resource.resourceType}
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamUpdateDomainModal.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamUpdateDomainModal.tsx
deleted file mode 100644
index 40881d91b3..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/PamUpdateDomainModal.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PAM_DOMAIN_TYPE_MAP, TPamDomain } from "@app/hooks/api/pamDomain";
-
-import { PamDomainForm } from "../../PamDomainsPage/components/PamDomainForm/PamDomainForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- domain?: TPamDomain;
-};
-
-export const PamUpdateDomainModal = ({ isOpen, onOpenChange, domain }: Props) => {
- if (!domain) return null;
-
- const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType];
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Edit Domain</SheetTitle>
- <SheetDescription>
- Update details for this {domainTypeInfo?.name} domain.
- </SheetDescription>
- </SheetHeader>
- <PamDomainForm
- closeSheet={() => onOpenChange(false)}
- domain={domain}
- projectId={domain.projectId}
- />
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/index.ts b/frontend/src/pages/pam/PamDomainByIDPage/components/index.ts
deleted file mode 100644
index ce8e6fbce5..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/components/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export { PamDomainAccountsSection } from "./PamDomainAccountsSection";
-export { PamDomainConnectionSection } from "./PamDomainConnectionSection";
-export { PamDomainDetailsSection } from "./PamDomainDetailsSection";
-export { PamDomainMetadataSection } from "./PamDomainMetadataSection";
-export { PamDomainRelatedResourcesSection } from "./PamDomainRelatedResourcesSection";
-export { PamUpdateDomainModal } from "./PamUpdateDomainModal";
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/route.tsx b/frontend/src/pages/pam/PamDomainByIDPage/route.tsx
deleted file mode 100644
index 9ff8f49e37..0000000000
--- a/frontend/src/pages/pam/PamDomainByIDPage/route.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { createFileRoute, linkOptions } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { PamDomainByIDPage } from "./PamDomainByIDPage";
-
-enum DomainDetailTab {
- Accounts = "accounts",
- RelatedResources = "related-resources"
-}
-
-const domainDetailSearchSchema = z.object({
- selectedTab: z.nativeEnum(DomainDetailTab).optional().default(DomainDetailTab.Accounts)
-});
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/"
-)({
- validateSearch: zodValidator(domainDetailSearchSchema),
- beforeLoad: ({ context, params }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Domains",
- link: linkOptions({
- to: "/organizations/$orgId/projects/pam/$projectId/domains",
- params: { orgId: params.orgId, projectId: params.projectId }
- })
- },
- {
- label: "Domain Details"
- }
- ]
- };
- },
- component: PamDomainByIDPage
-});
-
-export { DomainDetailTab };
diff --git a/frontend/src/pages/pam/PamDomainsPage/PamDomainsPage.tsx b/frontend/src/pages/pam/PamDomainsPage/PamDomainsPage.tsx
deleted file mode 100644
index 5800d199a4..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/PamDomainsPage.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Helmet } from "react-helmet";
-import { useTranslation } from "react-i18next";
-
-import { PageHeader } from "@app/components/v2";
-import { ProjectType } from "@app/hooks/api/projects/types";
-
-import { PamDomainsSection } from "./components/PamDomainsSection";
-
-export const PamDomainsPage = () => {
- const { t } = useTranslation();
- return (
- <>
- <Helmet>
- <title>{t("common.head-title", { title: "PAM Domains" })}</title>
- </Helmet>
- <div className="h-full bg-bunker-800">
- <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <PageHeader
- scope={ProjectType.PAM}
- title="Domains"
- description="Manage domains and directory services."
- />
- <PamDomainsSection />
- </div>
- </div>
- </div>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/DomainTypeSelect.tsx b/frontend/src/pages/pam/PamDomainsPage/components/DomainTypeSelect.tsx
deleted file mode 100644
index dcdc9c1700..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/DomainTypeSelect.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import { useMemo, useState } from "react";
-import { SearchIcon } from "lucide-react";
-
-import { Button, InputGroup, InputGroupAddon, InputGroupInput, Label } from "@app/components/v3";
-import {
- PAM_DOMAIN_TYPE_MAP,
- PamDomainType,
- useListPamDomainOptions
-} from "@app/hooks/api/pamDomain";
-
-type Props = {
- onSelect: (domainType: PamDomainType) => void;
-};
-
-export const DomainTypeSelect = ({ onSelect }: Props) => {
- const { isPending, data: domainOptions } = useListPamDomainOptions();
- const [search, setSearch] = useState("");
-
- const allOptions = useMemo(() => {
- if (!domainOptions) return [];
- return domainOptions.sort((a, b) => a.name.localeCompare(b.name));
- }, [domainOptions]);
-
- const filteredOptions = useMemo(() => {
- if (!search.trim()) return allOptions;
- const searchLower = search.toLowerCase();
- return allOptions.filter((option) => option.name.toLowerCase().includes(searchLower));
- }, [allOptions, search]);
-
- if (isPending) {
- return (
- <div className="flex h-full items-center justify-center">
- <Label>Loading options...</Label>
- </div>
- );
- }
-
- return (
- <div className="flex flex-col overflow-hidden">
- <div className="p-4 pb-2">
- <InputGroup>
- <InputGroupAddon>
- <SearchIcon className="size-4" />
- </InputGroupAddon>
- <InputGroupInput
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder="Search domain types..."
- />
- </InputGroup>
- </div>
- <div className="flex flex-1 overflow-y-auto">
- <div className="flex h-fit w-full flex-col gap-2 p-4 pt-2">
- {filteredOptions.length === 0 ? (
- <div className="flex items-center justify-center py-8 text-sm text-muted">
- No domain types found
- </div>
- ) : (
- filteredOptions.map((option) => {
- const details = PAM_DOMAIN_TYPE_MAP[option.domain as PamDomainType];
-
- return (
- <Button
- key={option.domain}
- onClick={() => onSelect(option.domain as PamDomainType)}
- size="lg"
- variant="neutral"
- className="w-full justify-start"
- >
- {details?.image && (
- <img
- src={`/images/integrations/${details.image}`}
- className="size-6"
- alt={`${details.name} logo`}
- />
- )}
- <Label className="pointer-events-none">{details?.name || option.name}</Label>
- </Button>
- );
- })
- )}
- </div>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamAddDomainModal.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamAddDomainModal.tsx
deleted file mode 100644
index 5086ecd19c..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamAddDomainModal.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { Dispatch, SetStateAction, useState } from "react";
-
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PamDomainType, TPamDomain } from "@app/hooks/api/pamDomain";
-
-import { PamDomainForm } from "./PamDomainForm/PamDomainForm";
-import { DomainTypeSelect } from "./DomainTypeSelect";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- onComplete?: (domain: TPamDomain) => void;
-};
-
-type ContentProps = {
- closeSheet: (domain?: TPamDomain) => void;
- projectId: string;
- selectedDomainType: PamDomainType | null;
- setSelectedDomainType: Dispatch<SetStateAction<PamDomainType | null>>;
-};
-
-const Content = ({
- closeSheet,
- projectId,
- selectedDomainType,
- setSelectedDomainType
-}: ContentProps) => {
- if (selectedDomainType) {
- return (
- <PamDomainForm
- closeSheet={closeSheet}
- onBack={() => setSelectedDomainType(null)}
- domainType={selectedDomainType}
- projectId={projectId}
- />
- );
- }
-
- return <DomainTypeSelect onSelect={setSelectedDomainType} />;
-};
-
-export const PamAddDomainModal = ({ isOpen, onOpenChange, projectId, onComplete }: Props) => {
- const [selectedDomainType, setSelectedDomainType] = useState<PamDomainType | null>(null);
-
- return (
- <Sheet
- open={isOpen}
- onOpenChange={(e) => {
- onOpenChange(e);
- setSelectedDomainType(null);
- }}
- >
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Create Domain</SheetTitle>
- <SheetDescription>
- {selectedDomainType ? "Input domain connection details" : "Select a domain type"}
- </SheetDescription>
- </SheetHeader>
- <Content
- projectId={projectId}
- closeSheet={(domain) => {
- if (domain && onComplete) onComplete(domain);
- onOpenChange(false);
- setSelectedDomainType(null);
- }}
- selectedDomainType={selectedDomainType}
- setSelectedDomainType={setSelectedDomainType}
- />
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/ActiveDirectoryDomainForm.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/ActiveDirectoryDomainForm.tsx
deleted file mode 100644
index fdab5b8c7c..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/ActiveDirectoryDomainForm.tsx
+++ /dev/null
@@ -1,268 +0,0 @@
-import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon } from "lucide-react";
-import { z } from "zod";
-
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- SheetFooter,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { TPamDomain } from "@app/hooks/api/pamDomain";
-
-import {
- GenericResourceFields,
- genericResourceFieldsSchema
-} from "../../../PamResourcesPage/components/PamResourceForm/GenericResourceFields";
-import { MetadataFields } from "../../../PamResourcesPage/components/PamResourceForm/MetadataFields";
-
-type Props = {
- domain?: TPamDomain;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- connectionDetails: z.object({
- domain: z.string().trim().min(1, "Domain is required"),
- dcAddress: z.string().trim().min(1, "DC address is required"),
- port: z.coerce.number().int().min(1).max(65535),
- useLdaps: z.boolean().default(true),
- ldapRejectUnauthorized: z.boolean().default(true),
- ldapCaCert: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional(),
- ldapTlsServerName: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional()
- })
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const ActiveDirectoryDomainForm = ({ domain, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(domain);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: domain
- ? {
- name: domain.name,
- gatewayId: domain.gatewayId ?? null,
- gatewayPoolId: domain.gatewayPoolId ?? null,
- connectionDetails: {
- ...domain.connectionDetails,
- useLdaps: domain.connectionDetails.useLdaps ?? false,
- ldapRejectUnauthorized: domain.connectionDetails.ldapRejectUnauthorized ?? true,
- ldapCaCert: domain.connectionDetails.ldapCaCert ?? "",
- ldapTlsServerName: domain.connectionDetails.ldapTlsServerName ?? ""
- }
- }
- : {
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- domain: "",
- dcAddress: "",
- port: 636,
- useLdaps: true,
- ldapRejectUnauthorized: true,
- ldapCaCert: "",
- ldapTlsServerName: ""
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const useLdaps = useWatch({ control, name: "connectionDetails.useLdaps" });
- const ldapRejectUnauthorized = useWatch({
- control,
- name: "connectionDetails.ldapRejectUnauthorized"
- });
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <Controller
- name="connectionDetails.domain"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Domain</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} placeholder="corp.example.com" />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <div className="flex items-start gap-2">
- <Controller
- name="connectionDetails.dcAddress"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="flex-1">
- <FieldLabel>DC Address</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- isError={Boolean(error)}
- placeholder="10.0.1.10 or dc.corp.example.com"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.port"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="w-28">
- <FieldLabel>Port</FieldLabel>
- <FieldContent>
- <Input type="number" {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- <div className="flex flex-col gap-3">
- <Label>LDAP</Label>
-
- <Controller
- name="connectionDetails.useLdaps"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable LDAPS</FieldLabel>
- <Switch
- variant="project"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.ldapCaCert"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- className="max-h-32"
- disabled={!useLdaps}
- placeholder="-----BEGIN CERTIFICATE-----..."
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.ldapRejectUnauthorized"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to the Domain Controller if it has a
- valid, trusted TLS certificate
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!useLdaps}
- checked={useLdaps ? field.value : false}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.ldapTlsServerName"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- TLS Server Name
- <Tooltip>
- <TooltipTrigger>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The expected hostname in the server&apos;s TLS certificate. Required when DC
- Address is an IP address and Reject Unauthorized is enabled.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="dc.corp.example.com"
- disabled={!useLdaps || !ldapRejectUnauthorized}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Domain"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/PamDomainForm.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/PamDomainForm.tsx
deleted file mode 100644
index 0c85bf35bc..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/PamDomainForm.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { createNotification } from "@app/components/notifications";
-import {
- PAM_DOMAIN_TYPE_MAP,
- PamDomainType,
- TPamDomain,
- useCreatePamDomain,
- useUpdatePamDomain
-} from "@app/hooks/api/pamDomain";
-
-import { PamDomainHeader } from "../PamDomainHeader";
-import { ActiveDirectoryDomainForm } from "./ActiveDirectoryDomainForm";
-
-type FormProps = {
- closeSheet: (domain?: TPamDomain) => void;
-} & ({ domain: TPamDomain } | { domainType: PamDomainType });
-
-type CreateFormProps = FormProps & {
- domainType: PamDomainType;
- projectId: string;
-};
-
-type UpdateFormProps = FormProps & {
- domain: TPamDomain;
-};
-
-const CreateForm = ({ domainType, closeSheet, projectId }: CreateFormProps) => {
- const createPamDomain = useCreatePamDomain();
- const { name: domainName } = PAM_DOMAIN_TYPE_MAP[domainType];
-
- const onSubmit = async (
- formData: Record<string, unknown> & {
- name: string;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- connectionDetails: unknown;
- metadata?: { key: string; value: string }[];
- }
- ) => {
- const domain = await createPamDomain.mutateAsync({
- ...formData,
- domainType,
- projectId,
- gatewayId: formData.gatewayId ?? undefined,
- gatewayPoolId: formData.gatewayPoolId ?? undefined,
- connectionDetails: formData.connectionDetails as TPamDomain["connectionDetails"],
- metadata: formData.metadata
- });
- createNotification({
- text: `Successfully created ${domainName} domain`,
- type: "success"
- });
- closeSheet(domain);
- };
-
- switch (domainType) {
- case PamDomainType.ActiveDirectory:
- return (
- <ActiveDirectoryDomainForm onSubmit={onSubmit as any} closeSheet={closeSheet as any} />
- );
- default:
- throw new Error(`Unhandled domain type: ${domainType}`);
- }
-};
-
-const UpdateForm = ({ domain, closeSheet }: UpdateFormProps) => {
- const updatePamDomain = useUpdatePamDomain();
- const { name: domainName } = PAM_DOMAIN_TYPE_MAP[domain.domainType];
-
- const onSubmit = async (
- formData: Record<string, unknown> & {
- name?: string;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- connectionDetails?: unknown;
- metadata?: { key: string; value: string }[];
- }
- ) => {
- const updatedDomain = await updatePamDomain.mutateAsync({
- domainId: domain.id,
- domainType: domain.domainType,
- ...formData,
- gatewayId: formData.gatewayId ?? undefined,
- gatewayPoolId: formData.gatewayPoolId ?? undefined,
- connectionDetails: formData.connectionDetails as TPamDomain["connectionDetails"],
- metadata: formData.metadata
- });
- createNotification({
- text: `Successfully updated ${domainName} domain`,
- type: "success"
- });
- closeSheet(updatedDomain);
- };
-
- switch (domain.domainType) {
- case PamDomainType.ActiveDirectory:
- return (
- <ActiveDirectoryDomainForm
- domain={domain}
- onSubmit={onSubmit as any}
- closeSheet={closeSheet as any}
- />
- );
- default:
- throw new Error(`Unhandled domain type: ${domain.domainType}`);
- }
-};
-
-type Props = { onBack?: () => void; projectId: string } & Pick<FormProps, "closeSheet"> &
- (
- | { domainType: PamDomainType; domain?: undefined }
- | { domainType?: undefined; domain: TPamDomain }
- );
-
-export const PamDomainForm = ({ onBack, projectId, ...props }: Props) => {
- const { domain, domainType } = props;
-
- return (
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
- <PamDomainHeader domainType={domainType || domain.domainType} onBack={onBack} />
- {domain ? (
- <UpdateForm {...props} domain={domain} />
- ) : (
- <CreateForm {...props} domainType={domainType} projectId={projectId} />
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainHeader.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainHeader.tsx
deleted file mode 100644
index 7d03e6b5e9..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainHeader.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { PencilIcon } from "lucide-react";
-
-import { Button, Label } from "@app/components/v3";
-import { PAM_DOMAIN_TYPE_MAP, PamDomainType } from "@app/hooks/api/pamDomain";
-
-type Props = {
- domainType: PamDomainType;
- onBack?: () => void;
-};
-
-export const PamDomainHeader = ({ domainType, onBack }: Props) => {
- const details = PAM_DOMAIN_TYPE_MAP[domainType];
-
- return (
- <div className="flex w-full items-center gap-2.5 border-b border-border p-3">
- {details?.image && (
- <img
- alt={`${details.name} logo`}
- src={`/images/integrations/${details.image}`}
- className="size-9"
- />
- )}
- <div className="flex w-full flex-col gap-1">
- <Label>{details?.name || domainType}</Label>
- <p className="text-xs text-muted">Domain</p>
- </div>
- {onBack && (
- <Button size="xs" variant="neutral" onClick={onBack}>
- <PencilIcon />
- Change
- </Button>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsSection.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsSection.tsx
deleted file mode 100644
index 5f39bd013a..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsSection.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { useProject } from "@app/context";
-
-import { PamDomainsTable } from "./PamDomainsTable";
-
-export const PamDomainsSection = () => {
- const { currentProject } = useProject();
- return <PamDomainsTable projectId={currentProject.id} />;
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
deleted file mode 100644
index db0e80d7a1..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
+++ /dev/null
@@ -1,244 +0,0 @@
-import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate } from "@tanstack/react-router";
-import { format } from "date-fns";
-import { EllipsisVerticalIcon, PlusIcon, TrashIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Input } from "@app/components/v2";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Pagination,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
-import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
-import {
- PAM_DOMAIN_TYPE_MAP,
- type TPamDomain,
- useDeletePamDomain,
- useListPamDomains
-} from "@app/hooks/api/pamDomain";
-
-import { PamAddDomainModal } from "./PamAddDomainModal";
-
-type Props = {
- projectId: string;
-};
-
-export const PamDomainsTable = ({ projectId }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
-
- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
- "addDomain",
- "deleteDomain"
- ] as const);
-
- const { search, debouncedSearch, setSearch, setPage, page, perPage, setPerPage, offset } =
- usePagination("", { initPerPage: 20 });
-
- const { data, isPending } = useListPamDomains({
- projectId,
- offset,
- limit: perPage,
- search: debouncedSearch || undefined
- });
-
- const domains = data?.domains || [];
- const totalCount = data?.totalCount || 0;
-
- useResetPageHelper({ totalCount, offset, setPage });
-
- const deleteMutation = useDeletePamDomain();
-
- const handleDelete = async () => {
- const domain = popUp.deleteDomain.data as TPamDomain;
- if (!domain) return;
- try {
- await deleteMutation.mutateAsync({
- domainId: domain.id,
- domainType: domain.domainType
- });
- createNotification({ text: "Domain deleted", type: "success" });
- handlePopUpClose("deleteDomain");
- } catch {
- createNotification({ text: "Failed to delete domain", type: "error" });
- }
- };
-
- return (
- <div>
- <div className="flex gap-2">
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search domains..."
- className="h-full flex-1"
- containerClassName="h-9"
- />
- <ProjectPermissionCan
- I={ProjectPermissionActions.Create}
- a={ProjectPermissionSub.PamDomains}
- >
- {(isAllowed) => (
- <Button
- variant="project"
- onClick={() => handlePopUpOpen("addDomain")}
- isDisabled={!isAllowed}
- >
- <PlusIcon />
- Add Domain
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
-
- <div className="mt-4">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Type</TableHead>
- <TableHead>Created</TableHead>
- <TableHead className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={4} className="text-center text-muted">
- Loading domains...
- </TableCell>
- </TableRow>
- )}
- {!isPending && domains.length === 0 && (
- <TableRow>
- <TableCell colSpan={4}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>{search ? "No domains match search" : "No domains"}</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- domains.map((domain) => {
- const typeInfo =
- PAM_DOMAIN_TYPE_MAP[domain.domainType as keyof typeof PAM_DOMAIN_TYPE_MAP];
- return (
- <TableRow
- key={domain.id}
- className="group cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
- params: {
- orgId: currentOrg.id,
- projectId,
- domainType: domain.domainType,
- domainId: domain.id
- }
- })
- }
- >
- <TableCell>
- <div className="flex items-center gap-3">
- {typeInfo?.image && (
- <img
- alt={typeInfo.name}
- src={`/images/integrations/${typeInfo.image}`}
- className="size-5"
- />
- )}
- <span className="font-medium">{domain.name}</span>
- </div>
- </TableCell>
- <TableCell className="text-muted">
- {typeInfo?.name || domain.domainType}
- </TableCell>
- <TableCell className="text-muted">
- {format(new Date(domain.createdAt), "MMM d, yyyy HH:mm")}
- </TableCell>
- <TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={(e) => e.stopPropagation()}
- >
- <EllipsisVerticalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.PamDomains}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteDomain", domain);
- }}
- >
- <TrashIcon className="size-4" />
- Delete
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- {Boolean(totalCount) && !isPending && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={setPerPage}
- />
- )}
- </div>
-
- <PamAddDomainModal
- isOpen={popUp.addDomain.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("addDomain", isOpen)}
- projectId={projectId}
- />
-
- <DeleteActionModal
- isOpen={popUp.deleteDomain.isOpen}
- title={`Delete domain "${(popUp.deleteDomain.data as TPamDomain)?.name}"?`}
- subTitle="This will permanently remove this domain. Associated resources will be unlinked but not deleted."
- onChange={(isOpen) => handlePopUpToggle("deleteDomain", isOpen)}
- deleteKey={(popUp.deleteDomain.data as TPamDomain)?.name || "confirm"}
- onDeleteApproved={handleDelete}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamDomainsPage/route.tsx b/frontend/src/pages/pam/PamDomainsPage/route.tsx
deleted file mode 100644
index 86fd067f4f..0000000000
--- a/frontend/src/pages/pam/PamDomainsPage/route.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { PamDomainsPage } from "./PamDomainsPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/"
-)({
- validateSearch: zodValidator(
- z.object({
- search: z.string().optional()
- })
- ),
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Domains"
- }
- ]
- };
- },
- component: PamDomainsPage
-});
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
deleted file mode 100644
index 247e881bde..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
+++ /dev/null
@@ -1,297 +0,0 @@
-import { useState } from "react";
-import { Helmet } from "react-helmet";
-import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
-import { BanIcon, EllipsisVerticalIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- PageLoader
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
-import {
- isPamRotationSupported,
- PAM_RESOURCE_TYPE_MAP,
- PamResourceType,
- useDeletePamResource,
- useGetPamResourceById,
- useUpdatePamResource
-} from "@app/hooks/api/pam";
-
-import { PamUpdateResourceModal } from "../PamResourcesPage/components/PamUpdateResourceModal";
-import {
- PamResourceAccountsSection,
- PamResourceConnectionSection,
- PamResourceDependenciesSection,
- PamResourceDetailsSection,
- PamResourceMetadataSection,
- PamResourceRotationPolicySection,
- PamResourceSessionRecordingSection,
- PamRotationPolicyModal,
- PamSessionRecordingModal
-} from "./components";
-
-const PageContent = () => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({
- strict: false
- }) as { resourceId?: string; resourceType?: string; projectId?: string; orgId?: string };
-
- const { resourceId, resourceType, projectId } = params;
-
- const selectedTab = useSearch({
- strict: false,
- select: (el) => el.selectedTab
- });
-
- const handleTabChange = (tab: string) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- search: (prev) => ({ ...prev, selectedTab: tab }),
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resourceType!,
- resourceId: resourceId!
- }
- });
- };
-
- const [isEditModalOpen, setIsEditModalOpen] = useState(false);
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
- const [isRotationPolicyModalOpen, setIsRotationPolicyModalOpen] = useState(false);
- const [isSessionRecordingModalOpen, setIsSessionRecordingModalOpen] = useState(false);
-
- const { data: resource, isPending } = useGetPamResourceById(
- resourceType as PamResourceType,
- resourceId,
- {
- enabled: Boolean(resourceId) && Boolean(resourceType)
- }
- );
-
- const deleteResource = useDeletePamResource();
- const updateResource = useUpdatePamResource();
-
- if (isPending) {
- return <PageLoader />;
- }
-
- if (!resource) {
- return (
- <div className="flex h-full w-full items-center justify-center px-20">
- <Empty className="max-w-2xl">
- <EmptyHeader>
- <BanIcon className="size-8 text-muted" />
- <EmptyTitle className="text-muted">
- Could not find PAM Resource with ID {resourceId}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </div>
- );
- }
-
- const resourceTypeInfo = PAM_RESOURCE_TYPE_MAP[resource.resourceType];
-
- const handleBack = () => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources",
- params: { orgId: currentOrg.id, projectId: projectId! }
- });
- };
-
- const handleDeleteConfirm = async () => {
- if (!resource) return;
-
- try {
- await deleteResource.mutateAsync({
- resourceId: resource.id,
- resourceType: resource.resourceType
- });
- createNotification({
- text: `Resource "${resource.name}" deleted successfully`,
- type: "success"
- });
- handleBack();
- } catch (error) {
- console.error("Failed to delete resource:", error);
- createNotification({
- text: "Failed to delete resource",
- type: "error"
- });
- }
- };
-
- return (
- <div className="container mx-auto flex max-w-7xl flex-col px-6 py-6 text-mineshaft-50">
- <button
- type="button"
- onClick={handleBack}
- className="mb-4 flex items-center gap-1 text-sm text-bunker-300 hover:text-primary-400"
- >
- <FontAwesomeIcon icon={faChevronLeft} className="text-xs" />
- Resources
- </button>
-
- <div className="mb-6 flex items-center justify-between">
- <div className="flex items-center gap-4">
- <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
- <img
- alt={resourceTypeInfo.name}
- src={`/images/integrations/${resourceTypeInfo.image}`}
- className="size-6"
- />
- </div>
- <div>
- <h1 className="text-2xl font-semibold text-mineshaft-100">{resource.name}</h1>
- <p className="text-sm text-bunker-300">{resourceTypeInfo.name} Resource</p>
- </div>
- </div>
- <div className="flex items-center gap-3">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm">
- <EllipsisVerticalIcon />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" sideOffset={2}>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsEditModalOpen(true)}
- isDisabled={!isAllowed}
- >
- Edit Resource
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => setIsDeleteModalOpen(true)}
- variant="danger"
- isDisabled={!isAllowed}
- >
- Delete Resource
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
-
- <div className="flex gap-6">
- {/* Left Column */}
- <div className="flex w-80 shrink-0 flex-col gap-4">
- <PamResourceDetailsSection resource={resource} onEdit={() => setIsEditModalOpen(true)} />
- <PamResourceConnectionSection
- resource={resource}
- onEdit={() => setIsEditModalOpen(true)}
- />
- {isPamRotationSupported(resource.resourceType) && (
- <PamResourceRotationPolicySection
- resource={resource}
- onEdit={() => setIsRotationPolicyModalOpen(true)}
- />
- )}
- {[PamResourceType.Postgres, PamResourceType.SSH].includes(resource.resourceType) && (
- <PamResourceSessionRecordingSection
- config={resource.sessionSummaryConfig ?? null}
- onEdit={() => setIsSessionRecordingModalOpen(true)}
- />
- )}
- <PamResourceMetadataSection resource={resource} />
- </div>
-
- {/* Right Column - Tabbed Content */}
- <div className="min-w-0 flex-1">
- <Tabs value={selectedTab} onValueChange={handleTabChange}>
- <TabList>
- <Tab value="accounts">Accounts</Tab>
- {resource.resourceType === PamResourceType.Windows && (
- <Tab value="dependencies">Dependencies</Tab>
- )}
- </TabList>
- <TabPanel value="accounts">
- <PamResourceAccountsSection resource={resource} />
- </TabPanel>
- {resource.resourceType === PamResourceType.Windows && (
- <TabPanel value="dependencies">
- <PamResourceDependenciesSection resource={resource} />
- </TabPanel>
- )}
- </Tabs>
- </div>
- </div>
-
- <PamUpdateResourceModal
- isOpen={isEditModalOpen}
- onOpenChange={setIsEditModalOpen}
- resource={resource}
- />
-
- <DeleteActionModal
- isOpen={isDeleteModalOpen}
- title={`Delete Resource ${resource.name}?`}
- onChange={(isOpen) => setIsDeleteModalOpen(isOpen)}
- deleteKey={resource.name}
- onDeleteApproved={handleDeleteConfirm}
- />
-
- {isPamRotationSupported(resource.resourceType) && (
- <PamRotationPolicyModal
- isOpen={isRotationPolicyModalOpen}
- onOpenChange={setIsRotationPolicyModalOpen}
- resource={resource}
- />
- )}
-
- {[PamResourceType.Postgres, PamResourceType.SSH].includes(resource.resourceType) && (
- <PamSessionRecordingModal
- isOpen={isSessionRecordingModalOpen}
- onOpenChange={setIsSessionRecordingModalOpen}
- config={resource.sessionSummaryConfig ?? null}
- onSave={async (config) => {
- await updateResource.mutateAsync({
- resourceId: resource.id,
- resourceType: resource.resourceType,
- sessionSummaryConfig: config
- });
- }}
- />
- )}
- </div>
- );
-};
-
-export const PamResourceByIDPage = () => {
- return (
- <>
- <Helmet>
- <title>PAM Resource | Infisical</title>
- <link rel="icon" href="/infisical.ico" />
- </Helmet>
- <PageContent />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
deleted file mode 100644
index e8fdefcbc0..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ /dev/null
@@ -1,713 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useCallback, useEffect, useMemo, useState } from "react";
-import { faFilter, faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate, useParams } from "@tanstack/react-router";
-import { formatDistance } from "date-fns";
-import {
- CheckIcon,
- CopyIcon,
- EllipsisVerticalIcon,
- InfoIcon,
- KeyRoundIcon,
- LogInIcon,
- PencilIcon,
- PlusIcon,
- RefreshCwIcon,
- TrashIcon
-} from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Button as V2Button,
- IconButton as V2IconButton,
- Input as V2Input
-} from "@app/components/v2";
-import {
- Badge,
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { ProjectPermissionSub, useOrganization } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { useDebounce, usePopUp, useToggle } from "@app/hooks";
-import { ApprovalPolicyType, useCheckPolicyMatch } from "@app/hooks/api/approvalPolicies";
-import {
- PamAccountRotationStatus,
- PamResourceType,
- TPamAccount,
- TPamResource,
- TWindowsAccount,
- useListPamAccounts
-} from "@app/hooks/api/pam";
-import { useManualRotateAccount } from "@app/hooks/api/pam/mutations";
-import { PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
-import {
- MetadataFilterEntry,
- MetadataFilterSection
-} from "@app/pages/cert-manager/components/MetadataFilterSection";
-
-import { PamAccessAccountModal } from "../../PamAccountsPage/components/PamAccessAccountModal";
-import { PamAddAccountModal } from "../../PamAccountsPage/components/PamAddAccountModal";
-import { PamAwsIamAccessReasonModal } from "../../PamAccountsPage/components/PamAwsIamAccessReasonModal";
-import { PamDeleteAccountModal } from "../../PamAccountsPage/components/PamDeleteAccountModal";
-import { PamRequestAccountAccessModal } from "../../PamAccountsPage/components/PamRequestAccountAccessModal";
-import { PamUpdateAccountModal } from "../../PamAccountsPage/components/PamUpdateAccountModal";
-
-type Props = {
- resource: TPamResource;
-};
-
-const hasAccountType = (resourceType: PamResourceType) => resourceType === PamResourceType.Windows;
-
-const hasAccountsWithDependencies = (resourceType: PamResourceType) =>
- resourceType === PamResourceType.Windows;
-
-const getAccountType = (account: TPamAccount): string | undefined => {
- // AD-domain accounts surfaced on a Windows resource page have
- // account.resource === null but still carry internalMetadata.accountType.
- if (account.resource?.resourceType === PamResourceType.Windows || account.domain) {
- return (account as TWindowsAccount).internalMetadata?.accountType;
- }
- return undefined;
-};
-
-export const PamResourceAccountsSection = ({ resource }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({ strict: false }) as { projectId?: string };
- const { projectId } = params;
-
- const { mutateAsync: checkPolicyMatch } = useCheckPolicyMatch();
- const manualRotate = useManualRotateAccount();
-
- const [search, setSearch] = useState("");
- const [debouncedSearch] = useDebounce(search);
- const [rotatingAccountIds, setRotatingAccountIds] = useState<Set<string>>(new Set());
- const [accessReason, setAccessReason] = useState<string | undefined>(undefined);
-
- const [pendingMetadataEntries, setPendingMetadataEntries] = useState<MetadataFilterEntry[]>([]);
- const [appliedMetadataEntries, setAppliedMetadataEntries] = useState<MetadataFilterEntry[]>([]);
-
- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
- "addAccount",
- "accessAccount",
- "requestAccount",
- "updateAccount",
- "deleteAccount",
- "awsIamReason"
- ] as const);
-
- const isTableFiltered = Boolean(appliedMetadataEntries.some((e) => e.key.trim()));
-
- const hasFilterChanges = useMemo(() => {
- return JSON.stringify(pendingMetadataEntries) !== JSON.stringify(appliedMetadataEntries);
- }, [pendingMetadataEntries, appliedMetadataEntries]);
-
- const handleApplyFilters = () => {
- setAppliedMetadataEntries(pendingMetadataEntries);
- };
-
- const handleClearFilters = () => {
- setPendingMetadataEntries([]);
- setAppliedMetadataEntries([]);
- };
-
- const { data: domainData, isPending: isDomainPending } = useGetPamDomainById(
- PamDomainType.ActiveDirectory,
- resource.domainId || undefined,
- { enabled: !!resource.domainId }
- );
-
- const hasRotatingAccounts = rotatingAccountIds.size > 0;
-
- const { data: accountsData, isPending } = useListPamAccounts(
- {
- projectId: projectId!,
- filterResourceIds: resource.id,
- filterDomainIds: resource.domainId || undefined,
- search: debouncedSearch || undefined,
- metadataFilter: appliedMetadataEntries.filter((e) => e.key.trim()).length
- ? appliedMetadataEntries
- .filter((e) => e.key.trim())
- .map((e) => ({
- key: e.key.trim(),
- ...(e.value.trim() ? { value: e.value.trim() } : {})
- }))
- : undefined
- },
- {
- refetchInterval: hasRotatingAccounts ? 3000 : false
- }
- );
-
- const accounts = accountsData?.accounts || [];
-
- // Clear optimistic rotating state when server confirms a non-rotating status
- useEffect(() => {
- if (!accountsData?.accounts) return;
- setRotatingAccountIds((prev) => {
- const next = new Set(prev);
- let changed = false;
- [...prev].forEach((id) => {
- const acct = accountsData.accounts.find((a) => a.id === id);
- if (acct) {
- const status = (acct as { rotationStatus?: string | null }).rotationStatus;
- if (status && status !== PamAccountRotationStatus.Rotating) {
- next.delete(id);
- changed = true;
- }
- }
- });
- return changed ? next : prev;
- });
- }, [accountsData]);
-
- const [copiedAccountId, setCopiedAccountId] = useToggle(false);
-
- const handleCopyId = useCallback(
- (id: string) => {
- setCopiedAccountId.on();
- navigator.clipboard.writeText(id);
-
- createNotification({
- text: "Account ID copied to clipboard",
- type: "info"
- });
-
- setTimeout(() => setCopiedAccountId.off(), 2000);
- },
- [setCopiedAccountId]
- );
-
- const handleAccountClick = (account: TPamAccount) => {
- if (account.domainId && account.domain) {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- domainType: account.domain.domainType,
- domainId: account.domainId,
- accountId: account.id
- }
- });
- } else {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resource.resourceType,
- resourceId: resource.id,
- accountId: account.id
- }
- });
- }
- };
-
- const handleRotateAccount = async (accountId: string) => {
- try {
- setRotatingAccountIds((prev) => new Set(prev).add(accountId));
- const updatedAccount = await manualRotate.mutateAsync({ accountId });
-
- // Clear from local rotating state since we now have the final status
- setRotatingAccountIds((prev) => {
- const next = new Set(prev);
- next.delete(accountId);
- return next;
- });
-
- if (updatedAccount.rotationStatus === PamAccountRotationStatus.Success) {
- createNotification({ text: "Credential rotation completed successfully", type: "success" });
- } else if (updatedAccount.rotationStatus === PamAccountRotationStatus.PartialSuccess) {
- createNotification({
- text: "Credential rotation completed with warnings",
- type: "warning"
- });
- } else if (updatedAccount.rotationStatus === PamAccountRotationStatus.Failed) {
- createNotification({ text: "Credential rotation failed", type: "error" });
- }
- } catch {
- setRotatingAccountIds((prev) => {
- const next = new Set(prev);
- next.delete(accountId);
- return next;
- });
- createNotification({ text: "Failed to trigger rotation", type: "error" });
- }
- };
-
- const accessAccount = async (account: TPamAccount) => {
- const accountIdentity =
- account.domainId && domainData?.connectionDetails.domain
- ? `${domainData.connectionDetails.domain}:${account.name}`
- : account.name;
-
- const { requiresApproval, constraints } = await checkPolicyMatch({
- policyType: ApprovalPolicyType.PamAccess,
- projectId: projectId!,
- inputs: {
- resourceName: resource.name,
- accountName: accountIdentity
- }
- });
-
- if (requiresApproval) {
- handlePopUpOpen("requestAccount", {
- resourceName: resource.name,
- accountName: accountIdentity,
- accountAccessed: true,
- accessDurationMax: constraints?.accessDuration.max
- });
- return;
- }
-
- if (account.resource?.resourceType === PamResourceType.AwsIam) {
- handlePopUpOpen("awsIamReason", { account });
- } else if (account.domainId) {
- handlePopUpOpen("accessAccount", {
- account,
- resource: {
- id: resource.id,
- name: resource.name,
- resourceType: resource.resourceType,
- projectId: resource.projectId
- }
- });
- } else {
- handlePopUpOpen("accessAccount", { account });
- }
- };
-
- return (
- <div className="rounded-lg border border-border bg-container">
- <div className="flex items-center justify-between border-b border-border px-4 py-3">
- <div>
- <h3 className="text-lg font-medium">Accounts</h3>
- <p className="text-sm text-muted">
- Accounts associated with this resource that can be used for access
- </p>
- </div>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Create}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed) => (
- <Button
- variant="neutral"
- size="sm"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("addAccount")}
- >
- <PlusIcon />
- Add Account
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="p-4">
- <div className="mb-4 flex gap-2">
- <V2Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search accounts..."
- className="flex-1"
- />
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <V2IconButton
- ariaLabel="Filter accounts"
- variant="plain"
- size="sm"
- className={twMerge(
- "flex h-10 w-11 items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",
- isTableFiltered && "border-primary/50 text-primary"
- )}
- >
- <FontAwesomeIcon icon={faFilter} />
- </V2IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- sideOffset={2}
- className="max-h-[70vh] thin-scrollbar w-80 overflow-y-auto p-4"
- align="end"
- >
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <h3 className="text-sm font-medium text-mineshaft-100">Filters</h3>
- <span className="text-xs text-bunker-300">
- {isTableFiltered && (
- <button
- type="button"
- onClick={handleClearFilters}
- className="cursor-pointer text-primary hover:text-primary-600"
- >
- Clear filters
- </button>
- )}
- </span>
- </div>
-
- <MetadataFilterSection
- entries={pendingMetadataEntries}
- onChange={setPendingMetadataEntries}
- />
-
- <div className="pt-2">
- <V2Button
- onClick={handleApplyFilters}
- className="w-full bg-primary font-medium text-black hover:bg-primary-600"
- size="sm"
- isDisabled={!hasFilterChanges}
- >
- Apply Filters
- </V2Button>
- </div>
- </div>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Account Name</TableHead>
- {hasAccountsWithDependencies(resource.resourceType) && (
- <TableHead>Dependencies</TableHead>
- )}
- {hasAccountType(resource.resourceType) && <TableHead>Type</TableHead>}
- <TableHead>Last Rotated</TableHead>
- <TableHead className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell
- colSpan={
- 3 +
- (hasAccountType(resource.resourceType) ? 1 : 0) +
- (hasAccountsWithDependencies(resource.resourceType) ? 1 : 0)
- }
- className="text-center text-muted"
- >
- Loading accounts...
- </TableCell>
- </TableRow>
- )}
- {!isPending && accounts.length === 0 && (
- <TableRow>
- <TableCell
- colSpan={
- 3 +
- (hasAccountType(resource.resourceType) ? 1 : 0) +
- (hasAccountsWithDependencies(resource.resourceType) ? 1 : 0)
- }
- >
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>
- {debouncedSearch || isTableFiltered
- ? "No accounts match your search"
- : "No accounts found"}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {accounts.map((account) => {
- const isAwsIamAccount = resource.resourceType === PamResourceType.AwsIam;
- const serverRotationStatus = !isAwsIamAccount
- ? (account as { rotationStatus?: string | null }).rotationStatus
- : undefined;
- const rotationStatus = rotatingAccountIds.has(account.id)
- ? PamAccountRotationStatus.Rotating
- : serverRotationStatus;
- const lastRotatedAt = !isAwsIamAccount
- ? (account as { lastRotatedAt?: string | null }).lastRotatedAt
- : undefined;
- const lastRotationMessage = !isAwsIamAccount
- ? (account as { lastRotationMessage?: string | null }).lastRotationMessage
- : undefined;
-
- return (
- <TableRow
- key={account.id}
- className="group cursor-pointer"
- onClick={() => handleAccountClick(account)}
- >
- <TableCell>
- <div className="flex items-center gap-3">
- <Tooltip disableHoverableContent>
- <TooltipTrigger>
- <div className="flex items-center gap-1">
- <span>{account.name}</span>
- {account.description && (
- <InfoIcon className="mt-px size-3 text-muted" />
- )}
- </div>
- </TooltipTrigger>
- {account.description && (
- <TooltipContent side="top">{account.description}</TooltipContent>
- )}
- </Tooltip>
-
- {account.resourceId !== resource.id && domainData && (
- <Badge variant="info" className="text-xs">
- {domainData.connectionDetails.domain}
- </Badge>
- )}
-
- {!account.credentialsConfigured && (
- <Badge variant="warning" className="text-xs">
- <KeyRoundIcon className="size-3" />
- <span>No password</span>
- </Badge>
- )}
- </div>
- </TableCell>
- {hasAccountsWithDependencies(resource.resourceType) && (
- <TableCell>
- <span className="text-muted">{account.dependencyCount ?? 0}</span>
- </TableCell>
- )}
- {hasAccountType(resource.resourceType) && (
- <TableCell>
- <span className="capitalize">{getAccountType(account) ?? "-"}</span>
- </TableCell>
- )}
- <TableCell>
- <div className="flex items-center gap-2">
- <span className="text-sm text-muted">
- {lastRotatedAt
- ? formatDistance(new Date(lastRotatedAt), new Date(), {
- addSuffix: true
- })
- : "Never"}
- </span>
- {rotationStatus === PamAccountRotationStatus.Failed && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge variant="danger" className="text-xs">
- Failed
- </Badge>
- </TooltipTrigger>
- {lastRotationMessage && (
- <TooltipContent className="max-w-sm">
- {lastRotationMessage}
- </TooltipContent>
- )}
- </Tooltip>
- )}
- {rotationStatus === PamAccountRotationStatus.PartialSuccess && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge variant="warning" className="text-xs">
- Partial
- </Badge>
- </TooltipTrigger>
- {lastRotationMessage && (
- <TooltipContent className="max-w-sm">
- {lastRotationMessage}
- </TooltipContent>
- )}
- </Tooltip>
- )}
- {rotationStatus === PamAccountRotationStatus.Rotating && (
- <Badge variant="info" className="animate-pulse text-xs">
- Rotating
- </Badge>
- )}
- {rotationStatus === PamAccountRotationStatus.Success && (
- <Badge variant="success" className="text-xs">
- Success
- </Badge>
- )}
- </div>
- </TableCell>
- <TableCell>
- <div className="flex items-center gap-2">
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
- >
- <Button
- variant="ghost"
- size="xs"
- isDisabled={
- !!account.domainId &&
- (isDomainPending || !domainData?.connectionDetails.domain)
- }
- onClick={(e) => {
- e.stopPropagation();
- accessAccount(account);
- }}
- >
- <LogInIcon />
- Connect
- </Button>
- </ProjectPermissionCan>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton variant="ghost" size="xs">
- <EllipsisVerticalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- handleCopyId(account.id);
- }}
- >
- {copiedAccountId ? (
- <CheckIcon className="size-4" />
- ) : (
- <CopyIcon className="size-4" />
- )}
- Copy Account ID
- </DropdownMenuItem>
- {!account.domainId && (
- <>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.TriggerRotation}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed || manualRotate.isPending}
- onClick={(e) => {
- e.stopPropagation();
- handleRotateAccount(account.id);
- }}
- >
- <RefreshCwIcon className="size-4" />
- Rotate Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("updateAccount", account);
- }}
- >
- <PencilIcon className="size-4" />
- Edit Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Delete}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteAccount", account);
- }}
- >
- <TrashIcon className="size-4" />
- Delete Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </>
- )}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- </div>
-
- <PamAddAccountModal
- isOpen={popUp.addAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("addAccount", isOpen)}
- projectId={projectId!}
- currentFolderId={null}
- resource={resource}
- />
-
- <PamAccessAccountModal
- isOpen={popUp.accessAccount.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("accessAccount", isOpen);
- if (!isOpen) setAccessReason(undefined);
- }}
- account={popUp.accessAccount.data?.account}
- resource={popUp.accessAccount.data?.resource}
- projectId={projectId!}
- reason={accessReason}
- />
-
- <PamAwsIamAccessReasonModal
- isOpen={popUp.awsIamReason.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("awsIamReason", isOpen)}
- account={popUp.awsIamReason.data?.account}
- onSubmit={(reason) => {
- const account = popUp.awsIamReason.data?.account;
- if (!account) return;
- handlePopUpClose("awsIamReason");
- setAccessReason(reason || undefined);
- handlePopUpOpen("accessAccount", { account });
- }}
- />
-
- <PamRequestAccountAccessModal
- isOpen={popUp.requestAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("requestAccount", isOpen)}
- resourceName={popUp.requestAccount.data?.resourceName}
- accountName={popUp.requestAccount.data?.accountName}
- accountAccessed={popUp.requestAccount.data?.accountAccessed}
- accessDurationMax={popUp.requestAccount.data?.accessDurationMax}
- />
-
- <PamUpdateAccountModal
- isOpen={popUp.updateAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("updateAccount", isOpen)}
- account={popUp.updateAccount.data}
- />
-
- <PamDeleteAccountModal
- isOpen={popUp.deleteAccount.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("deleteAccount", isOpen)}
- account={popUp.deleteAccount.data}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx
deleted file mode 100644
index a866e375d1..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx
+++ /dev/null
@@ -1,246 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useQuery } from "@tanstack/react-query";
-import { CheckIcon, LockIcon, PencilIcon, UnlockIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Detail, DetailLabel, DetailValue, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { gatewaysQueryKeys } from "@app/hooks/api";
-import { useListGatewayPools } from "@app/hooks/api/gateway-pools/queries";
-import { PamResourceType, TPamResource } from "@app/hooks/api/pam";
-
-type Props = {
- resource: TPamResource;
-};
-
-const SSLStatusBadge = ({ enabled }: { enabled: boolean }) => (
- <div className="flex items-center gap-2">
- {enabled ? (
- <LockIcon className="size-3.5 text-success" />
- ) : (
- <UnlockIcon className="size-3.5 text-warning" />
- )}
- <span>{enabled ? "Enabled" : "Disabled"}</span>
- </div>
-);
-
-const SqlConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { host: string; port?: number; database: string; sslEnabled: boolean };
-}) => (
- <>
- <Detail>
- <DetailLabel>Host</DetailLabel>
- <DetailValue>{connectionDetails.host}</DetailValue>
- </Detail>
- {connectionDetails.port != null && (
- <Detail>
- <DetailLabel>Port</DetailLabel>
- <DetailValue>{connectionDetails.port}</DetailValue>
- </Detail>
- )}
- <Detail>
- <DetailLabel>Database</DetailLabel>
- <DetailValue>{connectionDetails.database}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>SSL</DetailLabel>
- <DetailValue>
- <SSLStatusBadge enabled={connectionDetails.sslEnabled} />
- </DetailValue>
- </Detail>
- </>
-);
-
-const MongoDBConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { connectionString: string; database: string; sslEnabled: boolean };
-}) => (
- <>
- <Detail>
- <DetailLabel>Connection String</DetailLabel>
- <DetailValue>{connectionDetails.connectionString}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Database</DetailLabel>
- <DetailValue>{connectionDetails.database}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>SSL</DetailLabel>
- <DetailValue>
- <SSLStatusBadge enabled={connectionDetails.sslEnabled} />
- </DetailValue>
- </Detail>
- </>
-);
-
-const SSHConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { host: string; port: number };
-}) => (
- <>
- <Detail>
- <DetailLabel>Host</DetailLabel>
- <DetailValue>{connectionDetails.host}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Port</DetailLabel>
- <DetailValue>{connectionDetails.port}</DetailValue>
- </Detail>
- </>
-);
-
-const RedisConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { host: string; port: number; sslEnabled: boolean };
-}) => (
- <>
- <Detail>
- <DetailLabel>Host</DetailLabel>
- <DetailValue>{connectionDetails.host}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Port</DetailLabel>
- <DetailValue>{connectionDetails.port}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>SSL</DetailLabel>
- <DetailValue>
- <SSLStatusBadge enabled={connectionDetails.sslEnabled} />
- </DetailValue>
- </Detail>
- </>
-);
-
-const KubernetesConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { url: string; sslRejectUnauthorized: boolean };
-}) => (
- <>
- <Detail>
- <DetailLabel>API URL</DetailLabel>
- <DetailValue className="truncate">{connectionDetails.url}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Verify SSL</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-2">
- {connectionDetails.sslRejectUnauthorized ? (
- <CheckIcon className="size-3.5 text-success" />
- ) : (
- <UnlockIcon className="size-3.5 text-warning" />
- )}
- <span>{connectionDetails.sslRejectUnauthorized ? "Yes" : "No"}</span>
- </div>
- </DetailValue>
- </Detail>
- </>
-);
-
-const AwsIamConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { roleArn: string };
-}) => (
- <Detail>
- <DetailLabel>Role ARN</DetailLabel>
- <DetailValue className="truncate">{connectionDetails.roleArn}</DetailValue>
- </Detail>
-);
-
-const WindowsConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { protocol: string; hostname: string; port: number };
-}) => {
- return (
- <>
- <Detail>
- <DetailLabel>Protocol</DetailLabel>
- <DetailValue>{connectionDetails.protocol.toUpperCase()}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Hostname</DetailLabel>
- <DetailValue>{connectionDetails.hostname}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Port</DetailLabel>
- <DetailValue>{connectionDetails.port}</DetailValue>
- </Detail>
- </>
- );
-};
-
-const ConnectionDetailsContent = ({ resource }: Props) => {
- switch (resource.resourceType) {
- case PamResourceType.Postgres:
- case PamResourceType.MySQL:
- case PamResourceType.MsSQL:
- case PamResourceType.OracleDB:
- return <SqlConnectionDetails connectionDetails={resource.connectionDetails} />;
- case PamResourceType.MongoDB:
- return <MongoDBConnectionDetails connectionDetails={resource.connectionDetails} />;
- case PamResourceType.SSH:
- return <SSHConnectionDetails connectionDetails={resource.connectionDetails} />;
- case PamResourceType.Redis:
- return <RedisConnectionDetails connectionDetails={resource.connectionDetails} />;
- case PamResourceType.Kubernetes:
- return <KubernetesConnectionDetails connectionDetails={resource.connectionDetails} />;
- case PamResourceType.AwsIam:
- return <AwsIamConnectionDetails connectionDetails={resource.connectionDetails} />;
- case PamResourceType.Windows:
- return <WindowsConnectionDetails connectionDetails={resource.connectionDetails} />;
- default:
- return null;
- }
-};
-
-export const PamResourceConnectionSection = ({
- resource,
- onEdit
-}: Props & { onEdit: VoidFunction }) => {
- const { data: gateways } = useQuery(gatewaysQueryKeys.list());
- const { data: pools } = useListGatewayPools();
-
- const gateway = gateways?.find((g) => g.id === resource.gatewayId);
- const pool = pools?.find((p) => p.id === resource.gatewayPoolId);
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Connection</h3>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="space-y-4">
- {resource.gatewayId && (
- <Detail>
- <DetailLabel>Gateway</DetailLabel>
- <DetailValue>{gateway?.name ?? "Unknown"}</DetailValue>
- </Detail>
- )}
- {resource.gatewayPoolId && (
- <Detail>
- <DetailLabel>Gateway Pool</DetailLabel>
- <DetailValue>{pool?.name ?? "Unknown"}</DetailValue>
- </Detail>
- )}
- <ConnectionDetailsContent resource={resource} />
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDependenciesSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDependenciesSection.tsx
deleted file mode 100644
index 4a4a1bc9bd..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDependenciesSection.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import type { TPamResource } from "@app/hooks/api/pam";
-import { useGetPamResourceDependencies } from "@app/hooks/api/pam";
-
-import { PamDependenciesTable } from "../../components/PamDependenciesTable";
-
-export const PamResourceDependenciesSection = ({ resource }: { resource: TPamResource }) => {
- const { data: dependencies, isPending } = useGetPamResourceDependencies(
- resource.resourceType,
- resource.id
- );
-
- return (
- <PamDependenciesTable
- dependencies={dependencies}
- isPending={isPending}
- contextColumnLabel="Account"
- getContextValue={(dep) => dep.accountName}
- />
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx
deleted file mode 100644
index 81f2efa636..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { Link, useParams } from "@tanstack/react-router";
-import { format } from "date-fns";
-import { PencilIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Badge,
- Detail,
- DetailGroup,
- DetailLabel,
- DetailValue,
- IconButton
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
-import { TPamResource } from "@app/hooks/api/pam";
-import { PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
-
-type Props = {
- resource: TPamResource;
- onEdit: VoidFunction;
-};
-
-export const PamResourceDetailsSection = ({ resource, onEdit }: Props) => {
- const { currentOrg } = useOrganization();
- const params = useParams({ strict: false }) as { projectId?: string };
- const { projectId } = params;
-
- const { data: domain } = useGetPamDomainById(
- PamDomainType.ActiveDirectory,
- resource.domainId || undefined,
- { enabled: !!resource.domainId }
- );
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Details</h3>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <DetailGroup>
- <Detail>
- <DetailLabel>Name</DetailLabel>
- <DetailValue>{resource.name}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Created</DetailLabel>
- <DetailValue>{format(new Date(resource.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
- </Detail>
- {resource.domainId && domain && (
- <Detail>
- <DetailLabel>Joined domain</DetailLabel>
- <DetailValue>
- <Link
- to="/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId"
- params={{
- orgId: currentOrg.id,
- projectId: projectId!,
- domainType: domain.domainType,
- domainId: domain.id
- }}
- >
- <Badge variant="info" className="text-xs">
- {domain.connectionDetails.domain}
- </Badge>
- </Link>
- </DetailValue>
- </Detail>
- )}
- </DetailGroup>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceMetadataSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceMetadataSection.tsx
deleted file mode 100644
index 0d81e352a7..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceMetadataSection.tsx
+++ /dev/null
@@ -1,148 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useCallback, useEffect, useState } from "react";
-import { useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { PencilIcon } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, Modal, ModalContent } from "@app/components/v2";
-import { Badge, ButtonGroup, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { TPamResource, useUpdatePamResource } from "@app/hooks/api/pam";
-import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";
-
-type Props = {
- resource: TPamResource;
-};
-
-const metadataFormSchema = z.object({
- metadata: z
- .object({
- key: z.string().trim().min(1, "Key is required"),
- value: z.string().trim().default("")
- })
- .array()
-});
-
-type MetadataFormData = z.infer<typeof metadataFormSchema>;
-
-export const PamResourceMetadataSection = ({ resource }: Props) => {
- const metadata = resource.metadata || [];
- const { mutateAsync: updateResource } = useUpdatePamResource();
- const [isModalOpen, setIsModalOpen] = useState(false);
-
- const { control, handleSubmit, reset, formState } = useForm<MetadataFormData>({
- resolver: zodResolver(metadataFormSchema),
- defaultValues: {
- metadata: metadata.length > 0 ? metadata : []
- }
- });
-
- useEffect(() => {
- if (metadata) {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- }
- }, [metadata, reset]);
-
- const handleCancel = useCallback(() => {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- setIsModalOpen(false);
- }, [metadata, reset]);
-
- const onSubmit = useCallback(
- async (formData: MetadataFormData) => {
- try {
- await updateResource({
- resourceId: resource.id,
- resourceType: resource.resourceType,
- metadata: formData.metadata || []
- });
- createNotification({
- text: "Resource metadata updated successfully",
- type: "success"
- });
- setIsModalOpen(false);
- } catch (error) {
- createNotification({
- text: `Failed to update metadata: ${(error as Error)?.message || "Unknown error"}`,
- type: "error"
- });
- }
- },
- [resource.id, resource.resourceType, updateResource]
- );
-
- return (
- <>
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Metadata</h3>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- reset({ metadata: metadata.length > 0 ? metadata : [] });
- setIsModalOpen(true);
- }}
- isDisabled={!isAllowed}
- >
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- {metadata.length > 0 ? (
- <div className="flex flex-wrap gap-2">
- {metadata.map((item) =>
- item.value ? (
- <ButtonGroup className="max-w-full min-w-0" key={`${item.key}=${item.value}`}>
- <Badge isTruncatable className="max-w-[12rem] shrink-0">
- <span>{item.key}</span>
- </Badge>
- <Badge variant="outline" isTruncatable>
- <span>{item.value}</span>
- </Badge>
- </ButtonGroup>
- ) : (
- <Badge key={item.key} isTruncatable>
- <span>{item.key}</span>
- </Badge>
- )
- )}
- </div>
- ) : (
- <p className="text-sm text-mineshaft-400">No metadata attached to this resource.</p>
- )}
- </div>
-
- <Modal isOpen={isModalOpen} onOpenChange={setIsModalOpen}>
- <ModalContent
- title="Edit Metadata"
- subTitle="Update metadata key-value pairs for this resource."
- >
- <MetadataForm control={control} title="" />
- <div className="mt-4 flex justify-end gap-2">
- <Button variant="outline_bg" onClick={handleCancel}>
- Cancel
- </Button>
- <Button
- onClick={handleSubmit(onSubmit)}
- isLoading={formState.isSubmitting}
- isDisabled={formState.isSubmitting}
- >
- Save
- </Button>
- </div>
- </ModalContent>
- </Modal>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRotationPolicySection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRotationPolicySection.tsx
deleted file mode 100644
index 81159c5dfa..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRotationPolicySection.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { PencilIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Badge,
- Detail,
- DetailGroup,
- DetailLabel,
- DetailValue,
- IconButton
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { getObjectFromSeconds } from "@app/helpers/datetime";
-import { TPamResource } from "@app/hooks/api/pam";
-import { useGetPamRotationRules } from "@app/hooks/api/pam/queries";
-
-type Props = {
- resource: TPamResource;
- onEdit: VoidFunction;
-};
-
-const UNIT_LABELS: Record<string, string> = {
- s: "second",
- m: "minute",
- h: "hour",
- d: "day",
- w: "week",
- y: "year"
-};
-
-const formatInterval = (seconds: number) => {
- const { value, unit } = getObjectFromSeconds(seconds);
- const label = UNIT_LABELS[unit] ?? unit;
- return `${value} ${label}${value !== 1 ? "s" : ""}`;
-};
-
-export const PamResourceRotationPolicySection = ({ resource, onEdit }: Props) => {
- const { data: rules = [] } = useGetPamRotationRules(resource.id);
-
- const enabledRules = rules.filter((r) => r.enabled);
- const hasRotationCredentials =
- "rotationAccountCredentials" in resource && !!resource.rotationAccountCredentials;
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Rotation Policy</h3>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
-
- <DetailGroup>
- <Detail>
- <DetailLabel>Credentials</DetailLabel>
- <DetailValue>
- {hasRotationCredentials ? (
- <Badge variant="success">Configured</Badge>
- ) : (
- <span className="text-muted">None</span>
- )}
- </DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Rules</DetailLabel>
- <DetailValue>
- {rules.length > 0 ? (
- <span>
- {rules.length} total ({enabledRules.length} active)
- </span>
- ) : (
- <span className="text-muted">None</span>
- )}
- </DetailValue>
- </Detail>
- {enabledRules.length > 0 && (
- <Detail>
- <DetailLabel>Active Rules</DetailLabel>
- <DetailValue>
- <div className="flex flex-col gap-1">
- {enabledRules.slice(0, 3).map((rule) => (
- <div key={rule.id} className="flex items-center gap-1.5 text-xs">
- <code className="rounded bg-mineshaft-600 px-2 py-0.5">{rule.namePattern}</code>
- {rule.intervalSeconds && (
- <span className="text-muted">
- every {formatInterval(rule.intervalSeconds)}
- </span>
- )}
- </div>
- ))}
- {enabledRules.length > 3 && (
- <span className="text-xs text-muted">+{enabledRules.length - 3} more</span>
- )}
- </div>
- </DetailValue>
- </Detail>
- )}
- </DetailGroup>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRotationRulesSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRotationRulesSection.tsx
deleted file mode 100644
index 5bb26256d6..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRotationRulesSection.tsx
+++ /dev/null
@@ -1,372 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useState } from "react";
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { format } from "date-fns";
-import { ArrowDownIcon, ArrowUpIcon, PencilIcon, PlusIcon, TrashIcon } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { FormControl, Input, Select, SelectItem, Switch } from "@app/components/v2";
-import {
- Badge,
- Button,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import {
- useCreatePamRotationRule,
- useDeletePamRotationRule,
- useReorderPamRotationRules,
- useUpdatePamRotationRule
-} from "@app/hooks/api/pam/mutations";
-import { useGetPamRotationRules } from "@app/hooks/api/pam/queries";
-import { TPamResource, TPamRotationRule } from "@app/hooks/api/pam/types";
-
-const formSchema = z.object({
- name: z.string().max(255).optional(),
- namePattern: z.string().min(1).max(255),
- enabled: z.boolean(),
- intervalSeconds: z.number().min(3600).nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-type Props = {
- resource: TPamResource;
-};
-
-const INTERVAL_OPTIONS = [
- { value: "86400", label: "1 Day" },
- { value: "259200", label: "3 Days" },
- { value: "604800", label: "7 Days" },
- { value: "2592000", label: "30 Days" }
-];
-
-const formatInterval = (seconds: number) => {
- const option = INTERVAL_OPTIONS.find((o) => o.value === seconds.toString());
- if (option) return option.label;
- const days = Math.round(seconds / 86400);
- return `${days} day${days !== 1 ? "s" : ""}`;
-};
-
-export const PamResourceRotationRulesSection = ({ resource }: Props) => {
- const { data: rules = [], isLoading } = useGetPamRotationRules(resource.id);
- const createRule = useCreatePamRotationRule();
- const updateRule = useUpdatePamRotationRule();
- const deleteRule = useDeletePamRotationRule();
- const reorderRules = useReorderPamRotationRules();
-
- const [editingRule, setEditingRule] = useState<TPamRotationRule | null>(null);
- const [isFormOpen, setIsFormOpen] = useState(false);
-
- const {
- control,
- handleSubmit,
- reset,
- watch,
- formState: { isSubmitting }
- } = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: {
- name: "",
- namePattern: "*",
- enabled: true,
- intervalSeconds: 2592000
- }
- });
-
- const enabledValue = watch("enabled");
-
- const openCreateForm = () => {
- setEditingRule(null);
- reset({
- name: "",
- namePattern: "*",
- enabled: true,
- intervalSeconds: 2592000
- });
- setIsFormOpen(true);
- };
-
- const openEditForm = (rule: TPamRotationRule) => {
- setEditingRule(rule);
- reset({
- name: rule.name ?? "",
- namePattern: rule.namePattern,
- enabled: rule.enabled,
- intervalSeconds: rule.intervalSeconds ?? 2592000
- });
- setIsFormOpen(true);
- };
-
- const onSubmit = async (data: FormData) => {
- try {
- if (editingRule) {
- await updateRule.mutateAsync({
- resourceId: resource.id,
- ruleId: editingRule.id,
- ...data
- });
- createNotification({ text: "Rotation rule updated", type: "success" });
- } else {
- await createRule.mutateAsync({
- resourceId: resource.id,
- ...data
- });
- createNotification({ text: "Rotation rule created", type: "success" });
- }
- setIsFormOpen(false);
- setEditingRule(null);
- } catch {
- createNotification({
- text: `Failed to ${editingRule ? "update" : "create"} rotation rule`,
- type: "error"
- });
- }
- };
-
- const handleDelete = async (ruleId: string) => {
- try {
- await deleteRule.mutateAsync({ resourceId: resource.id, ruleId });
- createNotification({ text: "Rotation rule deleted", type: "success" });
- } catch {
- createNotification({ text: "Failed to delete rotation rule", type: "error" });
- }
- };
-
- const handleMoveUp = async (index: number) => {
- if (index === 0) return;
- const ruleIds = rules.map((r) => r.id);
- [ruleIds[index - 1], ruleIds[index]] = [ruleIds[index], ruleIds[index - 1]];
- try {
- await reorderRules.mutateAsync({ resourceId: resource.id, ruleIds });
- } catch {
- createNotification({ text: "Failed to reorder rules", type: "error" });
- }
- };
-
- const handleMoveDown = async (index: number) => {
- if (index >= rules.length - 1) return;
- const ruleIds = rules.map((r) => r.id);
- [ruleIds[index], ruleIds[index + 1]] = [ruleIds[index + 1], ruleIds[index]];
- try {
- await reorderRules.mutateAsync({ resourceId: resource.id, ruleIds });
- } catch {
- createNotification({ text: "Failed to reorder rules", type: "error" });
- }
- };
-
- if (isLoading) {
- return <div className="p-4 text-center text-sm text-muted">Loading rotation rules...</div>;
- }
-
- return (
- <div className="flex flex-col gap-4">
- <div className="flex items-center justify-between">
- <div>
- <p className="text-sm text-muted">
- Rules are evaluated in priority order (first match wins). Use glob patterns to match
- account names.
- </p>
- </div>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <Button size="xs" onClick={openCreateForm} isDisabled={!isAllowed}>
- <PlusIcon className="size-3.5" />
- Add Rule
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
-
- {isFormOpen && (
- <div className="rounded-lg border border-border bg-container p-4">
- <h4 className="mb-3 text-sm font-medium">
- {editingRule ? "Edit Rule" : "New Rotation Rule"}
- </h4>
- <form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-3">
- <div className="grid grid-cols-2 gap-3">
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Rule Name (optional)"
- isError={!!error}
- errorText={error?.message}
- >
- <Input {...field} placeholder="e.g., Service Accounts" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="namePattern"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Account Name Pattern"
- isError={!!error}
- errorText={error?.message}
- helperText="Glob pattern. Use * to match within a single level (e.g., svc-* matches svc-api but not svc/api). Use ** to match across all depths."
- >
- <Input {...field} placeholder="*" className="font-mono" />
- </FormControl>
- )}
- />
- </div>
- <div className="flex items-center gap-4">
- <Controller
- control={control}
- name="enabled"
- render={({ field: { value, onChange } }) => (
- <FormControl label="Enabled" className="mb-0">
- <Switch
- id="rule-enabled"
- isChecked={value}
- onCheckedChange={onChange}
- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
- thumbClassName="bg-mineshaft-800"
- />
- </FormControl>
- )}
- />
- {enabledValue && (
- <Controller
- control={control}
- name="intervalSeconds"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- label="Rotation Interval"
- isError={!!error}
- errorText={error?.message}
- className="mb-0"
- >
- <Select
- value={value?.toString() ?? "2592000"}
- onValueChange={(val) => onChange(parseInt(val, 10))}
- className="w-36 border border-mineshaft-500"
- position="popper"
- >
- {INTERVAL_OPTIONS.map((opt) => (
- <SelectItem key={opt.value} value={opt.value}>
- {opt.label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- )}
- </div>
- <div className="flex gap-2">
- <Button type="submit" size="xs" isPending={isSubmitting}>
- {editingRule ? "Save" : "Create"}
- </Button>
- <Button
- variant="outline"
- size="xs"
- onClick={() => {
- setIsFormOpen(false);
- setEditingRule(null);
- }}
- >
- Cancel
- </Button>
- </div>
- </form>
- </div>
- )}
-
- {rules.length === 0 && !isFormOpen ? (
- <Empty>
- <EmptyHeader>
- <EmptyTitle>No rotation rules configured</EmptyTitle>
- </EmptyHeader>
- </Empty>
- ) : (
- rules.length > 0 && (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="w-12">#</TableHead>
- <TableHead>Name</TableHead>
- <TableHead>Pattern</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Interval</TableHead>
- <TableHead>Created</TableHead>
- <TableHead className="w-28" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {rules.map((rule, index) => (
- <TableRow key={rule.id}>
- <TableCell>
- <Badge variant="outline">{rule.priority}</Badge>
- </TableCell>
- <TableCell>{rule.name || "-"}</TableCell>
- <TableCell>
- <code className="rounded bg-mineshaft-600 px-1.5 py-0.5 text-xs">
- {rule.namePattern}
- </code>
- </TableCell>
- <TableCell>
- <Badge variant={rule.enabled ? "success" : "neutral"}>
- {rule.enabled ? "Enabled" : "Disabled"}
- </Badge>
- </TableCell>
- <TableCell>
- {rule.enabled && rule.intervalSeconds
- ? formatInterval(rule.intervalSeconds)
- : "-"}
- </TableCell>
- <TableCell>{format(new Date(rule.createdAt), "MM/dd/yyyy")}</TableCell>
- <TableCell>
- <div className="flex items-center gap-1">
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => handleMoveUp(index)}
- isDisabled={index === 0}
- >
- <ArrowUpIcon className="size-3.5" />
- </IconButton>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => handleMoveDown(index)}
- isDisabled={index >= rules.length - 1}
- >
- <ArrowDownIcon className="size-3.5" />
- </IconButton>
- <IconButton variant="ghost" size="xs" onClick={() => openEditForm(rule)}>
- <PencilIcon className="size-3.5" />
- </IconButton>
- <IconButton variant="ghost" size="xs" onClick={() => handleDelete(rule.id)}>
- <TrashIcon className="size-3.5" />
- </IconButton>
- </div>
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- )
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceSessionRecordingSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceSessionRecordingSection.tsx
deleted file mode 100644
index 8bdbcf2188..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceSessionRecordingSection.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { PencilIcon, SparklesIcon } from "lucide-react";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Badge,
- Detail,
- DetailGroup,
- DetailLabel,
- DetailValue,
- IconButton
-} from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { useListAppConnections } from "@app/hooks/api/appConnections/queries";
-
-// SessionRecordingConfig mirrors the backend sessionSummaryConfig shape.
-// connectionName is optional and derived client-side from the app connections list.
-export type SessionRecordingConfig = {
- aiInsightsEnabled: boolean;
- connectionId: string;
- connectionName?: string;
- model: string;
-} | null;
-
-type Props = {
- config: SessionRecordingConfig;
- onEdit: VoidFunction;
-};
-
-export const PamResourceSessionRecordingSection = ({ config, onEdit }: Props) => {
- const { data: allConnections = [] } = useListAppConnections(undefined, {
- enabled: Boolean(config?.aiInsightsEnabled && config?.connectionId)
- });
-
- const connectionName =
- config?.connectionName ||
- allConnections.find((c) => c.id === config?.connectionId)?.name ||
- config?.connectionId ||
- "";
-
- return (
- <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
- <div className="flex items-center justify-between border-b border-border pb-2">
- <h3 className="text-lg font-medium">Session Recording</h3>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <IconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
- <PencilIcon />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
-
- <DetailGroup>
- <Detail>
- <DetailLabel>
- <span className="flex items-center gap-1.5">
- <SparklesIcon className="size-3.5 text-purple-400" />
- AI Insights
- </span>
- </DetailLabel>
- <DetailValue>
- {config?.aiInsightsEnabled ? (
- <Badge variant="success">Enabled</Badge>
- ) : (
- <span className="text-muted">Disabled</span>
- )}
- </DetailValue>
- </Detail>
- {config?.aiInsightsEnabled && (
- <>
- <Detail>
- <DetailLabel>App Connection</DetailLabel>
- <DetailValue>{connectionName}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Model</DetailLabel>
- <DetailValue>
- <code className="rounded bg-mineshaft-600 px-2 py-0.5 text-xs">{config.model}</code>
- </DetailValue>
- </Detail>
- </>
- )}
- </DetailGroup>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx
deleted file mode 100644
index 817c6c652e..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx
+++ /dev/null
@@ -1,449 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useCallback, useEffect, useState } from "react";
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon, PlusIcon, XIcon } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Alert,
- AlertDescription,
- AlertTitle,
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- Sheet,
- SheetContent,
- SheetDescription,
- SheetFooter,
- SheetHeader,
- SheetTitle
-} from "@app/components/v3";
-import {
- PamResourceType,
- TPamResource,
- TPamRotationRule,
- useUpdatePamResource
-} from "@app/hooks/api/pam";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import {
- useCreatePamRotationRule,
- useDeletePamRotationRule,
- useReorderPamRotationRules,
- useUpdatePamRotationRule
-} from "@app/hooks/api/pam/mutations";
-import { useGetPamRotationRules } from "@app/hooks/api/pam/queries";
-
-import { LocalRule, RotationRuleCard } from "./rotation-policy";
-
-const TEMP_ID_PREFIX = "_new_";
-
-const credentialsSchema = z
- .object({
- username: z.string(),
- password: z.string()
- })
- .refine(
- (data) =>
- (data.username === "" && data.password === "") ||
- (data.username !== "" && data.password !== ""),
- {
- message:
- "Both username and password must be provided, or both must be empty to remove credentials",
- path: ["username"]
- }
- );
-
-type CredentialsFormData = z.infer<typeof credentialsSchema>;
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (open: boolean) => void;
- resource: TPamResource;
-};
-
-const toLocalRules = (rules: TPamRotationRule[]): LocalRule[] =>
- rules.map((r) => ({
- id: r.id,
- name: r.name ?? null,
- namePattern: r.namePattern,
- enabled: r.enabled,
- intervalSeconds: r.intervalSeconds ?? null
- }));
-
-export const PamRotationPolicyModal = ({ isOpen, onOpenChange, resource }: Props) => {
- const { data: rules = [] } = useGetPamRotationRules(resource.id);
- const createRule = useCreatePamRotationRule();
- const updateRule = useUpdatePamRotationRule();
- const deleteRule = useDeletePamRotationRule();
- const reorderRules = useReorderPamRotationRules();
- const updateResource = useUpdatePamResource();
-
- const hasRotationCredentials =
- "rotationAccountCredentials" in resource && !!resource.rotationAccountCredentials;
-
- const [showPassword, setShowPassword] = useState(false);
- const [isSaving, setIsSaving] = useState(false);
-
- // Rules
- const [localRules, setLocalRules] = useState<LocalRule[]>([]);
- const [deletedRuleIds, setDeletedRuleIds] = useState<string[]>([]);
-
- // Credentials form
- const existingUsername =
- "rotationAccountCredentials" in resource
- ? ((resource.rotationAccountCredentials as { username?: string } | null)?.username ?? "")
- : "";
-
- const {
- control: credControl,
- handleSubmit: handleCredSubmit,
- reset: resetCred,
- formState: { isDirty: isCredDirty }
- } = useForm<CredentialsFormData>({
- resolver: zodResolver(credentialsSchema),
- defaultValues: {
- username: existingUsername,
- password: hasRotationCredentials ? UNCHANGED_PASSWORD_SENTINEL : ""
- }
- });
-
- const resetAll = useCallback(() => {
- setLocalRules(toLocalRules(rules));
- setDeletedRuleIds([]);
- const uname =
- "rotationAccountCredentials" in resource
- ? ((resource.rotationAccountCredentials as { username?: string } | null)?.username ?? "")
- : "";
- resetCred({
- username: uname,
- password: hasRotationCredentials ? UNCHANGED_PASSWORD_SENTINEL : ""
- });
- setShowPassword(false);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [rules, resource, hasRotationCredentials, resetCred]);
-
- useEffect(() => {
- if (isOpen) resetAll();
- }, [isOpen, resetAll]);
-
- // Rule handlers
- const handleAddRule = () => {
- setLocalRules((prev) => [
- ...prev,
- {
- id: `${TEMP_ID_PREFIX}${crypto.randomUUID()}`,
- name: null,
- namePattern: "*",
- enabled: true,
- intervalSeconds: 2592000
- }
- ]);
- };
-
- const handleUpdateLocalRule = (
- ruleId: string,
- updates: Partial<Pick<LocalRule, "name" | "namePattern" | "enabled" | "intervalSeconds">>
- ) => {
- setLocalRules((prev) => prev.map((r) => (r.id === ruleId ? { ...r, ...updates } : r)));
- };
-
- const handleDeleteLocalRule = (ruleId: string) => {
- setLocalRules((prev) => prev.filter((r) => r.id !== ruleId));
- if (!ruleId.startsWith(TEMP_ID_PREFIX)) {
- setDeletedRuleIds((prev) => [...prev, ruleId]);
- }
- };
-
- const handleMoveUp = (index: number) => {
- if (index === 0) return;
- setLocalRules((prev) => {
- const next = [...prev];
- [next[index - 1], next[index]] = [next[index], next[index - 1]];
- return next;
- });
- };
-
- const handleMoveDown = (index: number) => {
- setLocalRules((prev) => {
- if (index >= prev.length - 1) return prev;
- const next = [...prev];
- [next[index], next[index + 1]] = [next[index + 1], next[index]];
- return next;
- });
- };
-
- // Dirty checks
-
- const isRulesDirty = (() => {
- if (deletedRuleIds.length > 0) return true;
- if (localRules.some((r) => r.id.startsWith(TEMP_ID_PREFIX))) return true;
- const serverOrder = rules.map((r) => r.id);
- if (localRules.length !== serverOrder.length) return true;
- return localRules.some((local, i) => {
- if (local.id !== serverOrder[i]) return true;
- const server = rules.find((r) => r.id === local.id);
- if (!server) return true;
- return (
- local.name !== (server.name ?? null) ||
- local.namePattern !== server.namePattern ||
- local.enabled !== server.enabled ||
- local.intervalSeconds !== (server.intervalSeconds ?? null)
- );
- });
- })();
-
- const hasChanges = isCredDirty || isRulesDirty;
-
- const handleSave = async (credData: CredentialsFormData) => {
- setIsSaving(true);
- try {
- const clearingCredentials =
- isCredDirty && credData.username === "" && credData.password === "";
- const updatePayload: Record<string, unknown> = {
- resourceId: resource.id,
- resourceType: resource.resourceType
- };
-
- if (isCredDirty) {
- updatePayload.rotationAccountCredentials = clearingCredentials
- ? null
- : { username: credData.username, password: credData.password };
- await updateResource.mutateAsync(
- updatePayload as Parameters<typeof updateResource.mutateAsync>[0]
- );
- }
-
- // Persist rule changes
- await deletedRuleIds.reduce(
- (chain, ruleId) =>
- chain.then(() => deleteRule.mutateAsync({ resourceId: resource.id, ruleId }).then()),
- Promise.resolve()
- );
-
- const serverRuleIds = new Set(rules.map((r) => r.id));
- const newIdMap = new Map<string, string>();
-
- await localRules.reduce((chain, local) => {
- if (local.id.startsWith(TEMP_ID_PREFIX)) {
- return chain.then(async () => {
- const created = await createRule.mutateAsync({
- resourceId: resource.id,
- namePattern: local.namePattern,
- enabled: local.enabled,
- intervalSeconds: local.intervalSeconds ?? 2592000,
- name: local.name ?? undefined
- });
- newIdMap.set(local.id, created.id);
- });
- }
- if (serverRuleIds.has(local.id)) {
- const server = rules.find((r) => r.id === local.id);
- if (!server) return chain;
- const changed =
- local.name !== (server.name ?? null) ||
- local.namePattern !== server.namePattern ||
- local.enabled !== server.enabled ||
- local.intervalSeconds !== (server.intervalSeconds ?? null);
- if (changed) {
- return chain.then(() =>
- updateRule
- .mutateAsync({
- resourceId: resource.id,
- ruleId: local.id,
- name: local.name,
- namePattern: local.namePattern,
- enabled: local.enabled,
- intervalSeconds: local.intervalSeconds
- })
- .then()
- );
- }
- }
- return chain;
- }, Promise.resolve());
-
- const finalIds = localRules
- .map((r) => (r.id.startsWith(TEMP_ID_PREFIX) ? newIdMap.get(r.id) : r.id))
- .filter((id): id is string => !!id);
-
- const serverOrder = rules.filter((r) => !deletedRuleIds.includes(r.id)).map((r) => r.id);
- const orderChanged =
- finalIds.length !== serverOrder.length || finalIds.some((id, i) => id !== serverOrder[i]);
-
- if (orderChanged && finalIds.length > 0) {
- await reorderRules.mutateAsync({ resourceId: resource.id, ruleIds: finalIds });
- }
-
- createNotification({ text: "Rotation policy updated", type: "success" });
- onOpenChange(false);
- } catch {
- createNotification({ text: "Failed to update rotation policy", type: "error" });
- } finally {
- setIsSaving(false);
- }
- };
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Edit Rotation Policy</SheetTitle>
- <SheetDescription>
- Configure automatic password rotation for accounts under this resource.
- </SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4">
- {/* Local account warning for Windows Server resources */}
- {resource.resourceType === PamResourceType.Windows && (
- <Alert variant="info">
- <InfoIcon />
- <AlertTitle>Local Accounts Only</AlertTitle>
- <AlertDescription>
- Rotation on Windows Server resources applies to local machine accounts only. To
- rotate domain accounts, configure rotation on the Active Directory resource instead.
- </AlertDescription>
- </Alert>
- )}
-
- {/* Rotation Credentials */}
- <div className="flex flex-col gap-3">
- <div className="flex flex-col gap-1">
- <Label>Rotation Credentials</Label>
- <p className="text-xs text-muted">
- Privileged account used to perform password rotations
- </p>
- </div>
-
- <div className="grid grid-cols-2 gap-3">
- <Controller
- name="username"
- control={credControl}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Username</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} autoComplete="off" />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="password"
- control={credControl}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Password</FieldLabel>
- <FieldContent>
- <div className="relative">
- <Input
- {...field}
- placeholder="••••••"
- isError={Boolean(error)}
- autoComplete="new-password"
- type={showPassword ? "text" : "password"}
- onFocus={() => {
- if (field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (field.value === "") {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- <button
- type="button"
- className="absolute top-1/2 right-2 -translate-y-1/2 text-muted hover:text-foreground"
- onClick={() => field.onChange("")}
- tabIndex={-1}
- >
- <XIcon className="size-4" />
- </button>
- </div>
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- {hasRotationCredentials && (
- <p className="text-xs text-warning">
- Clear both fields to remove credentials and disable rotation
- </p>
- )}
- </div>
-
- {/* Rotation Rules */}
- <div>
- <div className="mb-3 flex items-center justify-between">
- <div className="flex flex-col gap-1">
- <Label>Auto Rotation Rules</Label>
- <p className="text-xs text-muted">
- Rules are evaluated top-to-bottom by priority and define which accounts get their
- credentials automatically rotated
- </p>
- </div>
-
- <Button variant="neutral" size="xs" onClick={handleAddRule}>
- <PlusIcon className="size-3.5" />
- Add Rule
- </Button>
- </div>
-
- {localRules.length === 0 ? (
- <div className="rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted">
- No rotation rules configured. Add a rule to get started.
- </div>
- ) : (
- <div className="flex flex-col gap-3">
- {localRules.map((rule, index) => (
- <RotationRuleCard
- key={rule.id}
- rule={rule}
- index={index}
- totalRules={localRules.length}
- onMoveUp={() => handleMoveUp(index)}
- onMoveDown={() => handleMoveDown(index)}
- onDelete={() => handleDeleteLocalRule(rule.id)}
- onUpdate={(updates) => handleUpdateLocalRule(rule.id, updates)}
- />
- ))}
- </div>
- )}
- </div>
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- variant="neutral"
- onClick={handleCredSubmit(handleSave)}
- isPending={isSaving}
- isDisabled={isSaving || !hasChanges}
- >
- Update Details
- </Button>
- <Button
- variant="outline"
- className="mr-auto"
- onClick={() => {
- resetAll();
- onOpenChange(false);
- }}
- >
- Cancel
- </Button>
- </SheetFooter>
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx
deleted file mode 100644
index 104cab5ec4..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx
+++ /dev/null
@@ -1,269 +0,0 @@
-import { useEffect } from "react";
-import { Controller, useForm, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Label,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
- Sheet,
- SheetContent,
- SheetDescription,
- SheetFooter,
- SheetHeader,
- SheetTitle,
- Switch
-} from "@app/components/v3";
-import { AppConnection } from "@app/hooks/api/appConnections/enums";
-import { useListAppConnections } from "@app/hooks/api/appConnections/queries";
-import { useGetPamAiInsightsModels } from "@app/hooks/api/pam";
-
-import { SessionRecordingConfig } from "./PamResourceSessionRecordingSection";
-
-// Extend this array as more LLM providers are added
-const LLM_APP_CONNECTIONS = [AppConnection.Anthropic] as const;
-
-const DEFAULT_MODEL = "claude-sonnet-4-6";
-
-const formSchema = z.object({
- aiInsightsEnabled: z.boolean(),
- connectionId: z.string().optional(),
- model: z.string().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (open: boolean) => void;
- config: SessionRecordingConfig;
- onSave: (config: SessionRecordingConfig) => void | Promise<void>;
-};
-
-export const PamSessionRecordingModal = ({ isOpen, onOpenChange, config, onSave }: Props) => {
- const { data: allConnections = [], isPending } = useListAppConnections(undefined, {
- enabled: isOpen
- });
- const { data: aiModels = [] } = useGetPamAiInsightsModels();
-
- const llmConnections = allConnections.filter((c) =>
- (LLM_APP_CONNECTIONS as readonly string[]).includes(c.app)
- );
-
- const {
- control,
- handleSubmit,
- reset,
- setValue,
- formState: { isSubmitting, dirtyFields }
- } = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: {
- aiInsightsEnabled: config?.aiInsightsEnabled ?? false,
- connectionId: config?.connectionId ?? "",
- model: config?.model ?? DEFAULT_MODEL
- }
- });
-
- useEffect(() => {
- if (isOpen) {
- reset({
- aiInsightsEnabled: config?.aiInsightsEnabled ?? false,
- connectionId: config?.connectionId ?? "",
- model: config?.model ?? DEFAULT_MODEL
- });
- }
- }, [isOpen, config, reset]);
-
- const aiInsightsEnabled = useWatch({ control, name: "aiInsightsEnabled" });
- const selectedConnectionId = useWatch({ control, name: "connectionId" });
- const selectedConnection = llmConnections.find((c) => c.id === selectedConnectionId);
- const selectedProvider = selectedConnection?.app;
- const availableModels = selectedProvider
- ? aiModels.filter((m) => m.connectionApp === selectedProvider)
- : [];
-
- // Only reset the model when the user explicitly changes the connection (field is dirty),
- // not when connections load async and selectedProvider goes undefined → defined on open.
- useEffect(() => {
- if (selectedProvider && dirtyFields.connectionId) {
- const firstModel = aiModels.find((m) => m.connectionApp === selectedProvider);
- setValue("model", firstModel?.id ?? DEFAULT_MODEL, { shouldDirty: true });
- }
- }, [selectedProvider, dirtyFields.connectionId, setValue, aiModels]);
-
- const onSubmit = async (data: FormData) => {
- try {
- if (!data.aiInsightsEnabled) {
- await onSave(null);
- } else {
- await onSave({
- aiInsightsEnabled: true,
- connectionId: data.connectionId ?? "",
- connectionName: selectedConnection?.name ?? data.connectionId ?? "",
- model: data.model ?? DEFAULT_MODEL
- });
- }
- onOpenChange(false);
- } catch {
- createNotification({ type: "error", text: "Failed to update session recording settings" });
- }
- };
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Edit Session Recording</SheetTitle>
- <SheetDescription>
- Configure session recording settings for this resource.
- </SheetDescription>
- </SheetHeader>
-
- <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4">
- {/* AI Insights section */}
- <div className="flex flex-col gap-3">
- <div className="flex items-center justify-between">
- <div className="flex flex-col gap-1">
- <Label>AI Insights</Label>
- <p className="text-xs text-muted">
- Summarize session activity using an AI connection
- </p>
- </div>
- <Controller
- name="aiInsightsEnabled"
- control={control}
- render={({ field }) => (
- <Switch
- variant="success"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- )}
- />
- </div>
-
- {aiInsightsEnabled && (
- <div className="flex flex-col gap-3 rounded-md border border-border p-3">
- <Controller
- name="connectionId"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>App Connection</FieldLabel>
- <FieldContent>
- <Select
- value={field.value}
- onValueChange={field.onChange}
- disabled={isPending || llmConnections.length === 0}
- >
- <SelectTrigger>
- <SelectValue
- placeholder={
- // eslint-disable-next-line no-nested-ternary
- isPending
- ? "Loading connections..."
- : llmConnections.length === 0
- ? "No AI connections configured"
- : "Select a connection"
- }
- />
- </SelectTrigger>
- <SelectContent>
- {llmConnections.map((conn) => (
- <SelectItem key={conn.id} value={conn.id}>
- {conn.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </FieldContent>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
-
- <Controller
- name="model"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Model</FieldLabel>
- <FieldContent>
- <Select
- value={field.value}
- onValueChange={field.onChange}
- disabled={!selectedProvider}
- >
- <SelectTrigger>
- <SelectValue
- placeholder={
- !selectedProvider ? "Select a connection first" : "Select a model"
- }
- />
- </SelectTrigger>
- <SelectContent>
- {availableModels.map((m) => (
- <SelectItem key={m.id} value={m.id}>
- {m.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </FieldContent>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- </div>
- )}
- </div>
- </div>
-
- <SheetFooter className="shrink-0 border-t">
- <Button
- variant="neutral"
- onClick={handleSubmit(onSubmit)}
- isDisabled={
- isSubmitting ||
- (aiInsightsEnabled && (llmConnections.length === 0 || !selectedProvider))
- }
- >
- Update Details
- </Button>
- <Button variant="outline" className="mr-auto" onClick={() => onOpenChange(false)}>
- Cancel
- </Button>
- {config && (
- <Button
- variant="danger"
- onClick={async () => {
- try {
- await onSave(null);
- onOpenChange(false);
- } catch {
- createNotification({
- type: "error",
- text: "Failed to disable session recording"
- });
- }
- }}
- >
- Disable
- </Button>
- )}
- </SheetFooter>
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts b/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts
deleted file mode 100644
index bd222b160e..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export { PamResourceAccountsSection } from "./PamResourceAccountsSection";
-export { PamResourceConnectionSection } from "./PamResourceConnectionSection";
-export { PamResourceDependenciesSection } from "./PamResourceDependenciesSection";
-export { PamResourceDetailsSection } from "./PamResourceDetailsSection";
-export { PamResourceMetadataSection } from "./PamResourceMetadataSection";
-export { PamResourceRotationPolicySection } from "./PamResourceRotationPolicySection";
-export type { SessionRecordingConfig } from "./PamResourceSessionRecordingSection";
-export { PamResourceSessionRecordingSection } from "./PamResourceSessionRecordingSection";
-export { PamRotationPolicyModal } from "./PamRotationPolicyModal";
-export { PamSessionRecordingModal } from "./PamSessionRecordingModal";
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx
deleted file mode 100644
index 25271f7f2b..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx
+++ /dev/null
@@ -1,160 +0,0 @@
-import { useEffect, useState } from "react";
-import { ArrowDownIcon, ArrowUpIcon, TrashIcon } from "lucide-react";
-
-import {
- Field,
- FieldContent,
- FieldLabel,
- IconButton,
- Input,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue
-} from "@app/components/v3";
-
-const formatIntervalDays = (seconds: number) => {
- const days = Math.round(seconds / 86400);
- return days.toString();
-};
-
-export type LocalRule = {
- id: string;
- name: string | null;
- namePattern: string;
- enabled: boolean;
- intervalSeconds: number | null;
-};
-
-type Props = {
- rule: LocalRule;
- index: number;
- totalRules: number;
- onMoveUp: () => void;
- onMoveDown: () => void;
- onDelete: () => void;
- onUpdate: (
- updates: Partial<Pick<LocalRule, "name" | "namePattern" | "enabled" | "intervalSeconds">>
- ) => void;
-};
-
-export const RotationRuleCard = ({
- rule,
- index,
- totalRules,
- onMoveUp,
- onMoveDown,
- onDelete,
- onUpdate
-}: Props) => {
- const [localName, setLocalName] = useState(rule.name ?? "");
- const [localPattern, setLocalPattern] = useState(rule.namePattern);
- const [localInterval, setLocalInterval] = useState(
- rule.intervalSeconds ? formatIntervalDays(rule.intervalSeconds) : "30"
- );
-
- useEffect(() => {
- setLocalName(rule.name ?? "");
- setLocalPattern(rule.namePattern);
- setLocalInterval(rule.intervalSeconds ? formatIntervalDays(rule.intervalSeconds) : "30");
- }, [rule]);
-
- const handleNameBlur = () => {
- if (localName !== (rule.name ?? "")) {
- onUpdate({ name: localName || null });
- }
- };
-
- const handlePatternBlur = () => {
- if (localPattern !== rule.namePattern && localPattern.trim()) {
- onUpdate({ namePattern: localPattern });
- }
- };
-
- const handleIntervalBlur = () => {
- const days = parseInt(localInterval, 10);
- if (!Number.isNaN(days) && days > 0) {
- const seconds = days * 86400;
- if (seconds !== rule.intervalSeconds) {
- onUpdate({ intervalSeconds: seconds });
- }
- }
- };
-
- return (
- <div className="flex gap-2 rounded-lg border border-border bg-card p-4">
- <div className="flex w-full flex-col gap-2">
- <div className="flex items-center gap-2">
- <span className="mr-1 text-lg font-medium text-muted">{index + 1}</span>
- <Select
- value={rule.enabled ? "include" : "exclude"}
- onValueChange={(value) => onUpdate({ enabled: value === "include" })}
- >
- <SelectTrigger className="w-36">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="include">Rotate</SelectItem>
- <SelectItem value="exclude">Do Not Rotate</SelectItem>
- </SelectContent>
- </Select>
- </div>
- <Field>
- <FieldLabel>Rule Name</FieldLabel>
- <FieldContent>
- <Input
- value={localName}
- onChange={(e) => setLocalName(e.target.value)}
- onBlur={handleNameBlur}
- placeholder="e.g., Service accounts"
- />
- </FieldContent>
- </Field>
- <div className="flex gap-4">
- <Field className="flex-1">
- <FieldLabel>Account Name Pattern</FieldLabel>
- <FieldContent>
- <Input
- value={localPattern}
- onChange={(e) => setLocalPattern(e.target.value)}
- onBlur={handlePatternBlur}
- placeholder="*"
- className="font-mono"
- />
- </FieldContent>
- </Field>
- {rule.enabled && (
- <Field className="w-40">
- <FieldLabel>Interval (days)</FieldLabel>
- <FieldContent>
- <Input
- value={localInterval}
- onChange={(e) => setLocalInterval(e.target.value)}
- onBlur={handleIntervalBlur}
- />
- </FieldContent>
- </Field>
- )}
- </div>
- </div>
-
- <div className="flex flex-col items-center justify-center gap-1">
- <IconButton variant="ghost" size="xs" onClick={onDelete}>
- <TrashIcon className="text-danger" />
- </IconButton>
- <IconButton variant="ghost" size="xs" onClick={onMoveUp} isDisabled={index === 0}>
- <ArrowUpIcon />
- </IconButton>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={onMoveDown}
- isDisabled={index >= totalRules - 1}
- >
- <ArrowDownIcon />
- </IconButton>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/WinrmConfigSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/WinrmConfigSection.tsx
deleted file mode 100644
index 37630158d9..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/WinrmConfigSection.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { InfoIcon } from "lucide-react";
-
-import {
- Field,
- FieldContent,
- FieldLabel,
- Input,
- Label,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-
-type Props = {
- winrmPort: number;
- useWinrmHttps: boolean;
- winrmRejectUnauthorized: boolean;
- winrmCaCert: string;
- winrmTlsServerName: string;
- onWinrmPortChange: (port: number) => void;
- onUseWinrmHttpsChange: (value: boolean) => void;
- onWinrmRejectUnauthorizedChange: (value: boolean) => void;
- onWinrmCaCertChange: (value: string) => void;
- onWinrmTlsServerNameChange: (value: string) => void;
-};
-
-export const WinrmConfigSection = ({
- winrmPort,
- useWinrmHttps,
- winrmRejectUnauthorized,
- winrmCaCert,
- winrmTlsServerName,
- onWinrmPortChange,
- onUseWinrmHttpsChange,
- onWinrmRejectUnauthorizedChange,
- onWinrmCaCertChange,
- onWinrmTlsServerNameChange
-}: Props) => {
- return (
- <div className="flex flex-col gap-3">
- <div className="flex flex-col gap-1">
- <Label>WinRM Configuration</Label>
- <p className="text-xs text-muted">
- WinRM is used to execute password rotation commands on the Windows machine
- </p>
- </div>
-
- <Field>
- <FieldLabel>
- Port
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The WinRM port on this machine. Default is 5985 for HTTP or 5986 for HTTPS
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- type="number"
- value={winrmPort}
- onChange={(e) => onWinrmPortChange(Number(e.target.value))}
- placeholder="5985"
- />
- </FieldContent>
- </Field>
-
- <Field orientation="horizontal">
- <FieldLabel>Enable HTTPS</FieldLabel>
- <Switch variant="project" checked={useWinrmHttps} onCheckedChange={onUseWinrmHttpsChange} />
- </Field>
-
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- value={winrmCaCert}
- onChange={(e) => onWinrmCaCertChange(e.target.value)}
- className="max-h-32"
- disabled={!useWinrmHttps}
- placeholder="-----BEGIN CERTIFICATE-----..."
- />
- </FieldContent>
- </Field>
-
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect if the machine has a valid, trusted TLS
- certificate
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!useWinrmHttps}
- checked={useWinrmHttps ? winrmRejectUnauthorized : false}
- onCheckedChange={onWinrmRejectUnauthorizedChange}
- />
- </Field>
-
- <Field>
- <FieldLabel>
- TLS Server Name
- <Tooltip>
- <TooltipTrigger>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The expected hostname in the server&apos;s TLS certificate. Required when connecting
- via IP address and Reject Unauthorized is enabled.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- value={winrmTlsServerName}
- onChange={(e) => onWinrmTlsServerNameChange(e.target.value)}
- placeholder="server.corp.example.com"
- disabled={!useWinrmHttps || !winrmRejectUnauthorized}
- />
- </FieldContent>
- </Field>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/index.ts b/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/index.ts
deleted file mode 100644
index b515a27a92..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export type { LocalRule } from "./RotationRuleCard";
-export { RotationRuleCard } from "./RotationRuleCard";
-export { WinrmConfigSection } from "./WinrmConfigSection";
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/route.tsx b/frontend/src/pages/pam/PamResourceByIDPage/route.tsx
deleted file mode 100644
index 2b964d9b71..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/route.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { createFileRoute, linkOptions, stripSearchParams } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { PamResourceByIDPage } from "./PamResourceByIDPage";
-
-export enum ResourceDetailTab {
- Accounts = "accounts",
- Dependencies = "dependencies"
-}
-
-const ResourceDetailSearchSchema = z.object({
- selectedTab: z.nativeEnum(ResourceDetailTab).catch(ResourceDetailTab.Accounts)
-});
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/"
-)({
- validateSearch: zodValidator(ResourceDetailSearchSchema),
- component: PamResourceByIDPage,
- search: {
- middlewares: [stripSearchParams({ selectedTab: ResourceDetailTab.Accounts })]
- },
- beforeLoad: ({ context, params }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Resources",
- link: linkOptions({
- to: "/organizations/$orgId/projects/pam/$projectId/resources",
- params: { orgId: params.orgId, projectId: params.projectId }
- })
- },
- {
- label: "Resource Details"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/PamResourcesPage/PamResourcesPage.tsx b/frontend/src/pages/pam/PamResourcesPage/PamResourcesPage.tsx
deleted file mode 100644
index b6fad67205..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/PamResourcesPage.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Helmet } from "react-helmet";
-import { useTranslation } from "react-i18next";
-
-import { PageHeader } from "@app/components/v2";
-import { ProjectType } from "@app/hooks/api/projects/types";
-
-import { PamResourcesSection } from "./components/PamResourcesSection";
-
-export const PamResourcesPage = () => {
- const { t } = useTranslation();
- return (
- <>
- <Helmet>
- <title>{t("common.head-title", { title: "PAM" })}</title>
- </Helmet>
- <div className="h-full bg-bunker-800">
- <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <PageHeader
- scope={ProjectType.PAM}
- title="Resources"
- description="Manage resources such as servers, databases, and more."
- />
- <PamResourcesSection />
- </div>
- </div>
- </div>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamAddResourceModal.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamAddResourceModal.tsx
deleted file mode 100644
index 0ed6267a34..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamAddResourceModal.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { Dispatch, SetStateAction, useState } from "react";
-
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PamResourceType, TPamResource } from "@app/hooks/api/pam";
-
-import { SshCaSetupModal } from "../../components/SshCaSetupModal";
-import { PamResourceForm } from "./PamResourceForm";
-import { ResourceTypeSelect } from "./ResourceTypeSelect";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- onComplete?: (resource: TPamResource) => void;
-};
-
-type ContentProps = {
- closeSheet: (resource?: TPamResource) => void;
- projectId: string;
- selectedResourceType: PamResourceType | null;
- setSelectedResourceType: Dispatch<SetStateAction<PamResourceType | null>>;
-};
-
-const Content = ({
- closeSheet,
- projectId,
- selectedResourceType,
- setSelectedResourceType
-}: ContentProps) => {
- if (selectedResourceType) {
- return (
- <PamResourceForm
- closeSheet={closeSheet}
- onBack={() => setSelectedResourceType(null)}
- resourceType={selectedResourceType}
- projectId={projectId}
- />
- );
- }
-
- return <ResourceTypeSelect onSelect={setSelectedResourceType} />;
-};
-
-export const PamAddResourceModal = ({ isOpen, onOpenChange, projectId, onComplete }: Props) => {
- const [selectedResourceType, setSelectedResourceType] = useState<PamResourceType | null>(null);
- const [caSetupModalResourceId, setCaSetupModalResourceId] = useState<string | null>(null);
-
- const handleCaSetupModalClose = () => {
- setCaSetupModalResourceId(null);
- };
-
- return (
- <>
- <Sheet
- open={isOpen}
- onOpenChange={(e) => {
- onOpenChange(e);
- setSelectedResourceType(null);
- }}
- >
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Create Resource</SheetTitle>
- <SheetDescription>
- {selectedResourceType
- ? "Input resource connection details"
- : "Select a resource type"}
- </SheetDescription>
- </SheetHeader>
- <Content
- projectId={projectId}
- closeSheet={(resource) => {
- if (resource && onComplete) onComplete(resource);
- onOpenChange(false);
- setSelectedResourceType(null);
-
- if (resource?.resourceType === PamResourceType.SSH) {
- setCaSetupModalResourceId(resource.id);
- }
- }}
- selectedResourceType={selectedResourceType}
- setSelectedResourceType={setSelectedResourceType}
- />
- </SheetContent>
- </Sheet>
- {caSetupModalResourceId && (
- <SshCaSetupModal
- isOpen={Boolean(caSetupModalResourceId)}
- onOpenChange={handleCaSetupModalClose}
- resourceId={caSetupModalResourceId}
- />
- )}
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamDeleteResourceModal.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamDeleteResourceModal.tsx
deleted file mode 100644
index 390497a6cc..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamDeleteResourceModal.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
-import { PAM_RESOURCE_TYPE_MAP, TPamResource, useDeletePamResource } from "@app/hooks/api/pam";
-
-type Props = {
- resource?: TPamResource;
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
-};
-
-export const PamDeleteResourceModal = ({ isOpen, onOpenChange, resource }: Props) => {
- const deletePamResource = useDeletePamResource();
-
- if (!resource) return null;
-
- const { id: resourceId, name, resourceType } = resource;
-
- const handleDelete = async () => {
- await deletePamResource.mutateAsync({
- resourceId,
- resourceType
- });
-
- createNotification({
- text: `Successfully removed ${PAM_RESOURCE_TYPE_MAP[resourceType].name} resource`,
- type: "success"
- });
-
- onOpenChange(false);
- };
-
- return (
- <DeleteActionModal
- isOpen={isOpen}
- onChange={onOpenChange}
- title={`Are you sure you want to delete ${name}?`}
- deleteKey={name}
- onDeleteApproved={handleDelete}
- />
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx
deleted file mode 100644
index 34dead58c5..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { faCheck, faCopy, faEdit, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate } from "@tanstack/react-router";
-import { EllipsisIcon, StarIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger
-} from "@app/components/v2";
-import { HighlightText } from "@app/components/v2/HighlightText";
-import { Badge, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
-import { useToggle } from "@app/hooks";
-import { PAM_RESOURCE_TYPE_MAP, TPamResource } from "@app/hooks/api/pam";
-import { PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
-
-type Props = {
- resource: TPamResource;
- onUpdate: (resource: TPamResource) => void;
- onDelete: (resource: TPamResource) => void;
- onToggleFavorite: (resource: TPamResource) => void;
- search: string;
-};
-
-export const PamResourceCard = ({
- resource,
- onUpdate,
- onDelete,
- onToggleFavorite,
- search
-}: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
-
- const { id, name, resourceType, projectId } = resource;
- const { image, name: resourceTypeName } = PAM_RESOURCE_TYPE_MAP[resourceType];
-
- const { data: domain } = useGetPamDomainById(
- PamDomainType.ActiveDirectory,
- resource.domainId || undefined,
- { enabled: !!resource.domainId }
- );
-
- const [isIdCopied, setIsIdCopied] = useToggle(false);
-
- const handleCopyId = () => {
- setIsIdCopied.on();
- navigator.clipboard.writeText(id);
-
- createNotification({
- text: "Resource ID copied to clipboard",
- type: "info"
- });
-
- setTimeout(() => setIsIdCopied.off(), 2000);
- };
-
- const handleNavigate = () => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: currentOrg.id,
- projectId,
- resourceType,
- resourceId: id
- }
- });
- };
-
- return (
- <div
- role="button"
- tabIndex={0}
- className="flex cursor-pointer flex-col overflow-clip rounded-sm border border-mineshaft-600 bg-mineshaft-800 p-4 text-start transition-transform duration-100 hover:border-primary/60"
- onClick={handleNavigate}
- onKeyDown={(e) => {
- if (e.key === "Enter") handleNavigate();
- }}
- >
- <div className="flex items-center gap-3.5">
- <img
- alt={resourceTypeName}
- src={`/images/integrations/${image}`}
- className="size-10 object-contain"
- />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-2">
- <p className="truncate text-lg font-medium text-mineshaft-100">
- <HighlightText text={name} highlight={search} />
- </p>
- <div className="flex items-center gap-0.5">
- <IconButton
- size="xs"
- variant="ghost"
- onClick={(e) => {
- e.stopPropagation();
- onToggleFavorite(resource);
- }}
- >
- <StarIcon
- className={resource.isFavorite ? "text-yellow-600" : "text-mineshaft-400"}
- fill={resource.isFavorite ? "currentColor" : "none"}
- size={14}
- />
- </IconButton>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton size="xs" variant="ghost" onClick={(e) => e.stopPropagation()}>
- <EllipsisIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- icon={<FontAwesomeIcon icon={isIdCopied ? faCheck : faCopy} />}
- onClick={(e) => {
- e.stopPropagation();
- handleCopyId();
- }}
- >
- Copy Resource ID
- </DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faEdit} />}
- onClick={(e) => {
- e.stopPropagation();
- onUpdate(resource);
- }}
- >
- Edit Resource
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} />}
- onClick={(e) => {
- e.stopPropagation();
- onDelete(resource);
- }}
- >
- Delete Resource
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- <div className="mt-1 flex items-center gap-1.5">
- <Badge variant="neutral">{resourceTypeName}</Badge>
- {domain && <Badge variant="info">{domain.connectionDetails.domain}</Badge>}
- </div>
- </div>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/AwsIamResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/AwsIamResourceForm.tsx
deleted file mode 100644
index fc526f900f..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/AwsIamResourceForm.tsx
+++ /dev/null
@@ -1,243 +0,0 @@
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@app/components/v2";
-import { CopyButton } from "@app/components/v2/CopyButton";
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- SheetFooter
-} from "@app/components/v3";
-import { useProject } from "@app/context";
-import { PamResourceType, TAwsIamResource } from "@app/hooks/api/pam";
-import { slugSchema } from "@app/lib/schemas";
-
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TAwsIamResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const arnRoleRegex = /^arn:aws:iam::\d{12}:role\/[\w+=,.@/-]+$/;
-
-const AwsIamConnectionDetailsSchema = z.object({
- roleArn: z
- .string()
- .trim()
- .min(1, "Resource Role ARN is required")
- .refine((val) => arnRoleRegex.test(val), {
- message: "ARN must be in the format 'arn:aws:iam::123456789012:role/RoleName'"
- })
-});
-
-const formSchema = z.object({
- name: slugSchema({ min: 1, max: 64, field: "Name" }),
- resourceType: z.literal(PamResourceType.AwsIam),
- connectionDetails: AwsIamConnectionDetailsSchema,
- metadata: z
- .object({
- key: z.string().trim().min(1),
- value: z.string().trim().default("")
- })
- .array()
- .optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-// Infisical AWS account IDs for trust policy
-const INFISICAL_AWS_ACCOUNT_US = "381492033652";
-const INFISICAL_AWS_ACCOUNT_EU = "345594589636";
-
-export const AwsIamResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
- const { projectId } = useProject();
-
- const permissionsPolicy = `{
- "Version": "2012-10-17",
- "Statement": [{
- "Effect": "Allow",
- "Action": "sts:AssumeRole",
- "Resource": "arn:aws:iam::<YOUR_ACCOUNT_ID>:role/*"
- }]
-}`;
-
- const trustPolicy = `{
- "Version": "2012-10-17",
- "Statement": [{
- "Effect": "Allow",
- "Principal": {
- "AWS": "arn:aws:iam::<INFISICAL_AWS_ACCOUNT_ID>:root"
- },
- "Action": "sts:AssumeRole",
- "Condition": {
- "StringEquals": {
- "sts:ExternalId": "${projectId}"
- }
- }
- }]
-}`;
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource ?? {
- resourceType: PamResourceType.AwsIam,
- connectionDetails: {
- roleArn: ""
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form onSubmit={handleSubmit(onSubmit)} className="flex flex-1 flex-col overflow-hidden">
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <Controller
- name="name"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Name</FieldLabel>
- <FieldContent>
- <Input
- autoFocus
- placeholder="my-aws-console"
- {...field}
- isError={Boolean(error)}
- />
- <FieldError errors={[error]} />
- <p className="mt-1 text-xs text-mineshaft-400">Name must be slug-friendly</p>
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.roleArn"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Resource Role ARN</FieldLabel>
- <FieldContent>
- <Input
- placeholder="arn:aws:iam::123456789012:role/InfisicalResourceRole"
- {...field}
- isError={Boolean(error)}
- />
- <FieldError errors={[error]} />
- <p className="mt-1 text-xs text-mineshaft-400">
- The ARN of the Infisical Resource Role that can assume target roles
- </p>
- </FieldContent>
- </Field>
- )}
- />
-
- <Accordion
- type="single"
- collapsible
- className="mt-4 w-full rounded-r border-l-2 border-l-primary bg-mineshaft-300/5"
- >
- <AccordionItem value="aws-iam-role-setup" className="border-b-0">
- <AccordionTrigger className="px-4 py-2.5 hover:no-underline [&[data-state=open]]:pb-1">
- <div className="flex items-center text-sm transition-colors duration-150 hover:text-primary">
- <FontAwesomeIcon icon={faInfoCircle} size="sm" className="mr-1.5 text-primary" />
- AWS IAM Role Setup
- </div>
- </AccordionTrigger>
- <AccordionContent className="px-4 pb-2.5">
- <p className="mb-3 text-sm text-mineshaft-300">
- Before creating this resource, you need to set up an IAM role in your AWS account
- that Infisical can assume. Follow these steps:
- </p>
-
- <p className="mb-2 text-sm font-medium text-mineshaft-200">
- Step 1: Create a permissions policy for assuming target roles
- </p>
- <p className="mb-3 text-sm text-mineshaft-300">
- This policy allows the Resource Role to assume target roles. For simplicity, use a
- wildcard to allow assuming any role in your account. For more granular control,
- replace <code className="rounded bg-mineshaft-700 px-1 text-xs">*</code> with a
- specific pattern like{" "}
- <code className="rounded bg-mineshaft-700 px-1 text-xs">/pam-*</code> or{" "}
- <code className="rounded bg-mineshaft-700 px-1 text-xs">/infisical-*</code>.
- </p>
- <div className="relative mb-4">
- <div className="absolute top-1 right-1">
- <CopyButton value={permissionsPolicy} size="sm" variant="plain" />
- </div>
- <pre className="max-h-45 overflow-y-auto rounded-sm border border-mineshaft-600 bg-mineshaft-800 p-2 pr-8 text-xs whitespace-pre-wrap text-mineshaft-300">
- {permissionsPolicy}
- </pre>
- </div>
-
- <p className="mb-2 text-sm font-medium text-mineshaft-200">
- Step 2: Create the Resource Role with a trust policy
- </p>
- <p className="mb-3 text-sm text-mineshaft-300">
- Create an IAM role (e.g.,{" "}
- <code className="rounded bg-mineshaft-700 px-1 text-xs">
- InfisicalResourceRole
- </code>
- ) with the permissions policy above and the following trust policy:
- </p>
- <div className="relative mb-4">
- <div className="absolute top-1 right-3">
- <CopyButton value={trustPolicy} size="sm" variant="plain" />
- </div>
- <pre className="max-h-40 overflow-y-auto rounded-sm border border-mineshaft-600 bg-mineshaft-800 p-2 pr-8 text-xs whitespace-pre-wrap text-mineshaft-300">
- {trustPolicy}
- </pre>
- </div>
- <p className="text-xs text-mineshaft-400">
- <strong>Note:</strong> Use{" "}
- <code className="rounded bg-mineshaft-700 px-1 font-bold">
- {INFISICAL_AWS_ACCOUNT_US}
- </code>{" "}
- for US region or{" "}
- <code className="rounded bg-mineshaft-700 px-1 font-bold">
- {INFISICAL_AWS_ACCOUNT_EU}
- </code>{" "}
- for EU region. For dedicated instances, contact Infisical support. For self-hosted
- instances, use your Infisical deployment&apos;s AWS account ID. The External ID{" "}
- <code className="rounded bg-mineshaft-700 px-1 font-bold">{projectId}</code> is
- your current project ID.
- </p>
- </AccordionContent>
- </AccordionItem>
- </Accordion>
-
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsx
deleted file mode 100644
index 324b2048ed..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-import { z } from "zod";
-
-import { Field, FieldContent, FieldError, FieldLabel, Input } from "@app/components/v3";
-import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";
-import { slugSchema } from "@app/lib/schemas";
-
-// No .refine() — would turn into ZodEffects and break .extend() in per-resource forms.
-export const genericResourceFieldsSchema = z.object({
- name: slugSchema({ min: 1, max: 64, field: "Name" }),
- gatewayId: z.string().nullable().optional(),
- gatewayPoolId: z.string().nullable().optional(),
- metadata: z
- .object({
- key: z.string().trim().min(1),
- value: z.string().trim().default("")
- })
- .array()
- .optional()
-});
-
-type GenericFormValues = {
- name: string;
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
-};
-
-export const GenericResourceFields = () => {
- const { control, watch, setValue } = useFormContext<GenericFormValues>();
- const gatewayId = watch("gatewayId");
- const gatewayPoolId = watch("gatewayPoolId");
-
- return (
- <div className="flex flex-col gap-3">
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Name</FieldLabel>
- <FieldContent>
- <Input {...field} autoFocus isError={Boolean(error)} placeholder="my-resource" />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="gatewayId"
- render={({ fieldState: { error } }) => (
- <Field>
- <FieldLabel>Gateway</FieldLabel>
- <FieldContent>
- <GatewayPicker
- isRequired
- placeholder="Select a Gateway..."
- value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}
- onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {
- setValue("gatewayId", newGwId, { shouldDirty: true, shouldValidate: true });
- setValue("gatewayPoolId", newPoolId, {
- shouldDirty: true,
- shouldValidate: true
- });
- }}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/KubernetesResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/KubernetesResourceForm.tsx
deleted file mode 100644
index 773c106f79..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/KubernetesResourceForm.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { KubernetesAuthMethod, PamResourceType, TKubernetesResource } from "@app/hooks/api/pam";
-
-import { KubernetesResourceFields } from "./shared/KubernetesResourceFields";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TKubernetesResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const KubernetesConnectionDetailsSchema = z.object({
- url: z.string().url().trim().max(500),
- sslRejectUnauthorized: z.boolean(),
- sslCertificate: z.string().trim().max(10000).optional()
-});
-
-const KubernetesServiceAccountTokenCredentialsSchema = z.object({
- authMethod: z.literal(KubernetesAuthMethod.ServiceAccountToken),
- serviceAccountToken: z.string().trim().max(10000)
-});
-
-const KubernetesGatewayAuthCredentialsSchema = z.object({
- authMethod: z.literal(KubernetesAuthMethod.GatewayKubernetesAuth),
- namespace: z.string().trim().min(1).max(63),
- serviceAccountName: z.string().trim().min(1).max(253)
-});
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.Kubernetes),
- connectionDetails: KubernetesConnectionDetailsSchema,
- rotationAccountCredentials: z
- .discriminatedUnion("authMethod", [
- KubernetesServiceAccountTokenCredentialsSchema,
- KubernetesGatewayAuthCredentialsSchema
- ])
- .nullable()
- .optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const KubernetesResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.Kubernetes,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- url: "",
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <KubernetesResourceFields />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MetadataFields.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MetadataFields.tsx
deleted file mode 100644
index e998f4fd04..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MetadataFields.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { useFormContext } from "react-hook-form";
-
-import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";
-
-export const MetadataFields = () => {
- const { control } = useFormContext();
- return <MetadataForm control={control} />;
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MongoDBResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MongoDBResourceForm.tsx
deleted file mode 100644
index a11f32efd3..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MongoDBResourceForm.tsx
+++ /dev/null
@@ -1,267 +0,0 @@
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon } from "lucide-react";
-import { z } from "zod";
-
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- SheetFooter,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { PamResourceType, TMongoDBResource } from "@app/hooks/api/pam";
-
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TMongoDBResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.MongoDB),
- connectionDetails: z.object({
- connectionString: z
- .string()
- .trim()
- .min(1, "Connection string required")
- .superRefine((val, ctx) => {
- // 1. Protocol check (regex instead of new URL() to support comma-separated replica set hosts)
- const protocolMatch = val.match(/^mongodb(?:\+srv)?:\/\//i);
- if (!protocolMatch) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message:
- "Invalid MongoDB connection string. Must start with mongodb:// or mongodb+srv://"
- });
- return;
- }
-
- const rest = val.slice(protocolMatch[0].length);
- const hostAndPath = rest.split("?")[0];
-
- // 2. Credentials check — userinfo appears before @ in the authority
- if (hostAndPath.includes("@")) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message:
- "Credentials should not be included in the connection string — they are managed separately per account"
- });
- return;
- }
-
- // 3. Database in path — anything after the first / beyond the hosts
- const slashIndex = hostAndPath.indexOf("/");
- if (slashIndex !== -1 && hostAndPath.length > slashIndex + 1) {
- ctx.addIssue({
- code: z.ZodIssueCode.custom,
- message:
- "Database should not be included in the connection string — use the Database field instead"
- });
- }
- }),
- database: z
- .string()
- .trim()
- .min(1, "Database required")
- .regex(
- /^[a-zA-Z0-9_-]+$/,
- "Database name can only contain letters, numbers, underscores, and hyphens"
- )
- .default("admin"),
- sslEnabled: z.boolean().default(true),
- sslRejectUnauthorized: z.boolean().default(true),
- sslCertificate: z
- .string()
- .trim()
- .transform((value) => value || undefined)
- .optional()
- })
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const MongoDBResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null,
- connectionDetails: resource.connectionDetails
- }
- : {
- resourceType: PamResourceType.MongoDB,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- connectionString: "",
- database: "admin",
- sslEnabled: true,
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- control,
- watch,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const sslEnabled = watch("connectionDetails.sslEnabled");
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
-
- {/* Connection */}
- <div className="flex flex-col gap-3">
- <Label>Connection</Label>
-
- <Controller
- name="connectionDetails.connectionString"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Connection String
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- Supports mongodb:// and mongodb+srv:// URIs. Do not include credentials or
- database in the URI.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="mongodb+srv://cluster0.abc.mongodb.net"
- isError={Boolean(error)}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.database"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Database Name</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
-
- {/* SSL */}
- <div className="flex flex-col gap-3">
- <Label>SSL</Label>
-
- <Controller
- name="connectionDetails.sslEnabled"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable SSL</FieldLabel>
- <Switch variant="project" checked={value} onCheckedChange={onChange} />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslCertificate"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- placeholder="-----BEGIN CERTIFICATE-----..."
- disabled={!sslEnabled}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslRejectUnauthorized"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to the server if it has a valid,
- trusted SSL certificate.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!sslEnabled}
- checked={sslEnabled ? value : false}
- onCheckedChange={onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- </div>
-
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MsSQLResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MsSQLResourceForm.tsx
deleted file mode 100644
index b4c20229f9..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MsSQLResourceForm.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TMsSQLResource } from "@app/hooks/api/pam";
-
-import { BaseSqlResourceSchema } from "./shared/sql-resource-schemas";
-import { SqlResourceFields } from "./shared/SqlResourceFields";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TMsSQLResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.MsSQL),
- connectionDetails: BaseSqlResourceSchema
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const MsSQLResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.MsSQL,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- host: "",
- port: 1433,
- database: "master",
- sslEnabled: true,
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <SqlResourceFields />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MySQLResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MySQLResourceForm.tsx
deleted file mode 100644
index 3210d0fffd..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MySQLResourceForm.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TMySQLResource } from "@app/hooks/api/pam";
-
-import { BaseSqlResourceSchema } from "./shared/sql-resource-schemas";
-import { SqlResourceFields } from "./shared/SqlResourceFields";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TMySQLResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.MySQL),
- connectionDetails: BaseSqlResourceSchema.extend({
- database: z.string().trim().optional().default("")
- })
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const MySQLResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.MySQL,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- host: "",
- port: 3306,
- database: "",
- sslEnabled: true,
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <SqlResourceFields />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/OracleDBResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/OracleDBResourceForm.tsx
deleted file mode 100644
index 0742f33ec9..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/OracleDBResourceForm.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TOracleDBResource } from "@app/hooks/api/pam";
-
-import { BaseSqlResourceSchema } from "./shared/sql-resource-schemas";
-import { SqlResourceFields } from "./shared/SqlResourceFields";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-const OracleResourceSchema = BaseSqlResourceSchema.extend({
- database: z
- .string()
- .trim()
- .min(1, "Service name required")
- .max(128)
- .regex(
- /^[a-zA-Z][a-zA-Z0-9_.#$]*$/,
- "Must start with a letter and contain only letters, digits, underscores, dots, # or $"
- )
-});
-
-type Props = {
- resource?: TOracleDBResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.OracleDB),
- connectionDetails: OracleResourceSchema
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const OracleDBResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.OracleDB,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- host: "",
- port: 1521,
- database: "ORCLCDB",
- sslEnabled: true,
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <SqlResourceFields />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx
deleted file mode 100644
index ce5c42b60f..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { createNotification } from "@app/components/notifications";
-import {
- PAM_RESOURCE_TYPE_MAP,
- PamResourceType,
- TPamResource,
- useCreatePamResource,
- useUpdatePamResource
-} from "@app/hooks/api/pam";
-import { DiscriminativePick } from "@app/types";
-
-import { PamResourceHeader } from "../PamResourceHeader";
-import { AwsIamResourceForm } from "./AwsIamResourceForm";
-import { KubernetesResourceForm } from "./KubernetesResourceForm";
-import { MongoDBResourceForm } from "./MongoDBResourceForm";
-import { MsSQLResourceForm } from "./MsSQLResourceForm";
-import { MySQLResourceForm } from "./MySQLResourceForm";
-import { OracleDBResourceForm } from "./OracleDBResourceForm";
-import { PostgresResourceForm } from "./PostgresResourceForm";
-import { RedisResourceForm } from "./RedisResourceForm";
-import { SSHResourceForm } from "./SSHResourceForm";
-import { WindowsResourceForm } from "./WindowsResourceForm";
-
-type FormProps = {
- closeSheet: (resource?: TPamResource) => void;
-} & ({ resource: TPamResource } | { resourceType: PamResourceType });
-
-type CreateFormProps = FormProps & {
- resourceType: PamResourceType;
- projectId: string;
-};
-
-type UpdateFormProps = FormProps & {
- resource: TPamResource;
-};
-
-const CreateForm = ({ resourceType, closeSheet, projectId }: CreateFormProps) => {
- const createPamResource = useCreatePamResource();
- const { name: resourceName } = PAM_RESOURCE_TYPE_MAP[resourceType];
-
- const onSubmit = async (
- formData: DiscriminativePick<
- TPamResource,
- "name" | "resourceType" | "connectionDetails" | "domainId"
- > & {
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- metadata?: { key: string; value: string }[];
- }
- ) => {
- const resource = await createPamResource.mutateAsync({
- ...formData,
- gatewayId: formData.gatewayId ?? undefined,
- gatewayPoolId: formData.gatewayPoolId ?? undefined,
- projectId
- });
- createNotification({
- text: `Successfully created ${resourceName} resource`,
- type: "success"
- });
- closeSheet(resource);
- };
-
- switch (resourceType) {
- case PamResourceType.Postgres:
- return <PostgresResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.MySQL:
- return <MySQLResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.MsSQL:
- return <MsSQLResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.OracleDB:
- return <OracleDBResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.MongoDB:
- return <MongoDBResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.Redis:
- return <RedisResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.SSH:
- return <SSHResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.Kubernetes:
- return <KubernetesResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.AwsIam:
- return <AwsIamResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.Windows:
- return <WindowsResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- default:
- throw new Error(`Unhandled resource: ${resourceType}`);
- }
-};
-
-const UpdateForm = ({ resource, closeSheet }: UpdateFormProps) => {
- const updatePamResource = useUpdatePamResource();
- const { name: resourceName } = PAM_RESOURCE_TYPE_MAP[resource.resourceType];
-
- const onSubmit = async (
- formData: DiscriminativePick<
- TPamResource,
- "name" | "resourceType" | "connectionDetails" | "domainId"
- > & {
- gatewayId?: string | null;
- gatewayPoolId?: string | null;
- metadata?: { key: string; value: string }[];
- }
- ) => {
- const updatedResource = await updatePamResource.mutateAsync({
- resourceId: resource.id,
- ...formData,
- gatewayId: formData.gatewayId ?? undefined,
- gatewayPoolId: formData.gatewayPoolId ?? undefined
- });
- createNotification({
- text: `Successfully updated ${resourceName} resource`,
- type: "success"
- });
- closeSheet(updatedResource);
- };
-
- switch (resource.resourceType) {
- case PamResourceType.Postgres:
- return (
- <PostgresResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.MySQL:
- return <MySQLResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.MsSQL:
- return <MsSQLResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.OracleDB:
- return (
- <OracleDBResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.MongoDB:
- return (
- <MongoDBResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.Redis:
- return <RedisResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.SSH:
- return <SSHResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.Kubernetes:
- return (
- <KubernetesResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- case PamResourceType.AwsIam:
- return <AwsIamResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.Windows:
- return (
- <WindowsResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />
- );
- default:
- throw new Error(`Unhandled resource: ${(resource as any).resourceType}`);
- }
-};
-
-type Props = { onBack?: () => void; projectId: string } & Pick<FormProps, "closeSheet"> &
- (
- | { resourceType: PamResourceType; resource?: undefined }
- | { resourceType?: undefined; resource: TPamResource }
- );
-export const PamResourceForm = ({ onBack, projectId, ...props }: Props) => {
- const { resource, resourceType } = props;
-
- return (
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
- <PamResourceHeader resourceType={resourceType || resource.resourceType} onBack={onBack} />
- {resource ? (
- <UpdateForm {...props} resource={resource} />
- ) : (
- <CreateForm {...props} resourceType={resourceType} projectId={projectId} />
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PostgresResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PostgresResourceForm.tsx
deleted file mode 100644
index e23fed7b7b..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PostgresResourceForm.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TPostgresResource } from "@app/hooks/api/pam";
-
-import { BaseSqlResourceSchema } from "./shared/sql-resource-schemas";
-import { SqlResourceFields } from "./shared/SqlResourceFields";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TPostgresResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.Postgres),
- connectionDetails: BaseSqlResourceSchema
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const PostgresResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.Postgres,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- host: "",
- port: 5432,
- database: "default",
- sslEnabled: true,
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <SqlResourceFields />
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/RedisResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/RedisResourceForm.tsx
deleted file mode 100644
index 7ccdfef1ae..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/RedisResourceForm.tsx
+++ /dev/null
@@ -1,203 +0,0 @@
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon } from "lucide-react";
-import { z } from "zod";
-
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- SheetFooter,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { PamResourceType, TRedisResource } from "@app/hooks/api/pam";
-
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TRedisResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.Redis),
- connectionDetails: z.object({
- host: z.string().trim().min(1, "Host is required"),
- port: z.coerce.number().int().min(1).max(65535),
- sslEnabled: z.boolean().default(true),
- sslRejectUnauthorized: z.boolean().default(true),
- sslCertificate: z.string().trim().optional()
- })
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const RedisResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.Redis,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- host: "",
- port: 6379,
- sslEnabled: true,
- sslRejectUnauthorized: true,
- sslCertificate: undefined
- }
- }
- });
-
- const {
- handleSubmit,
- control,
- watch,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const sslEnabled = watch("connectionDetails.sslEnabled");
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
-
- {/* Connection */}
- <div className="flex flex-col gap-3">
- <Label>Connection</Label>
-
- <div className="grid grid-cols-[1fr_auto] gap-2">
- <Controller
- name="connectionDetails.host"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Host</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.port"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="w-24">
- <FieldLabel>Port</FieldLabel>
- <FieldContent>
- <Input type="number" {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- </div>
-
- {/* SSL */}
- <div className="flex flex-col gap-3">
- <Label>SSL</Label>
-
- <Controller
- name="connectionDetails.sslEnabled"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable SSL</FieldLabel>
- <Switch variant="project" checked={value} onCheckedChange={onChange} />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslCertificate"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- placeholder="-----BEGIN CERTIFICATE-----..."
- disabled={!sslEnabled}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslRejectUnauthorized"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to the server if it has a valid,
- trusted SSL certificate.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!sslEnabled}
- checked={sslEnabled ? value : false}
- onCheckedChange={onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- </div>
-
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/SSHResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/SSHResourceForm.tsx
deleted file mode 100644
index 397639409a..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/SSHResourceForm.tsx
+++ /dev/null
@@ -1,125 +0,0 @@
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- SheetFooter
-} from "@app/components/v3";
-import { PamResourceType, TSSHResource } from "@app/hooks/api/pam";
-
-import { SshCaSetupSection } from "../../../components/SshCaSetupSection";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TSSHResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const BaseSshConnectionDetailsSchema = z.object({
- host: z.string().trim().min(1, "Host is required"),
- port: z.coerce.number().int().min(1).max(65535)
-});
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.SSH),
- connectionDetails: BaseSshConnectionDetailsSchema
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const SSHResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null
- }
- : {
- resourceType: PamResourceType.SSH,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- host: "",
- port: 22
- }
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
- <div className="flex items-start gap-2">
- <Controller
- name="connectionDetails.host"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="flex-1">
- <FieldLabel>Host</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- isError={Boolean(error)}
- placeholder="example.com or 192.168.1.1"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.port"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="w-28">
- <FieldLabel>Port</FieldLabel>
- <FieldContent>
- <Input type="number" {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- {isUpdate && <SshCaSetupSection resourceId={resource!.id} isOptional className="mb-4" />}
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx
deleted file mode 100644
index 38bf8994c4..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx
+++ /dev/null
@@ -1,291 +0,0 @@
-import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon } from "lucide-react";
-import { z } from "zod";
-
-import {
- Button,
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- SheetFooter,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { PamResourceType, TWindowsResource } from "@app/hooks/api/pam";
-import { WindowsProtocol } from "@app/hooks/api/pam/types/windows-server-resource";
-
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
-
-type Props = {
- resource?: TWindowsResource;
- onSubmit: (formData: FormData) => Promise<void>;
- closeSheet: () => void;
-};
-
-const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.Windows),
- connectionDetails: z.object({
- protocol: z.literal(WindowsProtocol.RDP),
- hostname: z.string().trim().min(1, "Hostname is required"),
- port: z.coerce.number().int().min(1).max(65535),
- winrmPort: z.coerce.number().int().min(1).max(65535),
- useWinrmHttps: z.boolean(),
- winrmRejectUnauthorized: z.boolean(),
- winrmCaCert: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional(),
- winrmTlsServerName: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional()
- }),
- domainId: z.string().uuid().nullable().optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const WindowsResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: resource
- ? {
- ...resource,
- gatewayId: resource.gatewayId ?? null,
- gatewayPoolId: resource.gatewayPoolId ?? null,
- domainId: resource.domainId ?? null,
- connectionDetails: {
- ...(resource.connectionDetails as FormData["connectionDetails"]),
- winrmPort: (resource.connectionDetails as any).winrmPort ?? 5986,
- useWinrmHttps: (resource.connectionDetails as any).useWinrmHttps ?? true,
- winrmRejectUnauthorized:
- (resource.connectionDetails as any).winrmRejectUnauthorized ?? true,
- winrmCaCert: (resource.connectionDetails as any).winrmCaCert ?? "",
- winrmTlsServerName: (resource.connectionDetails as any).winrmTlsServerName ?? ""
- }
- }
- : {
- resourceType: PamResourceType.Windows,
- gatewayId: null,
- gatewayPoolId: null,
- connectionDetails: {
- protocol: WindowsProtocol.RDP,
- hostname: "",
- port: 3389,
- winrmPort: 5986,
- useWinrmHttps: true,
- winrmRejectUnauthorized: true,
- winrmCaCert: "",
- winrmTlsServerName: ""
- },
- domainId: null
- }
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- const useWinrmHttps = useWatch({ control, name: "connectionDetails.useWinrmHttps" });
- const winrmRejectUnauthorized = useWatch({
- control,
- name: "connectionDetails.winrmRejectUnauthorized"
- });
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={handleSubmit((data) => onSubmit(data as FormData))}
- className="flex flex-1 flex-col overflow-hidden"
- >
- <div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
- <GenericResourceFields />
-
- {/* RDP Connection */}
- <div className="flex items-start gap-2">
- <Controller
- name="connectionDetails.hostname"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="flex-1">
- <FieldLabel>Hostname</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- isError={Boolean(error)}
- placeholder="example.com or 192.168.1.1"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.port"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="w-28">
- <FieldLabel>Port</FieldLabel>
- <FieldContent>
- <Input type="number" {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
-
- {/* WinRM Configuration */}
- <div className="flex flex-col gap-3">
- <Label>WinRM</Label>
-
- <Controller
- name="connectionDetails.winrmPort"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Port
- <Tooltip>
- <TooltipTrigger>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The WinRM port on this machine. Default is 5985 for HTTP or 5986 for HTTPS
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input {...field} type="number" placeholder="5986" isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.useWinrmHttps"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable HTTPS</FieldLabel>
- <Switch
- variant="project"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.winrmCaCert"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- className="max-h-32"
- disabled={!useWinrmHttps}
- placeholder="-----BEGIN CERTIFICATE-----..."
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.winrmRejectUnauthorized"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect if the machine has a valid, trusted
- TLS certificate
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!useWinrmHttps}
- checked={useWinrmHttps ? field.value : false}
- onCheckedChange={field.onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.winrmTlsServerName"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- TLS Server Name
- <Tooltip>
- <TooltipTrigger>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- The expected hostname in the server&apos;s TLS certificate. Required when
- connecting via IP address and Reject Unauthorized is enabled.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="server.corp.example.com"
- disabled={!useWinrmHttps || !winrmRejectUnauthorized}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
-
- <MetadataFields />
- </div>
- <SheetFooter className="shrink-0 border-t">
- <Button
- isPending={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- variant="neutral"
- type="submit"
- >
- {isUpdate ? "Update Details" : "Create Resource"}
- </Button>
- <Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
- Cancel
- </Button>
- </SheetFooter>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/index.ts b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/index.ts
deleted file mode 100644
index a86811882a..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from "./GenericResourceFields";
-export * from "./PamResourceForm";
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/KubernetesResourceFields.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/KubernetesResourceFields.tsx
deleted file mode 100644
index b92939adc8..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/KubernetesResourceFields.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-import { InfoIcon } from "lucide-react";
-
-import {
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-
-export const KubernetesResourceFields = () => {
- const { control } = useFormContext();
-
- return (
- <div className="flex flex-col gap-3">
- <Label>Connection</Label>
-
- <Controller
- name="connectionDetails.url"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Kubernetes API URL</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- isError={Boolean(error)}
- placeholder="https://kubernetes.example.com:6443"
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslCertificate"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE-----..." />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslRejectUnauthorized"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to the server if it has a valid, trusted
- SSL certificate.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch variant="project" checked={value} onCheckedChange={onChange} />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/SqlResourceFields.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/SqlResourceFields.tsx
deleted file mode 100644
index 92a24f9e02..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/SqlResourceFields.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { Controller, useFormContext } from "react-hook-form";
-import { InfoIcon } from "lucide-react";
-
-import {
- Field,
- FieldContent,
- FieldError,
- FieldLabel,
- Input,
- Label,
- Switch,
- TextArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-
-export const SqlResourceFields = () => {
- const { control, watch } = useFormContext();
-
- const sslEnabled = watch("connectionDetails.sslEnabled");
- return (
- <>
- {/* Connection */}
- <div className="flex flex-col gap-3">
- <Label>Connection</Label>
-
- <div className="grid grid-cols-[1fr_1fr_auto] gap-2">
- <Controller
- name="connectionDetails.host"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Host</FieldLabel>
- <FieldContent>
- <Input {...field} placeholder="db.example.com" isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.database"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Database Name</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- <Controller
- name="connectionDetails.port"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field className="w-24">
- <FieldLabel>Port</FieldLabel>
- <FieldContent>
- <Input type="number" {...field} isError={Boolean(error)} />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- </div>
-
- {/* SSL */}
- <div className="flex flex-col gap-3">
- <Label>SSL</Label>
-
- <Controller
- name="connectionDetails.sslEnabled"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>Enable SSL</FieldLabel>
- <Switch variant="project" checked={value} onCheckedChange={onChange} />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslCertificate"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>CA Certificate</FieldLabel>
- <FieldContent>
- <TextArea
- {...field}
- placeholder="-----BEGIN CERTIFICATE-----..."
- disabled={!sslEnabled}
- />
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- name="connectionDetails.sslRejectUnauthorized"
- control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <FieldLabel>
- Reject Unauthorized
- <Tooltip>
- <TooltipTrigger asChild>
- <InfoIcon className="mb-0.5 inline-block size-3 text-accent" />
- </TooltipTrigger>
- <TooltipContent>
- If enabled, Infisical will only connect to the server if it has a valid, trusted
- SSL certificate.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Switch
- variant="project"
- disabled={!sslEnabled}
- checked={sslEnabled ? value : false}
- onCheckedChange={onChange}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- </div>
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/SqlRotateAccountFields.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/SqlRotateAccountFields.tsx
deleted file mode 100644
index d3f11ed60d..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/SqlRotateAccountFields.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, useFormContext, useWatch } from "react-hook-form";
-
-import { FormControl, Input, Switch } from "@app/components/v2";
-import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-
-export const SqlRotateAccountFields = ({ isUpdate }: { isUpdate: boolean }) => {
- const { control, setValue, getValues } = useFormContext();
- const [showPassword, setShowPassword] = useState(false);
- const password = useWatch({ control, name: "credentials.password" });
-
- const rotationUsername = useWatch({ control, name: "rotationAccountCredentials.username" });
- const rotationPassword = useWatch({ control, name: "rotationAccountCredentials.password" });
-
- const [enabled, setEnabled] = useState(false);
- const [wasRotationPasswordSentinelInitially, setWasRotationPasswordSentinelInitially] =
- useState(false);
-
- useEffect(() => {
- const initialRotationPass = getValues("rotationAccountCredentials.password");
- if (initialRotationPass === UNCHANGED_PASSWORD_SENTINEL) {
- setWasRotationPasswordSentinelInitially(true);
- }
- }, [getValues]);
-
- useEffect(() => {
- if (password === UNCHANGED_PASSWORD_SENTINEL) {
- setShowPassword(false);
- }
- }, [password]);
-
- useEffect(() => {
- const isUsernamePopulated = rotationUsername && rotationUsername !== "";
- const isPasswordPopulated =
- rotationPassword &&
- rotationPassword !== "" &&
- rotationPassword !== UNCHANGED_PASSWORD_SENTINEL;
-
- if (isUsernamePopulated || isPasswordPopulated) {
- setEnabled(true);
- }
- }, [rotationUsername, rotationPassword]);
-
- return (
- <div className="flex flex-col gap-2">
- <Switch
- id="account-rotation"
- onCheckedChange={(value) => {
- setEnabled(value);
- if (value) {
- setValue("rotationAccountCredentials.username", "", {
- shouldDirty: true
- });
- setValue("rotationAccountCredentials.password", "", {
- shouldDirty: true
- });
- } else {
- setValue("rotationAccountCredentials", null, {
- shouldDirty: true
- });
- }
- }}
- isChecked={enabled}
- containerClassName="flex-row-reverse w-fit"
- className="ml-0"
- >
- <p className="ml-2">Credential Rotation</p>
- </Switch>
-
- {enabled && (
- <>
- <div className="flex gap-2">
- <Controller
- name="rotationAccountCredentials.username"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0 flex-1"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Username"
- >
- <div className="relative">
- <Input {...field} autoComplete="off" />
- </div>
- </FormControl>
- )}
- />
- <Controller
- name="rotationAccountCredentials.password"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- className="mb-0 flex-1"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Password"
- >
- <div className="relative">
- <Input
- {...field}
- type={showPassword ? "text" : "password"}
- autoComplete="new-password"
- onFocus={() => {
- if (isUpdate && field.value === UNCHANGED_PASSWORD_SENTINEL) {
- field.onChange("");
- }
- setShowPassword(true);
- }}
- onBlur={() => {
- if (
- isUpdate &&
- field.value === "" &&
- wasRotationPasswordSentinelInitially
- ) {
- field.onChange(UNCHANGED_PASSWORD_SENTINEL);
- }
- setShowPassword(false);
- }}
- />
- </div>
- </FormControl>
- )}
- />
- </div>
-
- <p className="mb-2 text-xs text-mineshaft-400">
- Credentials of the privileged account which will be used for rotating other accounts
- under this resource
- </p>
- </>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/sql-resource-schemas.ts b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/sql-resource-schemas.ts
deleted file mode 100644
index 1f5030fcb9..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/shared/sql-resource-schemas.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { z } from "zod";
-
-export const BaseSqlResourceSchema = z.object({
- host: z.string().trim().min(1, "Host required"),
- port: z.coerce.number().default(5432),
- database: z.string().trim().min(1, "Database required").default("default"),
- sslEnabled: z.boolean().default(true),
- sslRejectUnauthorized: z.boolean().default(true),
- sslCertificate: z
- .string()
- .trim()
- .transform((value) => value || undefined)
- .optional()
-});
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx
deleted file mode 100644
index 94b3a98ad1..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { PencilIcon } from "lucide-react";
-
-import { Button, DocumentationLinkBadge, Label } from "@app/components/v3";
-import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
-
-const PAM_RESOURCE_DOCS_MAP: Partial<Record<PamResourceType, string>> = {
- [PamResourceType.AwsIam]: "aws-iam#create-the-pam-resource",
- [PamResourceType.Kubernetes]: "kubernetes#create-the-pam-resource",
- [PamResourceType.MySQL]: "mysql#create-the-pam-resource",
- [PamResourceType.Postgres]: "postgresql#create-the-pam-resource",
- [PamResourceType.Redis]: "redis#create-the-pam-resource",
- [PamResourceType.SSH]: "ssh#create-the-pam-resource",
- [PamResourceType.Windows]: "windows-server#create-the-pam-resource"
-};
-
-type Props = {
- resourceType: PamResourceType;
- onBack?: () => void;
-};
-
-export const PamResourceHeader = ({ resourceType, onBack }: Props) => {
- const details = PAM_RESOURCE_TYPE_MAP[resourceType];
- const docsPath = PAM_RESOURCE_DOCS_MAP[resourceType];
-
- return (
- <div className="flex w-full items-center gap-2.5 border-b border-border p-3">
- <img
- alt={`${details.name} logo`}
- src={`/images/integrations/${details.image}`}
- className="size-9"
- />
- <div className="flex w-full flex-col gap-1">
- <Label>
- {details.name}
- {docsPath && (
- <DocumentationLinkBadge
- href={`https://infisical.com/docs/documentation/platform/pam/getting-started/resources/${docsPath}`}
- />
- )}
- </Label>
- <p className="text-xs text-muted">Resoure</p>
- </div>
- {onBack && (
- <Button size="xs" variant="neutral" onClick={onBack}>
- <PencilIcon />
- Change
- </Button>
- )}
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesSection.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesSection.tsx
deleted file mode 100644
index dd29c1b21a..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesSection.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { useProject } from "@app/context";
-
-import { PamResourcesTable } from "./PamResourcesTable";
-
-export const PamResourcesSection = () => {
- const { currentProject } = useProject();
-
- return <PamResourcesTable projectId={currentProject.id} />;
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx
deleted file mode 100644
index 739cc99f2f..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx
+++ /dev/null
@@ -1,348 +0,0 @@
-import { useMemo, useState } from "react";
-import { faCircleXmark } from "@fortawesome/free-regular-svg-icons";
-import { faFilter, faMagnifyingGlass, faPlus, faSearch } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate, useSearch } from "@tanstack/react-router";
-import { twMerge } from "tailwind-merge";
-
-import { OrgPermissionCan, ProjectPermissionCan } from "@app/components/permissions";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
- EmptyState,
- FilterableSelect,
- IconButton,
- Input,
- Pagination,
- Tooltip
-} from "@app/components/v2";
-import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import {
- OrgGatewayPermissionActions,
- OrgPermissionSubjects
-} from "@app/context/OrgPermissionContext/types";
-import {
- getUserTablePreference,
- PreferenceKey,
- setUserTablePreference
-} from "@app/helpers/userTablePreferences";
-import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
-import {
- PAM_RESOURCE_TYPE_MAP,
- PamResourceOrderBy,
- PamResourceType,
- useListPamResources
-} from "@app/hooks/api/pam";
-import { useSetPamResourceFavorite } from "@app/hooks/api/pam/mutations";
-import {
- MetadataFilterEntry,
- MetadataFilterSection
-} from "@app/pages/cert-manager/components/MetadataFilterSection";
-
-import { PamAddResourceModal } from "./PamAddResourceModal";
-import { PamDeleteResourceModal } from "./PamDeleteResourceModal";
-import { PamResourceCard } from "./PamResourceCard";
-import { PamUpdateResourceModal } from "./PamUpdateResourceModal";
-
-const ResourceTypeOptionLabel = ({ label, image }: { label: string; image?: string }) => (
- <div className="flex items-center gap-2">
- <img alt={`${label} resource type`} src={`/images/integrations/${image}`} className="h-4 w-4" />
- <span>{label}</span>
- </div>
-);
-
-type Props = {
- projectId: string;
-};
-
-export const PamResourcesTable = ({ projectId }: Props) => {
- const navigate = useNavigate({ from: ROUTE_PATHS.Pam.ResourcesPage.path });
-
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
- "updateResource",
- "addResource",
- "deleteResource"
- ] as const);
-
- const { search: initSearch } = useSearch({
- from: ROUTE_PATHS.Pam.ResourcesPage.id
- });
-
- const [pendingResourceTypes, setPendingResourceTypes] = useState<PamResourceType[]>([]);
- const [appliedResourceTypes, setAppliedResourceTypes] = useState<PamResourceType[]>([]);
- const [pendingMetadataEntries, setPendingMetadataEntries] = useState<MetadataFilterEntry[]>([]);
- const [appliedMetadataEntries, setAppliedMetadataEntries] = useState<MetadataFilterEntry[]>([]);
-
- const { search, debouncedSearch, setSearch, setPage, page, perPage, setPerPage, offset } =
- usePagination(PamResourceOrderBy.Name, {
- initPerPage: getUserTablePreference("pamResourcesTable", PreferenceKey.PerPage, 9),
- initSearch
- });
-
- const handlePerPageChange = (newPerPage: number) => {
- setPerPage(newPerPage);
- setUserTablePreference("pamResourcesTable", PreferenceKey.PerPage, newPerPage);
- };
-
- const setFavorite = useSetPamResourceFavorite();
-
- const { data, isLoading } = useListPamResources({
- projectId,
- offset,
- limit: perPage,
- search: debouncedSearch,
- filterResourceTypes: appliedResourceTypes.length ? appliedResourceTypes.join(",") : undefined,
- metadataFilter: appliedMetadataEntries.filter((e) => e.key.trim()).length
- ? appliedMetadataEntries
- .filter((e) => e.key.trim())
- .map((e) => ({ key: e.key.trim(), ...(e.value.trim() ? { value: e.value.trim() } : {}) }))
- : undefined
- });
-
- const resources = data?.resources || [];
- const totalCount = data?.totalCount || 0;
-
- useResetPageHelper({
- totalCount,
- offset,
- setPage
- });
-
- const isTableFiltered = Boolean(
- appliedResourceTypes.length || appliedMetadataEntries.some((e) => e.key.trim())
- );
-
- const hasFilterChanges = useMemo(() => {
- const typesChanged =
- JSON.stringify([...pendingResourceTypes].sort()) !==
- JSON.stringify([...appliedResourceTypes].sort());
- const metadataChanged =
- JSON.stringify(pendingMetadataEntries) !== JSON.stringify(appliedMetadataEntries);
- return typesChanged || metadataChanged;
- }, [pendingResourceTypes, appliedResourceTypes, pendingMetadataEntries, appliedMetadataEntries]);
-
- const handleApplyFilters = () => {
- setAppliedResourceTypes(pendingResourceTypes);
- setAppliedMetadataEntries(pendingMetadataEntries);
- setPage(1);
- };
-
- const handleClearFilters = () => {
- setPendingResourceTypes([]);
- setAppliedResourceTypes([]);
- setPendingMetadataEntries([]);
- setAppliedMetadataEntries([]);
- setPage(1);
- };
-
- const handleClearResourceTypes = () => {
- setPendingResourceTypes([]);
- };
-
- const resourceTypeOptions = Object.entries(PAM_RESOURCE_TYPE_MAP).map(
- ([type, { name, image }]) => ({
- value: type as PamResourceType,
- label: name,
- image
- })
- );
-
- const isContentEmpty = !resources.length;
- const isSearchEmpty = isContentEmpty && (Boolean(search) || isTableFiltered);
-
- return (
- <div>
- <div className="flex gap-2">
- <Input
- value={search}
- onChange={(e) => {
- const newSearch = e.target.value;
- setSearch(newSearch);
- navigate({
- search: (prev) => ({ ...prev, search: newSearch || undefined }),
- replace: true
- });
- }}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search resources..."
- className="flex-1"
- />
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Filter resources"
- variant="plain"
- size="sm"
- className={twMerge(
- "flex h-10 w-11 items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",
- isTableFiltered && "border-primary/50 text-primary"
- )}
- >
- <FontAwesomeIcon icon={faFilter} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- sideOffset={2}
- className="max-h-[70vh] thin-scrollbar w-80 overflow-y-auto p-4"
- align="end"
- >
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <h3 className="text-sm font-medium text-mineshaft-100">Filters</h3>
- <span className="text-xs text-bunker-300">
- {isTableFiltered && (
- <button
- type="button"
- onClick={handleClearFilters}
- className="cursor-pointer text-primary hover:text-primary-600"
- >
- Clear filters
- </button>
- )}
- </span>
- </div>
-
- <div className="space-y-2">
- <div className="flex items-center justify-between">
- <span className="text-xs font-medium text-bunker-300 uppercase">
- Resource Type
- </span>
- {pendingResourceTypes.length > 0 && (
- <button
- type="button"
- onClick={handleClearResourceTypes}
- className="cursor-pointer text-xs text-primary hover:text-primary-600"
- >
- Clear
- </button>
- )}
- </div>
- <FilterableSelect
- value={pendingResourceTypes.map((type) => ({
- value: type,
- label: PAM_RESOURCE_TYPE_MAP[type].name,
- image: PAM_RESOURCE_TYPE_MAP[type].image
- }))}
- onChange={(selectedOptions) => {
- const types = Array.isArray(selectedOptions)
- ? selectedOptions.map((opt) => opt.value as PamResourceType)
- : [];
- setPendingResourceTypes(types);
- }}
- options={resourceTypeOptions}
- formatOptionLabel={ResourceTypeOptionLabel}
- placeholder="Select resource types..."
- className="w-full border-mineshaft-600 bg-mineshaft-700 text-bunker-200"
- isMulti
- maxMenuHeight={120}
- />
- </div>
-
- <MetadataFilterSection
- entries={pendingMetadataEntries}
- onChange={setPendingMetadataEntries}
- />
-
- <div className="pt-2">
- <Button
- onClick={handleApplyFilters}
- className="w-full bg-primary font-medium text-black hover:bg-primary-600"
- size="sm"
- isDisabled={!hasFilterChanges}
- >
- Apply Filters
- </Button>
- </div>
- </div>
- </DropdownMenuContent>
- </DropdownMenu>
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.AttachGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isGatewayAllowed) => (
- <ProjectPermissionCan
- I={ProjectPermissionActions.Create}
- a={ProjectPermissionSub.PamResources}
- >
- {(isAllowed) => (
- <Tooltip
- isDisabled={isGatewayAllowed}
- content="Restricted access. You don't have permission to attach gateways to resources."
- >
- <Button
- colorSchema="secondary"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => handlePopUpOpen("addResource")}
- isDisabled={!isAllowed || !isGatewayAllowed}
- >
- Add Resource
- </Button>
- </Tooltip>
- )}
- </ProjectPermissionCan>
- )}
- </OrgPermissionCan>
- </div>
- <div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
- {isLoading &&
- Array.from({ length: 9 }).map((_, i) => (
- <div
- // eslint-disable-next-line react/no-array-index-key
- key={`skeleton-${i}`}
- className="h-[88px] animate-pulse rounded-sm border border-mineshaft-600 bg-mineshaft-800"
- />
- ))}
- {!isLoading &&
- resources.map((resource) => (
- <PamResourceCard
- key={resource.id}
- resource={resource}
- onUpdate={(e) => handlePopUpOpen("updateResource", e)}
- onDelete={(e) => handlePopUpOpen("deleteResource", e)}
- onToggleFavorite={(e) =>
- setFavorite.mutate({ projectId, resourceId: e.id, isFavorite: !e.isFavorite })
- }
- search={search.trim().toLowerCase()}
- />
- ))}
- {Boolean(totalCount) && !isLoading && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={handlePerPageChange}
- perPageList={[9, 18, 48, 99]}
- className="col-span-full justify-start! border-transparent bg-transparent pl-2"
- />
- )}
- {!isLoading && isContentEmpty && (
- <EmptyState
- title={isSearchEmpty ? "No resources match search" : "No resources"}
- icon={isSearchEmpty ? faSearch : faCircleXmark}
- className="col-span-full rounded border border-mineshaft-500"
- />
- )}
- </div>
- <PamDeleteResourceModal
- isOpen={popUp.deleteResource.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("deleteResource", isOpen)}
- resource={popUp.deleteResource.data}
- />
- <PamUpdateResourceModal
- isOpen={popUp.updateResource.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("updateResource", isOpen)}
- resource={popUp.updateResource.data}
- />
- <PamAddResourceModal
- isOpen={popUp.addResource.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("addResource", isOpen)}
- projectId={projectId}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamUpdateResourceModal.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamUpdateResourceModal.tsx
deleted file mode 100644
index 54fe7f4b06..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamUpdateResourceModal.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
-import { PAM_RESOURCE_TYPE_MAP, TPamResource } from "@app/hooks/api/pam";
-
-import { PamResourceForm } from "./PamResourceForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- resource?: TPamResource;
-};
-
-export const PamUpdateResourceModal = ({ isOpen, onOpenChange, resource }: Props) => {
- if (!resource) return null;
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
- <SheetHeader className="border-b">
- <SheetTitle>Edit Resource</SheetTitle>
- <SheetDescription>
- Update details for this {PAM_RESOURCE_TYPE_MAP[resource.resourceType].name} resource.
- </SheetDescription>
- </SheetHeader>
- <PamResourceForm
- closeSheet={() => onOpenChange(false)}
- resource={resource}
- projectId={resource.projectId}
- />
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx b/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx
deleted file mode 100644
index bdc4cb06be..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx
+++ /dev/null
@@ -1,125 +0,0 @@
-import { useMemo, useState } from "react";
-import { SearchIcon } from "lucide-react";
-
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { Button, InputGroup, InputGroupAddon, InputGroupInput, Label } from "@app/components/v3";
-import { usePopUp } from "@app/hooks";
-import {
- PAM_RESOURCE_TYPE_MAP,
- PamResourceType,
- useListPamResourceOptions
-} from "@app/hooks/api/pam";
-
-type Props = {
- onSelect: (resource: PamResourceType) => void;
-};
-
-const COMING_SOON_RESOURCES = [
- { name: "SQLite", resource: PamResourceType.SQLite },
- { name: "Cassandra", resource: PamResourceType.Cassandra },
- { name: "CockroachDB", resource: PamResourceType.CockroachDB },
- { name: "DynamoDB", resource: PamResourceType.DynamoDB },
- { name: "Snowflake", resource: PamResourceType.Snowflake },
- { name: "Elasticsearch", resource: PamResourceType.Elasticsearch },
- { name: "MCP", resource: PamResourceType.MCP },
- { name: "Web Application", resource: PamResourceType.WebApp }
-];
-
-const COMING_SOON_SET = new Set(COMING_SOON_RESOURCES.map((r) => r.resource));
-
-export const ResourceTypeSelect = ({ onSelect }: Props) => {
- const { isPending, data: resourceOptions } = useListPamResourceOptions();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
- const [search, setSearch] = useState("");
-
- const allOptions = useMemo(() => {
- if (!resourceOptions) return [];
- return [...resourceOptions, ...COMING_SOON_RESOURCES].sort((a, b) =>
- a.name.localeCompare(b.name)
- );
- }, [resourceOptions]);
-
- const filteredOptions = useMemo(() => {
- if (!search.trim()) return allOptions;
- const searchLower = search.toLowerCase();
- return allOptions.filter((option) => {
- const details = PAM_RESOURCE_TYPE_MAP[option.resource];
- return details.name.toLowerCase().includes(searchLower);
- });
- }, [allOptions, search]);
-
- const handleResourceSelect = (resource: PamResourceType) => {
- if (COMING_SOON_SET.has(resource)) {
- handlePopUpOpen("upgradePlan", {
- text: "Your current plan does not include access to this resource type. To unlock this feature, please upgrade to Infisical Enterprise plan.",
- isEnterpriseFeature: true
- });
- return;
- }
-
- onSelect(resource);
- };
-
- if (isPending) {
- return (
- <div className="flex h-full items-center justify-center">
- <Label>Loading options...</Label>
- </div>
- );
- }
-
- return (
- <>
- <div className="flex flex-col overflow-hidden">
- <div className="p-4 pb-2">
- <InputGroup>
- <InputGroupAddon>
- <SearchIcon className="size-4" />
- </InputGroupAddon>
- <InputGroupInput
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder="Search resources..."
- />
- </InputGroup>
- </div>
- <div className="flex flex-1 overflow-y-auto">
- <div className="flex h-fit w-full flex-col gap-2 p-4 pt-2">
- {filteredOptions.length === 0 ? (
- <div className="flex items-center justify-center py-8 text-sm text-muted">
- No resources found
- </div>
- ) : (
- filteredOptions.map((option) => {
- const details = PAM_RESOURCE_TYPE_MAP[option.resource];
-
- return (
- <Button
- key={option.resource}
- onClick={() => handleResourceSelect(option.resource)}
- size="lg"
- variant="neutral"
- className="w-full justify-start"
- >
- <img
- src={`/images/integrations/${details.image}`}
- className="size-6"
- alt={`${details.name} logo`}
- />
- <Label className="pointer-events-none">{details.name}</Label>
- </Button>
- );
- })
- )}
- </div>
- </div>
- </div>
- <UpgradePlanModal
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan.data?.text}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourcesPage/route.tsx b/frontend/src/pages/pam/PamResourcesPage/route.tsx
deleted file mode 100644
index 2889c165c0..0000000000
--- a/frontend/src/pages/pam/PamResourcesPage/route.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { PamResourcesPage } from "./PamResourcesPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/"
-)({
- validateSearch: zodValidator(
- z.object({
- search: z.string().optional()
- })
- ),
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Resources"
- }
- ]
- };
- },
- component: PamResourcesPage
-});
diff --git a/frontend/src/pages/pam/SettingsPage/SettingsPage.tsx b/frontend/src/pages/pam/SettingsPage/SettingsPage.tsx
deleted file mode 100644
index a81cbb5734..0000000000
--- a/frontend/src/pages/pam/SettingsPage/SettingsPage.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { Helmet } from "react-helmet";
-import { useTranslation } from "react-i18next";
-import { Link, useSearch } from "@tanstack/react-router";
-import { InfoIcon } from "lucide-react";
-
-import { PageHeader } from "@app/components/v2";
-import { ROUTE_PATHS } from "@app/const/routes";
-import { useOrganization } from "@app/context";
-import { ProjectType } from "@app/hooks/api/projects/types";
-import { ProjectGeneralTab } from "@app/pages/project/SettingsPage/components/ProjectGeneralTab";
-
-import { PamRecordingConfigTab } from "./components/PamRecordingConfigTab";
-
-export const SettingsPage = () => {
- const { t } = useTranslation();
- const { currentOrg, isSubOrganization } = useOrganization();
-
- const { selectedTab } = useSearch({
- from: ROUTE_PATHS.Pam.SettingsPage.id
- });
-
- return (
- <div className="flex h-full w-full justify-center bg-bunker-800 text-white">
- <Helmet>
- <title>{t("common.head-title", { title: t("settings.project.title") })}</title>
- </Helmet>
- <div className="w-full max-w-8xl">
- <PageHeader
- scope={ProjectType.PAM}
- title="Project Settings"
- description="Configure your PAM project."
- >
- <Link
- to="/organizations/$orgId/settings"
- params={{
- orgId: currentOrg.id
- }}
- className="flex items-center gap-x-1.5 text-xs whitespace-nowrap text-neutral hover:underline"
- >
- <InfoIcon size={12} /> Looking for {isSubOrganization ? "sub-" : ""}organization
- settings?
- </Link>
- </PageHeader>
- {selectedTab === "tab-project-general" && <ProjectGeneralTab />}
- {selectedTab === "tab-pam-session-recording" && <PamRecordingConfigTab />}
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/SettingsPage/components/PamRecordingConfigTab.tsx b/frontend/src/pages/pam/SettingsPage/components/PamRecordingConfigTab.tsx
deleted file mode 100644
index 25f133874d..0000000000
--- a/frontend/src/pages/pam/SettingsPage/components/PamRecordingConfigTab.tsx
+++ /dev/null
@@ -1,328 +0,0 @@
-import { useEffect, useState } from "react";
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { Link } from "@tanstack/react-router";
-import { AlertTriangleIcon, TrashIcon } from "lucide-react";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Alert,
- AlertDescription,
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogMedia,
- AlertDialogTitle,
- AlertTitle,
- Button,
- Field,
- FieldContent,
- FieldDescription,
- FieldError,
- FieldLabel,
- Input,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue
-} from "@app/components/v3";
-import { useOrganization, useProject } from "@app/context";
-import { AWS_REGIONS } from "@app/helpers/appConnections";
-import { AppConnection } from "@app/hooks/api/appConnections/enums";
-import { useListAvailableAppConnections } from "@app/hooks/api/appConnections/queries";
-import {
- useDeletePamRecordingConfig,
- useGetPamRecordingConfig,
- useUpsertPamRecordingConfig
-} from "@app/hooks/api/pam/recording-config";
-
-const formSchema = z.object({
- storageBackend: z.literal("aws-s3"),
- connectionId: z.string().uuid({ message: "Select an AWS connection" }),
- bucket: z.string().trim().min(1, "Bucket is required").max(255),
- region: z.string().trim().min(1, "Region is required").max(64),
- keyPrefix: z.string().trim().max(255).optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const PamRecordingConfigTab = () => {
- const { currentProject } = useProject();
- const { currentOrg } = useOrganization();
- const projectId = currentProject?.id ?? "";
- const recordingConfig = useGetPamRecordingConfig(projectId);
- const [isDisableDialogOpen, setIsDisableDialogOpen] = useState(false);
-
- const { data: awsConnections, isLoading: connectionsLoading } = useListAvailableAppConnections(
- AppConnection.AWS,
- projectId
- );
-
- const upsertMutation = useUpsertPamRecordingConfig();
- const deleteMutation = useDeletePamRecordingConfig();
-
- const {
- control,
- handleSubmit,
- reset,
- formState: { isSubmitting, isDirty }
- } = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: {
- storageBackend: "aws-s3",
- connectionId: "",
- bucket: "",
- region: "us-east-1",
- keyPrefix: ""
- }
- });
-
- // Defer the reset until BOTH the saved config and the available-connections list have loaded
- useEffect(() => {
- if (recordingConfig.data && awsConnections) {
- reset({
- storageBackend: "aws-s3",
- connectionId: recordingConfig.data.connectionId,
- bucket: recordingConfig.data.bucket,
- region: recordingConfig.data.region,
- keyPrefix: recordingConfig.data.keyPrefix ?? ""
- });
- }
- }, [recordingConfig.data, awsConnections, reset]);
-
- const onSave = handleSubmit(async (values) => {
- const { corsProbeUrl } = await upsertMutation.mutateAsync({
- projectId,
- ...values,
- keyPrefix: values.keyPrefix?.trim() ? values.keyPrefix : null
- });
- createNotification({ type: "success", text: "Session recording configuration saved" });
-
- if (corsProbeUrl) {
- try {
- await fetch(corsProbeUrl, { mode: "cors" });
- } catch {
- createNotification(
- {
- title: "Bucket CORS not configured",
- type: "warning",
- text: (
- <span>
- Session playback requires the bucket to allow GET requests from this origin.{" "}
- <a
- href="https://infisical.com/docs/documentation/platform/pam/product-reference/external-storage#cors-configuration"
- target="_blank"
- rel="noopener noreferrer"
- className="underline hover:opacity-80"
- >
- View CORS setup guide
- </a>
- </span>
- )
- },
- { autoClose: 10000 }
- );
- }
- }
- });
-
- const onDelete = async () => {
- if (!projectId) return;
- await deleteMutation.mutateAsync({ projectId });
- reset({
- storageBackend: "aws-s3",
- connectionId: "",
- bucket: "",
- region: "us-east-1",
- keyPrefix: ""
- });
- setIsDisableDialogOpen(false);
- createNotification({
- type: "success",
- text: "Session recording configuration removed"
- });
- };
-
- return (
- <div className="rounded-lg border border-border bg-container p-6">
- <h2 className="text-xl font-semibold text-foreground">Session Recording</h2>
- <p className="mt-1 text-sm text-muted">Store PAM session recordings in your own S3 bucket.</p>
-
- <Alert variant="warning" className="mt-4">
- <AlertTriangleIcon />
- <AlertTitle>Changing bucket affects existing recordings</AlertTitle>
- <AlertDescription>
- Changing the bucket on a project with existing recordings makes those recordings
- inaccessible unless you manually migrate the objects. Keep the same bucket and key prefix
- when rotating credentials.
- </AlertDescription>
- </Alert>
-
- <form className="mt-6 space-y-4" onSubmit={onSave}>
- <Controller
- control={control}
- name="connectionId"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>AWS Connection</FieldLabel>
- <FieldContent>
- <Select
- disabled={connectionsLoading || !awsConnections?.length}
- value={field.value}
- onValueChange={field.onChange}
- >
- <SelectTrigger className="w-full">
- <SelectValue
- placeholder={
- connectionsLoading ? "Loading connections…" : "Select connection"
- }
- />
- </SelectTrigger>
- <SelectContent position="popper">
- {(awsConnections ?? []).map((conn) => (
- <SelectItem key={conn.id} value={conn.id}>
- {conn.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FieldError>{error?.message}</FieldError>
- </FieldContent>
- </Field>
- )}
- />
- {!connectionsLoading && !awsConnections?.length && (
- <p className="-mt-2 text-xs text-yellow-500">
- No AWS connections available.{" "}
- <Link
- to="/organizations/$orgId/app-connections"
- params={{ orgId: currentOrg?.id ?? "" }}
- className="underline hover:text-yellow-400"
- >
- Create one in Organization Settings
- </Link>
- </p>
- )}
-
- <Controller
- control={control}
- name="bucket"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Bucket</FieldLabel>
- <FieldContent>
- <Input
- {...field}
- placeholder="my-pam-recordings"
- autoComplete="off"
- isError={Boolean(error)}
- />
- <FieldError>{error?.message}</FieldError>
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="region"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Region</FieldLabel>
- <FieldContent>
- <Select value={field.value} onValueChange={field.onChange}>
- <SelectTrigger className="w-full">
- <SelectValue placeholder="Select a region" />
- </SelectTrigger>
- <SelectContent position="popper">
- {AWS_REGIONS.map(({ name, slug }) => (
- <SelectItem key={slug} value={slug}>
- {name} ({slug})
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FieldError>{error?.message}</FieldError>
- </FieldContent>
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="keyPrefix"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel className="inline-flex flex-wrap items-baseline gap-1.5">
- Key Prefix
- <span className="text-xs font-normal text-muted">(optional)</span>
- </FieldLabel>
- <FieldContent>
- <Input
- {...field}
- value={field.value ?? ""}
- placeholder="pam/prod"
- autoComplete="off"
- isError={Boolean(error)}
- />
- <FieldDescription>
- Prepended to every object key. Useful for sharing one bucket across multiple
- projects or environments.
- </FieldDescription>
- <FieldError>{error?.message}</FieldError>
- </FieldContent>
- </Field>
- )}
- />
-
- <div className="flex items-center gap-x-3 pt-2">
- <Button
- variant="project"
- type="submit"
- isPending={upsertMutation.isPending || isSubmitting}
- isDisabled={!isDirty && !!recordingConfig.data}
- >
- {recordingConfig.data ? "Update" : "Save"}
- </Button>
- {recordingConfig.data && (
- <Button
- variant="danger"
- type="button"
- onClick={() => setIsDisableDialogOpen(true)}
- isPending={deleteMutation.isPending}
- >
- Disable Recording
- </Button>
- )}
- </div>
- </form>
-
- <AlertDialog open={isDisableDialogOpen} onOpenChange={setIsDisableDialogOpen}>
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogMedia>
- <TrashIcon />
- </AlertDialogMedia>
- <AlertDialogTitle>Disable Session Recording</AlertDialogTitle>
- <AlertDialogDescription>
- Existing recordings will become inaccessible until you reconfigure with the same
- bucket. Are you sure you want to disable session recording for this project?
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel>Cancel</AlertDialogCancel>
- <AlertDialogAction variant="danger" onClick={onDelete}>
- Disable
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/SettingsPage/route.tsx b/frontend/src/pages/pam/SettingsPage/route.tsx
deleted file mode 100644
index a2b70c13ba..0000000000
--- a/frontend/src/pages/pam/SettingsPage/route.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { createFileRoute, stripSearchParams } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
-
-import { SettingsPage } from "./SettingsPage";
-
-const SettingsPageQueryParams = z.object({
- selectedTab: z.string().catch("tab-project-general")
-});
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings"
-)({
- component: SettingsPage,
- validateSearch: zodValidator(SettingsPageQueryParams),
- search: {
- middlewares: [stripSearchParams({ selectedTab: "" })]
- },
- beforeLoad: ({ context }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Settings"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/pam/components/PamDependenciesTable.tsx b/frontend/src/pages/pam/components/PamDependenciesTable.tsx
deleted file mode 100644
index e235e9c733..0000000000
--- a/frontend/src/pages/pam/components/PamDependenciesTable.tsx
+++ /dev/null
@@ -1,342 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-nocheck -- old PAM page, pending deletion in frontend cleanup
-import { useState } from "react";
-import { format, formatDistance } from "date-fns";
-import {
- ChevronDownIcon,
- ChevronRightIcon,
- CircleHelpIcon,
- EllipsisVerticalIcon,
- TrashIcon
-} from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
-import {
- Badge,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Empty,
- EmptyHeader,
- EmptyTitle,
- IconButton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import type { TPamAccountDependency } from "@app/hooks/api/pam";
-import { useDeletePamAccountDependency, useTogglePamAccountDependency } from "@app/hooks/api/pam";
-
-const DEPENDENCY_TYPE_LABEL: Record<string, string> = {
- "windows-service": "Service",
- "scheduled-task": "Task",
- "iis-app-pool": "App Pool"
-};
-
-const DATA_LABEL_MAP: Record<string, string> = {
- runAsAccount: "Run As Account",
- startMode: "Start Mode",
- processId: "Process ID",
- pathName: "Path",
- description: "Description",
- taskPath: "Task Path",
- logonType: "Logon Type",
- runLevel: "Run Level",
- lastRunTime: "Last Run",
- nextRunTime: "Next Run",
- lastTaskResult: "Last Result",
- triggers: "Triggers",
- actions: "Actions",
- managedRuntimeVersion: "Runtime Version",
- managedPipelineMode: "Pipeline Mode",
- autoStart: "Auto Start",
- identityType: "Identity Type"
-};
-
-const DATA_KEY_ORDER: Record<string, number> = { actions: -2, triggers: -1 };
-
-const formatValue = (key: string, value: unknown): string => {
- if (value === null || value === undefined) return "-";
- if (typeof value === "boolean") return value ? "Yes" : "No";
- if (Array.isArray(value)) return value.length === 0 ? "-" : JSON.stringify(value, null, 2);
- if ((key === "lastRunTime" || key === "nextRunTime") && typeof value === "string") {
- try {
- return format(new Date(value), "MMM d, yyyy HH:mm");
- } catch {
- return String(value);
- }
- }
- return String(value);
-};
-
-type TDependencyItem = TPamAccountDependency & {
- accountName?: string | null;
-};
-
-const DependencyRow = ({
- dep,
- contextColumn,
- colCount,
- toggleMutation,
- onDeleteClick
-}: {
- dep: TDependencyItem;
- contextColumn: { label: string; value: string | null | undefined };
- colCount: number;
- toggleMutation: ReturnType<typeof useTogglePamAccountDependency>;
- onDeleteClick: (dep: TDependencyItem) => void;
-}) => {
- const [isExpanded, setIsExpanded] = useState(false);
-
- const dataEntries = Object.entries(dep.data || {})
- .filter(([, v]) => v !== null && v !== undefined && v !== "")
- .sort((a, b) => (DATA_KEY_ORDER[a[0]] ?? 0) - (DATA_KEY_ORDER[b[0]] ?? 0));
-
- return (
- <>
- <TableRow className="group cursor-pointer" onClick={() => setIsExpanded(!isExpanded)}>
- <TableCell className="w-5">
- {isExpanded ? (
- <ChevronDownIcon className="size-4 text-muted" />
- ) : (
- <ChevronRightIcon className="size-4 text-muted" />
- )}
- </TableCell>
- <TableCell className="font-medium">{dep.displayName || dep.name}</TableCell>
- <TableCell>
- <Badge variant="info">
- {DEPENDENCY_TYPE_LABEL[dep.dependencyType] || dep.dependencyType}
- </Badge>
- </TableCell>
- <TableCell className="text-muted">{contextColumn.value ?? "-"}</TableCell>
- <TableCell className="text-muted">{dep.state ?? "-"}</TableCell>
- <TableCell>
- {dep.isRotationSyncEnabled ? (
- <Badge variant="success">Enabled</Badge>
- ) : (
- <Badge variant="neutral">Disabled</Badge>
- )}
- </TableCell>
- <TableCell>
- <div className="flex items-center gap-2">
- <span className="text-sm text-muted">
- {dep.lastSyncedAt
- ? formatDistance(new Date(dep.lastSyncedAt), new Date(), { addSuffix: true })
- : "Never"}
- </span>
- {dep.syncStatus === "failed" && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge variant="danger" className="text-xs">
- Failed
- </Badge>
- </TooltipTrigger>
- {dep.lastSyncMessage && (
- <TooltipContent className="max-w-sm">{dep.lastSyncMessage}</TooltipContent>
- )}
- </Tooltip>
- )}
- {dep.syncStatus === "pending" && (
- <Badge variant="info" className="animate-pulse text-xs">
- Pending
- </Badge>
- )}
- {dep.syncStatus === "success" && (
- <Badge variant="success" className="text-xs">
- Success
- </Badge>
- )}
- </div>
- </TableCell>
- <TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton variant="ghost" size="xs" onClick={(e) => e.stopPropagation()}>
- <EllipsisVerticalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- toggleMutation.mutate({
- accountId: dep.accountId,
- dependencyId: dep.id,
- isRotationSyncEnabled: !dep.isRotationSyncEnabled
- });
- }}
- >
- {dep.isRotationSyncEnabled ? "Disable Rotation Sync" : "Enable Rotation Sync"}
- </DropdownMenuItem>
- <DropdownMenuItem
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- onDeleteClick(dep);
- }}
- >
- <TrashIcon className="size-4" />
- Delete
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- {isExpanded && (
- <TableRow>
- <TableCell colSpan={colCount} className="bg-mineshaft-700/30 px-6 py-4">
- <div className="grid grid-cols-2 gap-x-8 gap-y-2 text-sm">
- <div className="flex justify-between border-b border-mineshaft-600 py-1">
- <span className="text-muted">Name</span>
- <span className="font-mono text-xs">{dep.name}</span>
- </div>
- <div className="flex justify-between border-b border-mineshaft-600 py-1">
- <span className="text-muted">Source</span>
- <span>{dep.source}</span>
- </div>
- <div className="flex justify-between border-b border-mineshaft-600 py-1">
- <span className="text-muted">{contextColumn.label}</span>
- <span>{contextColumn.value ?? "-"}</span>
- </div>
- <div className="flex justify-between border-b border-mineshaft-600 py-1">
- <span className="text-muted">Last Discovered</span>
- <span>{format(new Date(dep.updatedAt), "MMM d, yyyy HH:mm")}</span>
- </div>
- {dataEntries.map(([key, value]) => (
- <div key={key} className="flex justify-between border-b border-mineshaft-600 py-1">
- <span className="text-muted">{DATA_LABEL_MAP[key] || key}</span>
- {Array.isArray(value) && value.length > 0 ? (
- <pre className="max-h-32 max-w-xs overflow-auto rounded bg-mineshaft-800 px-2 py-1 font-mono text-xs">
- {JSON.stringify(value, null, 2)}
- </pre>
- ) : (
- <span className="font-mono text-xs">{formatValue(key, value)}</span>
- )}
- </div>
- ))}
- </div>
- </TableCell>
- </TableRow>
- )}
- </>
- );
-};
-
-type PamDependenciesTableProps = {
- dependencies: TDependencyItem[] | undefined;
- isPending: boolean;
- contextColumnLabel: string;
- getContextValue: (dep: TDependencyItem) => string | null | undefined;
-};
-
-const COL_COUNT = 8;
-
-export const PamDependenciesTable = ({
- dependencies,
- isPending,
- contextColumnLabel,
- getContextValue
-}: PamDependenciesTableProps) => {
- const toggleMutation = useTogglePamAccountDependency();
- const deleteMutation = useDeletePamAccountDependency();
- const [deleteTarget, setDeleteTarget] = useState<TDependencyItem | null>(null);
-
- const handleDelete = async () => {
- if (!deleteTarget) return;
- try {
- await deleteMutation.mutateAsync({
- accountId: deleteTarget.accountId,
- dependencyId: deleteTarget.id
- });
- createNotification({ text: "Dependency deleted", type: "success" });
- setDeleteTarget(null);
- } catch {
- createNotification({ text: "Failed to delete dependency", type: "error" });
- }
- };
-
- return (
- <>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="w-5" />
- <TableHead>Name</TableHead>
- <TableHead>Type</TableHead>
- <TableHead>{contextColumnLabel}</TableHead>
- <TableHead>State</TableHead>
- <TableHead>
- <div className="flex items-center gap-1">
- Rotation Sync
- <Tooltip>
- <TooltipTrigger asChild>
- <CircleHelpIcon className="size-3.5 text-muted" />
- </TooltipTrigger>
- <TooltipContent side="top" className="max-w-xs">
- When enabled, this dependency&apos;s credentials will be automatically updated
- to match whenever the account password is rotated
- </TooltipContent>
- </Tooltip>
- </div>
- </TableHead>
- <TableHead>Last Synced</TableHead>
- <TableHead className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {isPending && (
- <TableRow>
- <TableCell colSpan={COL_COUNT} className="text-center text-muted">
- Loading dependencies...
- </TableCell>
- </TableRow>
- )}
- {!isPending && (!dependencies || dependencies.length === 0) && (
- <TableRow>
- <TableCell colSpan={COL_COUNT}>
- <Empty className="border-0 bg-transparent py-8 shadow-none">
- <EmptyHeader>
- <EmptyTitle>No dependencies discovered</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- {!isPending &&
- dependencies?.map((dep) => (
- <DependencyRow
- key={dep.id}
- dep={dep}
- contextColumn={{
- label: contextColumnLabel,
- value: getContextValue(dep)
- }}
- colCount={COL_COUNT}
- toggleMutation={toggleMutation}
- onDeleteClick={setDeleteTarget}
- />
- ))}
- </TableBody>
- </Table>
-
- <DeleteActionModal
- isOpen={!!deleteTarget}
- title={`Delete dependency "${deleteTarget?.displayName || deleteTarget?.name}"?`}
- subTitle="This will permanently remove this dependency and break the audit trail for rotation tracking."
- onChange={(isOpen) => {
- if (!isOpen) setDeleteTarget(null);
- }}
- deleteKey="confirm"
- onDeleteApproved={handleDelete}
- />
- </>
- );
-};
diff --git a/frontend/src/pages/pam/components/SshCaSetupModal.tsx b/frontend/src/pages/pam/components/SshCaSetupModal.tsx
deleted file mode 100644
index 89ebaaa0b7..0000000000
--- a/frontend/src/pages/pam/components/SshCaSetupModal.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { faCopy } from "@fortawesome/free-regular-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { createNotification } from "@app/components/notifications";
-import { Button, IconButton, Input, Modal, ModalContent } from "@app/components/v2";
-import { getAuthToken } from "@app/hooks/api/reactQuery";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- resourceId: string;
-};
-
-export const SshCaSetupModal = ({ isOpen, onOpenChange, resourceId }: Props) => {
- const { protocol, hostname, port } = window.location;
- const portSuffix = port && port !== "80" ? `:${port}` : "";
- const siteURL = `${protocol}//${hostname}${portSuffix}`;
-
- const setupSshCaCommand = `curl -H "Authorization: Bearer ${getAuthToken()}" "${siteURL}/api/v1/pam/resources/ssh/${resourceId}/ssh-ca-setup" | sudo bash`;
-
- const handleCopy = () => {
- navigator.clipboard.writeText(setupSshCaCommand);
- createNotification({
- text: "Command copied to clipboard",
- type: "info"
- });
- };
-
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent
- className="max-w-2xl"
- title="Certificate Authentication Setup (Optional)"
- subTitle="If you're using certificate-based authentication, configure the target host to trust the CA certificate."
- >
- <div className="flex flex-col">
- <span className="text-sm text-mineshaft-300">Run this command on the target host:</span>
- <div className="mt-2 flex items-center gap-1">
- <Input value={setupSshCaCommand} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="plain"
- colorSchema="secondary"
- size="sm"
- onClick={handleCopy}
- className="size-8 shrink-0"
- >
- <FontAwesomeIcon icon={faCopy} className="text-mineshaft-200" />
- </IconButton>
- </div>
- <div className="mt-4 flex flex-col gap-1 text-sm text-mineshaft-300">
- <span>This command will:</span>
- <span>• Install the resource CA certificate</span>
- <span>• Configure SSH to trust certificate-based authentication</span>
- <span>• Enable seamless access for authorized users</span>
- </div>
- </div>
- <div className="mt-6 flex justify-end">
- <Button colorSchema="secondary" onClick={() => onOpenChange(false)}>
- Close
- </Button>
- </div>
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/components/SshCaSetupSection.tsx b/frontend/src/pages/pam/components/SshCaSetupSection.tsx
deleted file mode 100644
index e435d0e32f..0000000000
--- a/frontend/src/pages/pam/components/SshCaSetupSection.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import { useState } from "react";
-import { faCopy } from "@fortawesome/free-regular-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { ChevronDownIcon, ShieldIcon } from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import { createNotification } from "@app/components/notifications";
-import { IconButton, Input } from "@app/components/v2";
-import { getAuthToken } from "@app/hooks/api/reactQuery";
-
-type Props = {
- resourceId: string;
- isOptional?: boolean;
- className?: string;
-};
-
-export const SshCaSetupSection = ({ resourceId, isOptional = false, className }: Props) => {
- const { protocol, hostname, port } = window.location;
- const portSuffix = port && port !== "80" ? `:${port}` : "";
- const siteURL = `${protocol}//${hostname}${portSuffix}`;
-
- const [cmdOpen, setCmdOpen] = useState(false);
-
- const setupSshCaCommand = `curl -H "Authorization: Bearer ${getAuthToken()}" "${siteURL}/api/v1/pam/resources/ssh/${resourceId}/ssh-ca-setup" | sudo bash`;
-
- return (
- <button
- type="button"
- onClick={() => setCmdOpen(!cmdOpen)}
- className={twMerge(
- "flex w-full cursor-pointer flex-col rounded-md border border-mineshaft-500 bg-mineshaft-700 p-3 text-sm hover:bg-mineshaft-600",
- className
- )}
- >
- <div className="flex gap-2.5">
- <ShieldIcon className="mt-0.5 size-6 shrink-0 text-info" />
- <div className="flex w-full flex-col">
- <div className="flex justify-between gap-2 pr-1">
- <div className="flex flex-col text-left">
- <span className="text-base">Certificate-Based Authentication</span>
- <span className="text-sm text-mineshaft-300">
- {isOptional
- ? "Optional: Install CA certificate if you plan to use certificate authentication for user accounts"
- : "Required: Install CA certificate on the target host for certificate authentication"}
- </span>
- </div>
- <ChevronDownIcon
- className={twMerge(
- "shrink-0 text-mineshaft-400 transition-transform duration-200 ease-in-out",
- cmdOpen && "rotate-180"
- )}
- />
- </div>
- <div
- className={twMerge(
- "grid transition-all duration-200 ease-in-out",
- cmdOpen ? "mt-2 grid-rows-[1fr]" : "mt-0 grid-rows-[0fr]"
- )}
- >
- <div className="overflow-hidden">
- <div className="flex flex-col text-left">
- <span className="mt-2 text-sm text-mineshaft-300">
- Run this command on the target host:
- </span>
- <div className="mt-1 flex items-center gap-1">
- <Input value={setupSshCaCommand} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="plain"
- colorSchema="secondary"
- size="sm"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(setupSshCaCommand);
- createNotification({
- text: "Command copied to clipboard",
- type: "info"
- });
- }}
- className="size-8 shrink-0"
- >
- <FontAwesomeIcon icon={faCopy} className="text-mineshaft-200" />
- </IconButton>
- </div>
- <div className="mt-4 flex flex-col gap-1 text-xs text-mineshaft-300">
- <span>This command will:</span>
- <span>• Install the resource CA certificate</span>
- <span>• Configure SSH to trust certificate-based authentication</span>
- <span>• Enable seamless access for authorized users</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </button>
- );
-};
diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts
index 68d592d63c..eb886f7a8d 100644
--- a/frontend/src/routeTree.gen.ts
+++ b/frontend/src/routeTree.gen.ts
@@ -121,9 +121,6 @@ import { Route as secretManagerOverviewPageRouteImport } from './pages/secret-ma
import { Route as secretManagerInsightsPageRouteImport } from './pages/secret-manager/InsightsPage/route'
import { Route as secretManagerSecretApprovalsPageRouteImport } from './pages/secret-manager/SecretApprovalsPage/route'
import { Route as secretManagerIPAllowlistPageRouteImport } from './pages/secret-manager/IPAllowlistPage/route'
-import { Route as pamSettingsPageRouteImport } from './pages/pam/SettingsPage/route'
-import { Route as pamInsightsPageRouteImport } from './pages/pam/InsightsPage/route'
-import { Route as pamPamAccountPoliciesPageRouteImport } from './pages/pam/PamAccountPoliciesPage/route'
import { Route as kmsSettingsPageRouteImport } from './pages/kms/SettingsPage/route'
import { Route as kmsOverviewPageRouteImport } from './pages/kms/OverviewPage/route'
import { Route as kmsKmipPageRouteImport } from './pages/kms/KmipPage/route'
@@ -171,7 +168,6 @@ import { Route as secretManagerSecretDashboardPageRouteImport } from './pages/se
import { Route as secretManagerIntegrationsSelectIntegrationAuthPageRouteImport } from './pages/secret-manager/integrations/SelectIntegrationAuthPage/route'
import { Route as secretManagerIntegrationsDetailsByIDPageRouteImport } from './pages/secret-manager/IntegrationsDetailsByIDPage/route'
import { Route as pamPamSessionsByIDPageRouteImport } from './pages/pam/PamSessionsByIDPage/route'
-import { Route as pamApprovalRequestDetailPageRouteImport } from './pages/pam/ApprovalRequestDetailPage/route'
import { Route as certManagerPkiSubscriberDetailsByIDPageRouteImport } from './pages/cert-manager/PkiSubscriberDetailsByIDPage/route'
import { Route as certManagerPkiSyncDetailsByIDPageRouteImport } from './pages/cert-manager/PkiSyncDetailsByIDPage/route'
import { Route as certManagerDiscoveryDetailsByIDPageRouteImport } from './pages/cert-manager/DiscoveryDetailsByIDPage/route'
@@ -187,10 +183,6 @@ import { Route as aiMCPEndpointDetailPageRouteImport } from './pages/ai/MCPEndpo
import { Route as secretScanningSecretScanningDataSourcesPageRouteImport } from './pages/secret-scanning/SecretScanningDataSourcesPage/route'
import { Route as secretManagerIntegrationsListPageRouteImport } from './pages/secret-manager/IntegrationsListPage/route'
import { Route as pamPamSessionsPageRouteImport } from './pages/pam/PamSessionsPage/route'
-import { Route as pamPamResourcesPageRouteImport } from './pages/pam/PamResourcesPage/route'
-import { Route as pamPamDomainsPageRouteImport } from './pages/pam/PamDomainsPage/route'
-import { Route as pamPamDiscoveryPageRouteImport } from './pages/pam/PamDiscoveryPage/route'
-import { Route as pamApprovalsPageRouteImport } from './pages/pam/ApprovalsPage/route'
import { Route as certManagerPkiSubscribersPageRouteImport } from './pages/cert-manager/PkiSubscribersPage/route'
import { Route as certManagerIntegrationsListPageRouteImport } from './pages/cert-manager/IntegrationsListPage/route'
import { Route as certManagerDiscoveryPageRouteImport } from './pages/cert-manager/DiscoveryPage/route'
@@ -264,7 +256,6 @@ import { Route as secretManagerIntegrationsAwsSecretManagerConfigurePageRouteImp
import { Route as secretManagerIntegrationsAwsSecretManagerAuthorizePageRouteImport } from './pages/secret-manager/integrations/AwsSecretManagerAuthorizePage/route'
import { Route as secretManagerIntegrationsAwsParameterStoreConfigurePageRouteImport } from './pages/secret-manager/integrations/AwsParameterStoreConfigurePage/route'
import { Route as secretManagerIntegrationsAwsParameterStoreAuthorizePageRouteImport } from './pages/secret-manager/integrations/AwsParameterStoreAuthorizePage/route'
-import { Route as pamPamDiscoveryDetailPageRouteImport } from './pages/pam/PamDiscoveryDetailPage/route'
import { Route as certManagerInstallationDetailsByIDPageRouteImport } from './pages/cert-manager/InstallationDetailsByIDPage/route'
import { Route as secretManagerIntegrationsVercelOauthCallbackPageRouteImport } from './pages/secret-manager/integrations/VercelOauthCallbackPage/route'
import { Route as secretManagerSecretSyncDetailsByIDPageRouteImport } from './pages/secret-manager/SecretSyncDetailsByIDPage/route'
@@ -277,12 +268,8 @@ import { Route as secretManagerIntegrationsBitbucketOauthCallbackPageRouteImport
import { Route as secretManagerIntegrationsAzureKeyVaultOauthCallbackPageRouteImport } from './pages/secret-manager/integrations/AzureKeyVaultOauthCallbackPage/route'
import { Route as secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteImport } from './pages/secret-manager/integrations/AzureAppConfigurationOauthCallbackPage/route'
import { Route as secretManagerCommitsPageRouteImport } from './pages/secret-manager/CommitsPage/route'
-import { Route as pamPamResourceByIDPageRouteImport } from './pages/pam/PamResourceByIDPage/route'
-import { Route as pamPamDomainByIDPageRouteImport } from './pages/pam/PamDomainByIDPage/route'
import { Route as secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteImport } from './pages/secret-manager/CommitDetailsPage/components/RollbackPreviewTab/route'
import { Route as secretManagerCommitDetailsPageRouteImport } from './pages/secret-manager/CommitDetailsPage/route'
-import { Route as pamPamAccountByIDPageRouteImport } from './pages/pam/PamAccountByIDPage/route'
-import { Route as pamPamDomainAccountByIDPageRouteImport } from './pages/pam/PamDomainAccountByIDPage/route'
// Create Virtual Routes
@@ -369,22 +356,6 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions',
)()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources',
- )()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains',
- )()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery',
- )()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals',
- )()
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdCertManagerLayoutSubscribersImport =
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers',
@@ -417,26 +388,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManag
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId',
)()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId',
- )()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId',
- )()
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdImport =
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId',
)()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId',
- )()
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport =
- createFileRoute(
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId',
- )()
// Create/Update Routes
@@ -1240,33 +1195,6 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
} as any,
)
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesImport.update(
- {
- id: '/resources',
- path: '/resources',
- getParentRoute: () => pamLayoutRoute,
- } as any,
- )
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport.update(
- {
- id: '/domains',
- path: '/domains',
- getParentRoute: () => pamLayoutRoute,
- } as any,
- )
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport.update(
- {
- id: '/discovery',
- path: '/discovery',
- getParentRoute: () => pamLayoutRoute,
- } as any,
- )
-
const projectAuditLogsPageRoutePamRoute =
projectAuditLogsPageRoutePamImport.update({
id: '/audit-logs',
@@ -1274,15 +1202,6 @@ const projectAuditLogsPageRoutePamRoute =
getParentRoute: () => pamLayoutRoute,
} as any)
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsImport.update(
- {
- id: '/approvals',
- path: '/approvals',
- getParentRoute: () => pamLayoutRoute,
- } as any,
- )
-
const projectAccessControlPageRoutePamRoute =
projectAccessControlPageRoutePamImport.update({
id: '/access-management',
@@ -1482,25 +1401,6 @@ const secretManagerIPAllowlistPageRouteRoute =
getParentRoute: () => secretManagerLayoutRoute,
} as any)
-const pamSettingsPageRouteRoute = pamSettingsPageRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => pamLayoutRoute,
-} as any)
-
-const pamInsightsPageRouteRoute = pamInsightsPageRouteImport.update({
- id: '/insights',
- path: '/insights',
- getParentRoute: () => pamLayoutRoute,
-} as any)
-
-const pamPamAccountPoliciesPageRouteRoute =
- pamPamAccountPoliciesPageRouteImport.update({
- id: '/account-policies',
- path: '/account-policies',
- getParentRoute: () => pamLayoutRoute,
- } as any)
-
const kmsSettingsPageRouteRoute = kmsSettingsPageRouteImport.update({
id: '/settings',
path: '/settings',
@@ -1827,14 +1727,6 @@ const pamPamSessionsByIDPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRoute,
} as any)
-const pamApprovalRequestDetailPageRouteRoute =
- pamApprovalRequestDetailPageRouteImport.update({
- id: '/$approvalRequestId',
- path: '/$approvalRequestId',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRoute,
- } as any)
-
const certManagerPkiSubscriberDetailsByIDPageRouteRoute =
certManagerPkiSubscriberDetailsByIDPageRouteImport.update({
id: '/$subscriberName',
@@ -1949,34 +1841,6 @@ const pamPamSessionsPageRouteRoute = pamPamSessionsPageRouteImport.update({
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRoute,
} as any)
-const pamPamResourcesPageRouteRoute = pamPamResourcesPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute,
-} as any)
-
-const pamPamDomainsPageRouteRoute = pamPamDomainsPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute,
-} as any)
-
-const pamPamDiscoveryPageRouteRoute = pamPamDiscoveryPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute,
-} as any)
-
-const pamApprovalsPageRouteRoute = pamApprovalsPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRoute,
-} as any)
-
const certManagerPkiSubscribersPageRouteRoute =
certManagerPkiSubscribersPageRouteImport.update({
id: '/',
@@ -2042,26 +1906,6 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManag
} as any,
)
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdImport.update(
- {
- id: '/$resourceType/$resourceId',
- path: '/$resourceType/$resourceId',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute,
- } as any,
- )
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport.update(
- {
- id: '/$domainType/$domainId',
- path: '/$domainType/$domainId',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute,
- } as any,
- )
-
const secretScanningSecretScanningDataSourceByIdPageRouteRoute =
secretScanningSecretScanningDataSourceByIdPageRouteImport.update({
id: '/$type/$dataSourceId',
@@ -2596,14 +2440,6 @@ const secretManagerIntegrationsAwsParameterStoreAuthorizePageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutIntegrationsRoute,
} as any)
-const pamPamDiscoveryDetailPageRouteRoute =
- pamPamDiscoveryDetailPageRouteImport.update({
- id: '/$discoveryType/$discoverySourceId',
- path: '/$discoveryType/$discoverySourceId',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute,
- } as any)
-
const certManagerInstallationDetailsByIDPageRouteRoute =
certManagerInstallationDetailsByIDPageRouteImport.update({
id: '/installations/$installationId',
@@ -2712,41 +2548,6 @@ const secretManagerCommitsPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdRoute,
} as any)
-const pamPamResourceByIDPageRouteRoute =
- pamPamResourceByIDPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute,
- } as any)
-
-const pamPamDomainByIDPageRouteRoute = pamPamDomainByIDPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute,
-} as any)
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdImport.update(
- {
- id: '/accounts/$accountId',
- path: '/accounts/$accountId',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute,
- } as any,
- )
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport.update(
- {
- id: '/accounts/$accountId',
- path: '/accounts/$accountId',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute,
- } as any,
- )
-
const secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute =
secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteImport.update({
id: '/restore',
@@ -2763,23 +2564,6 @@ const secretManagerCommitDetailsPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdRoute,
} as any)
-const pamPamAccountByIDPageRouteRoute = pamPamAccountByIDPageRouteImport.update(
- {
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRoute,
- } as any,
-)
-
-const pamPamDomainAccountByIDPageRouteRoute =
- pamPamDomainAccountByIDPageRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute,
- } as any)
-
// Populate the FileRoutesByPath interface
declare module '@tanstack/react-router' {
@@ -3554,27 +3338,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof kmsSettingsPageRouteImport
parentRoute: typeof kmsLayoutImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies'
- path: '/account-policies'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/account-policies'
- preLoaderRoute: typeof pamPamAccountPoliciesPageRouteImport
- parentRoute: typeof pamLayoutImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights'
- path: '/insights'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/insights'
- preLoaderRoute: typeof pamInsightsPageRouteImport
- parentRoute: typeof pamLayoutImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings'
- path: '/settings'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/settings'
- preLoaderRoute: typeof pamSettingsPageRouteImport
- parentRoute: typeof pamLayoutImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/allowlist': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/allowlist'
path: '/allowlist'
@@ -3764,13 +3527,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof projectAccessControlPageRoutePamImport
parentRoute: typeof pamLayoutImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals'
- path: '/approvals'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/approvals'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsImport
- parentRoute: typeof pamLayoutImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs'
path: '/audit-logs'
@@ -3778,27 +3534,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof projectAuditLogsPageRoutePamImport
parentRoute: typeof pamLayoutImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery'
- path: '/discovery'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/discovery'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport
- parentRoute: typeof pamLayoutImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains'
- path: '/domains'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/domains'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport
- parentRoute: typeof pamLayoutImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources'
- path: '/resources'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/resources'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesImport
- parentRoute: typeof pamLayoutImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions'
path: '/sessions'
@@ -3925,34 +3660,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof certManagerPkiSubscribersPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdCertManagerLayoutSubscribersImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/approvals/'
- preLoaderRoute: typeof pamApprovalsPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/discovery/'
- preLoaderRoute: typeof pamPamDiscoveryPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/'
- preLoaderRoute: typeof pamPamDomainsPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/resources/'
- preLoaderRoute: typeof pamPamResourcesPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/'
path: '/'
@@ -4058,13 +3765,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof certManagerPkiSubscriberDetailsByIDPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdCertManagerLayoutSubscribersImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId'
- path: '/$approvalRequestId'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId'
- preLoaderRoute: typeof pamApprovalRequestDetailPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId'
path: '/$sessionId'
@@ -4317,13 +4017,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof certManagerInstallationDetailsByIDPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdCertManagerLayoutDiscoveryImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId'
- path: '/$discoveryType/$discoverySourceId'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId'
- preLoaderRoute: typeof pamPamDiscoveryDetailPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/authorize': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/authorize'
path: '/aws-parameter-store/authorize'
@@ -4786,20 +4479,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof secretScanningSecretScanningDataSourceByIdPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretScanningProjectIdSecretScanningLayoutDataSourcesImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId'
- path: '/$domainType/$domainId'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId'
- path: '/$resourceType/$resourceId'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId'
path: '/commits/$environment/$folderId'
@@ -4807,20 +4486,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdImport
parentRoute: typeof secretManagerLayoutImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/'
- preLoaderRoute: typeof pamPamDomainByIDPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/'
- preLoaderRoute: typeof pamPamResourceByIDPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/'
path: '/'
@@ -4919,34 +4584,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId'
- path: '/accounts/$accountId'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId'
- path: '/accounts/$accountId'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId'
- preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId/'
- preLoaderRoute: typeof pamPamDomainAccountByIDPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport
- }
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/'
- path: '/'
- fullPath: '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/'
- preLoaderRoute: typeof pamPamAccountByIDPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdImport
- }
}
}
@@ -5324,136 +4961,6 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServ
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteChildren,
)
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteChildren {
- pamApprovalsPageRouteRoute: typeof pamApprovalsPageRouteRoute
- pamApprovalRequestDetailPageRouteRoute: typeof pamApprovalRequestDetailPageRouteRoute
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteChildren =
- {
- pamApprovalsPageRouteRoute: pamApprovalsPageRouteRoute,
- pamApprovalRequestDetailPageRouteRoute:
- pamApprovalRequestDetailPageRouteRoute,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteChildren {
- pamPamDiscoveryPageRouteRoute: typeof pamPamDiscoveryPageRouteRoute
- pamPamDiscoveryDetailPageRouteRoute: typeof pamPamDiscoveryDetailPageRouteRoute
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteChildren =
- {
- pamPamDiscoveryPageRouteRoute: pamPamDiscoveryPageRouteRoute,
- pamPamDiscoveryDetailPageRouteRoute: pamPamDiscoveryDetailPageRouteRoute,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren {
- pamPamDomainAccountByIDPageRouteRoute: typeof pamPamDomainAccountByIDPageRouteRoute
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren =
- {
- pamPamDomainAccountByIDPageRouteRoute:
- pamPamDomainAccountByIDPageRouteRoute,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren {
- pamPamDomainByIDPageRouteRoute: typeof pamPamDomainByIDPageRouteRoute
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren =
- {
- pamPamDomainByIDPageRouteRoute: pamPamDomainByIDPageRouteRoute,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren {
- pamPamDomainsPageRouteRoute: typeof pamPamDomainsPageRouteRoute
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren =
- {
- pamPamDomainsPageRouteRoute: pamPamDomainsPageRouteRoute,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteChildren {
- pamPamAccountByIDPageRouteRoute: typeof pamPamAccountByIDPageRouteRoute
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteChildren =
- {
- pamPamAccountByIDPageRouteRoute: pamPamAccountByIDPageRouteRoute,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteChildren {
- pamPamResourceByIDPageRouteRoute: typeof pamPamResourceByIDPageRouteRoute
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteChildren =
- {
- pamPamResourceByIDPageRouteRoute: pamPamResourceByIDPageRouteRoute,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteChildren,
- )
-
-interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteChildren {
- pamPamResourcesPageRouteRoute: typeof pamPamResourcesPageRouteRoute
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren
-}
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteChildren =
- {
- pamPamResourcesPageRouteRoute: pamPamResourcesPageRouteRoute,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren,
- }
-
-const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren =
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute._addFileChildren(
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteChildren,
- )
-
interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteChildren {
pamPamSessionsPageRouteRoute: typeof pamPamSessionsPageRouteRoute
pamPamSessionsByIDPageRouteRoute: typeof pamPamSessionsByIDPageRouteRoute
@@ -5471,15 +4978,8 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
)
interface pamLayoutRouteChildren {
- pamPamAccountPoliciesPageRouteRoute: typeof pamPamAccountPoliciesPageRouteRoute
- pamInsightsPageRouteRoute: typeof pamInsightsPageRouteRoute
- pamSettingsPageRouteRoute: typeof pamSettingsPageRouteRoute
projectAccessControlPageRoutePamRoute: typeof projectAccessControlPageRoutePamRoute
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteWithChildren
projectAuditLogsPageRoutePamRoute: typeof projectAuditLogsPageRoutePamRoute
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren
projectGroupDetailsByIDPageRoutePamRoute: typeof projectGroupDetailsByIDPageRoutePamRoute
projectIdentityDetailsByIDPageRoutePamRoute: typeof projectIdentityDetailsByIDPageRoutePamRoute
@@ -5488,19 +4988,8 @@ interface pamLayoutRouteChildren {
}
const pamLayoutRouteChildren: pamLayoutRouteChildren = {
- pamPamAccountPoliciesPageRouteRoute: pamPamAccountPoliciesPageRouteRoute,
- pamInsightsPageRouteRoute: pamInsightsPageRouteRoute,
- pamSettingsPageRouteRoute: pamSettingsPageRouteRoute,
projectAccessControlPageRoutePamRoute: projectAccessControlPageRoutePamRoute,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteWithChildren,
projectAuditLogsPageRoutePamRoute: projectAuditLogsPageRoutePamRoute,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren,
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute:
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren,
projectGroupDetailsByIDPageRoutePamRoute:
@@ -6480,9 +5969,6 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/kms/$projectId/kmip': typeof kmsKmipPageRouteRoute
'/organizations/$orgId/projects/kms/$projectId/overview': typeof kmsOverviewPageRouteRoute
'/organizations/$orgId/projects/kms/$projectId/settings': typeof kmsSettingsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/account-policies': typeof pamPamAccountPoliciesPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/insights': typeof pamInsightsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/settings': typeof pamSettingsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/allowlist': typeof secretManagerIPAllowlistPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/approval': typeof secretManagerSecretApprovalsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/insights': typeof secretManagerInsightsPageRouteRoute
@@ -6510,11 +5996,7 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/kms/$projectId/access-management': typeof projectAccessControlPageRouteKmsRoute
'/organizations/$orgId/projects/kms/$projectId/audit-logs': typeof projectAuditLogsPageRouteKmsRoute
'/organizations/$orgId/projects/pam/$projectId/access-management': typeof projectAccessControlPageRoutePamRoute
- '/organizations/$orgId/projects/pam/$projectId/approvals': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteWithChildren
'/organizations/$orgId/projects/pam/$projectId/audit-logs': typeof projectAuditLogsPageRoutePamRoute
- '/organizations/$orgId/projects/pam/$projectId/discovery': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren
- '/organizations/$orgId/projects/pam/$projectId/domains': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren
- '/organizations/$orgId/projects/pam/$projectId/resources': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren
'/organizations/$orgId/projects/pam/$projectId/sessions': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren
'/organizations/$orgId/projects/secret-management/$projectId/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
'/organizations/$orgId/projects/secret-management/$projectId/app-connections': typeof projectAppConnectionsPageRouteSecretManagerRoute
@@ -6533,10 +6015,6 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/cert-manager/$projectId/discovery/': typeof certManagerDiscoveryPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/integrations/': typeof certManagerIntegrationsListPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/approvals/': typeof pamApprovalsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/discovery/': typeof pamPamDiscoveryPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/domains/': typeof pamPamDomainsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/resources/': typeof pamPamResourcesPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions/': typeof pamPamSessionsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/': typeof secretManagerIntegrationsListPageRouteRoute
'/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/': typeof secretScanningSecretScanningDataSourcesPageRouteRoute
@@ -6552,7 +6030,6 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/cert-manager/$projectId/discovery/$discoveryId': typeof certManagerDiscoveryDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/integrations/$syncId': typeof certManagerPkiSyncDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId': typeof pamApprovalRequestDetailPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId': typeof pamPamSessionsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
@@ -6589,7 +6066,6 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/ssh/$projectId/members/$membershipId': typeof projectMemberDetailsByIDPageRouteSshRoute
'/organizations/$orgId/projects/ssh/$projectId/roles/$roleSlug': typeof projectRoleDetailsBySlugPageRouteSshRoute
'/organizations/$orgId/projects/cert-manager/$projectId/discovery/installations/$installationId': typeof certManagerInstallationDetailsByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId': typeof pamPamDiscoveryDetailPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/authorize': typeof secretManagerIntegrationsAwsParameterStoreAuthorizePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/create': typeof secretManagerIntegrationsAwsParameterStoreConfigurePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-secret-manager/authorize': typeof secretManagerIntegrationsAwsSecretManagerAuthorizePageRouteRoute
@@ -6656,11 +6132,7 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize': typeof secretManagerIntegrationsWindmillAuthorizePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create': typeof secretManagerIntegrationsWindmillConfigurePageRouteRoute
'/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId': typeof secretScanningSecretScanningDataSourceByIdPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren
- '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdRouteWithChildren
- '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/': typeof pamPamDomainByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/': typeof pamPamResourceByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/': typeof secretManagerCommitsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-key-vault/oauth2/callback': typeof secretManagerIntegrationsAzureKeyVaultOauthCallbackPageRouteRoute
@@ -6675,10 +6147,6 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdRouteWithChildren
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/': typeof secretManagerCommitDetailsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore': typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren
- '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren
- '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId/': typeof pamPamDomainAccountByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/': typeof pamPamAccountByIDPageRouteRoute
}
export interface FileRoutesByTo {
@@ -6771,9 +6239,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/kms/$projectId/kmip': typeof kmsKmipPageRouteRoute
'/organizations/$orgId/projects/kms/$projectId/overview': typeof kmsOverviewPageRouteRoute
'/organizations/$orgId/projects/kms/$projectId/settings': typeof kmsSettingsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/account-policies': typeof pamPamAccountPoliciesPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/insights': typeof pamInsightsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/settings': typeof pamSettingsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/allowlist': typeof secretManagerIPAllowlistPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/approval': typeof secretManagerSecretApprovalsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/insights': typeof secretManagerInsightsPageRouteRoute
@@ -6809,10 +6274,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/cert-manager/$projectId/discovery': typeof certManagerDiscoveryPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/integrations': typeof certManagerIntegrationsListPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers': typeof certManagerPkiSubscribersPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/approvals': typeof pamApprovalsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/discovery': typeof pamPamDiscoveryPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/domains': typeof pamPamDomainsPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/resources': typeof pamPamResourcesPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions': typeof pamPamSessionsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations': typeof secretManagerIntegrationsListPageRouteRoute
'/organizations/$orgId/projects/secret-scanning/$projectId/data-sources': typeof secretScanningSecretScanningDataSourcesPageRouteRoute
@@ -6828,7 +6289,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/cert-manager/$projectId/discovery/$discoveryId': typeof certManagerDiscoveryDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/integrations/$syncId': typeof certManagerPkiSyncDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId': typeof pamApprovalRequestDetailPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId': typeof pamPamSessionsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
@@ -6865,7 +6325,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/ssh/$projectId/members/$membershipId': typeof projectMemberDetailsByIDPageRouteSshRoute
'/organizations/$orgId/projects/ssh/$projectId/roles/$roleSlug': typeof projectRoleDetailsBySlugPageRouteSshRoute
'/organizations/$orgId/projects/cert-manager/$projectId/discovery/installations/$installationId': typeof certManagerInstallationDetailsByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId': typeof pamPamDiscoveryDetailPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/authorize': typeof secretManagerIntegrationsAwsParameterStoreAuthorizePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/create': typeof secretManagerIntegrationsAwsParameterStoreConfigurePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-secret-manager/authorize': typeof secretManagerIntegrationsAwsSecretManagerAuthorizePageRouteRoute
@@ -6932,8 +6391,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize': typeof secretManagerIntegrationsWindmillAuthorizePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create': typeof secretManagerIntegrationsWindmillConfigurePageRouteRoute
'/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId': typeof secretScanningSecretScanningDataSourceByIdPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId': typeof pamPamDomainByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId': typeof pamPamResourceByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId': typeof secretManagerCommitsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-key-vault/oauth2/callback': typeof secretManagerIntegrationsAzureKeyVaultOauthCallbackPageRouteRoute
@@ -6947,8 +6404,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/secret-management/$projectId/integrations/vercel/oauth2/callback': typeof secretManagerIntegrationsVercelOauthCallbackPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId': typeof secretManagerCommitDetailsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore': typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId': typeof pamPamDomainAccountByIDPageRouteRoute
- '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId': typeof pamPamAccountByIDPageRouteRoute
}
export interface FileRoutesById {
@@ -7063,9 +6518,6 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/kmip': typeof kmsKmipPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/overview': typeof kmsOverviewPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/settings': typeof kmsSettingsPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies': typeof pamPamAccountPoliciesPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights': typeof pamInsightsPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings': typeof pamSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/allowlist': typeof secretManagerIPAllowlistPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/approval': typeof secretManagerSecretApprovalsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/insights': typeof secretManagerInsightsPageRouteRoute
@@ -7093,11 +6545,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/access-management': typeof projectAccessControlPageRouteKmsRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/audit-logs': typeof projectAuditLogsPageRouteKmsRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/access-management': typeof projectAccessControlPageRoutePamRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs': typeof projectAuditLogsPageRoutePamRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/app-connections': typeof projectAppConnectionsPageRouteSecretManagerRoute
@@ -7116,10 +6564,6 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery/': typeof certManagerDiscoveryPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/': typeof certManagerIntegrationsListPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/': typeof pamApprovalsPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/': typeof pamPamDiscoveryPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/': typeof pamPamDomainsPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/': typeof pamPamResourcesPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/': typeof pamPamSessionsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/': typeof secretManagerIntegrationsListPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources/': typeof secretScanningSecretScanningDataSourcesPageRouteRoute
@@ -7135,7 +6579,6 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery/$discoveryId': typeof certManagerDiscoveryDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/$syncId': typeof certManagerPkiSyncDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId': typeof pamApprovalRequestDetailPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId': typeof pamPamSessionsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
@@ -7172,7 +6615,6 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/members/$membershipId': typeof projectMemberDetailsByIDPageRouteSshRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/roles/$roleSlug': typeof projectRoleDetailsBySlugPageRouteSshRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery/installations/$installationId': typeof certManagerInstallationDetailsByIDPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId': typeof pamPamDiscoveryDetailPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/authorize': typeof secretManagerIntegrationsAwsParameterStoreAuthorizePageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/create': typeof secretManagerIntegrationsAwsParameterStoreConfigurePageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-secret-manager/authorize': typeof secretManagerIntegrationsAwsSecretManagerAuthorizePageRouteRoute
@@ -7239,11 +6681,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/authorize': typeof secretManagerIntegrationsWindmillAuthorizePageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/create': typeof secretManagerIntegrationsWindmillConfigurePageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources/$type/$dataSourceId': typeof secretScanningSecretScanningDataSourceByIdPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdRouteWithChildren
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/': typeof pamPamDomainByIDPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/': typeof pamPamResourceByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/': typeof secretManagerCommitsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/azure-key-vault/oauth2/callback': typeof secretManagerIntegrationsAzureKeyVaultOauthCallbackPageRouteRoute
@@ -7258,10 +6696,6 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/': typeof secretManagerCommitDetailsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/restore': typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/': typeof pamPamDomainAccountByIDPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/': typeof pamPamAccountByIDPageRouteRoute
}
export interface FileRouteTypes {
@@ -7365,9 +6799,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/kms/$projectId/kmip'
| '/organizations/$orgId/projects/kms/$projectId/overview'
| '/organizations/$orgId/projects/kms/$projectId/settings'
- | '/organizations/$orgId/projects/pam/$projectId/account-policies'
- | '/organizations/$orgId/projects/pam/$projectId/insights'
- | '/organizations/$orgId/projects/pam/$projectId/settings'
| '/organizations/$orgId/projects/secret-management/$projectId/allowlist'
| '/organizations/$orgId/projects/secret-management/$projectId/approval'
| '/organizations/$orgId/projects/secret-management/$projectId/insights'
@@ -7395,11 +6826,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/kms/$projectId/access-management'
| '/organizations/$orgId/projects/kms/$projectId/audit-logs'
| '/organizations/$orgId/projects/pam/$projectId/access-management'
- | '/organizations/$orgId/projects/pam/$projectId/approvals'
| '/organizations/$orgId/projects/pam/$projectId/audit-logs'
- | '/organizations/$orgId/projects/pam/$projectId/discovery'
- | '/organizations/$orgId/projects/pam/$projectId/domains'
- | '/organizations/$orgId/projects/pam/$projectId/resources'
| '/organizations/$orgId/projects/pam/$projectId/sessions'
| '/organizations/$orgId/projects/secret-management/$projectId/access-management'
| '/organizations/$orgId/projects/secret-management/$projectId/app-connections'
@@ -7418,10 +6845,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/discovery/'
| '/organizations/$orgId/projects/cert-manager/$projectId/integrations/'
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/'
- | '/organizations/$orgId/projects/pam/$projectId/approvals/'
- | '/organizations/$orgId/projects/pam/$projectId/discovery/'
- | '/organizations/$orgId/projects/pam/$projectId/domains/'
- | '/organizations/$orgId/projects/pam/$projectId/resources/'
| '/organizations/$orgId/projects/pam/$projectId/sessions/'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/'
| '/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/'
@@ -7437,7 +6860,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/discovery/$discoveryId'
| '/organizations/$orgId/projects/cert-manager/$projectId/integrations/$syncId'
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName'
- | '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId'
| '/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth'
@@ -7474,7 +6896,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/ssh/$projectId/members/$membershipId'
| '/organizations/$orgId/projects/ssh/$projectId/roles/$roleSlug'
| '/organizations/$orgId/projects/cert-manager/$projectId/discovery/installations/$installationId'
- | '/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/authorize'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/create'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-secret-manager/authorize'
@@ -7541,11 +6962,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create'
| '/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId'
- | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId'
- | '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId'
- | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/'
- | '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-key-vault/oauth2/callback'
@@ -7560,10 +6977,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore'
- | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId'
- | '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId'
- | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId/'
- | '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/'
fileRoutesByTo: FileRoutesByTo
to:
| '/'
@@ -7655,9 +7068,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/kms/$projectId/kmip'
| '/organizations/$orgId/projects/kms/$projectId/overview'
| '/organizations/$orgId/projects/kms/$projectId/settings'
- | '/organizations/$orgId/projects/pam/$projectId/account-policies'
- | '/organizations/$orgId/projects/pam/$projectId/insights'
- | '/organizations/$orgId/projects/pam/$projectId/settings'
| '/organizations/$orgId/projects/secret-management/$projectId/allowlist'
| '/organizations/$orgId/projects/secret-management/$projectId/approval'
| '/organizations/$orgId/projects/secret-management/$projectId/insights'
@@ -7693,10 +7103,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/discovery'
| '/organizations/$orgId/projects/cert-manager/$projectId/integrations'
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers'
- | '/organizations/$orgId/projects/pam/$projectId/approvals'
- | '/organizations/$orgId/projects/pam/$projectId/discovery'
- | '/organizations/$orgId/projects/pam/$projectId/domains'
- | '/organizations/$orgId/projects/pam/$projectId/resources'
| '/organizations/$orgId/projects/pam/$projectId/sessions'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations'
| '/organizations/$orgId/projects/secret-scanning/$projectId/data-sources'
@@ -7712,7 +7118,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/discovery/$discoveryId'
| '/organizations/$orgId/projects/cert-manager/$projectId/integrations/$syncId'
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName'
- | '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId'
| '/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth'
@@ -7749,7 +7154,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/ssh/$projectId/members/$membershipId'
| '/organizations/$orgId/projects/ssh/$projectId/roles/$roleSlug'
| '/organizations/$orgId/projects/cert-manager/$projectId/discovery/installations/$installationId'
- | '/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/authorize'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-parameter-store/create'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/aws-secret-manager/authorize'
@@ -7816,8 +7220,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create'
| '/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId'
- | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId'
- | '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-key-vault/oauth2/callback'
@@ -7831,8 +7233,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/vercel/oauth2/callback'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore'
- | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId'
- | '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId'
id:
| '__root__'
| '/'
@@ -7945,9 +7345,6 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/kmip'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/overview'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/settings'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/allowlist'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/approval'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/insights'
@@ -7975,11 +7372,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/access-management'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/audit-logs'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/access-management'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/access-management'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/app-connections'
@@ -7998,10 +7391,6 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources/'
@@ -8017,7 +7406,6 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery/$discoveryId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/$syncId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/select-integration-auth'
@@ -8054,7 +7442,6 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/members/$membershipId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/roles/$roleSlug'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery/installations/$installationId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/authorize'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/create'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-secret-manager/authorize'
@@ -8121,11 +7508,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/authorize'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/create'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources/$type/$dataSourceId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/azure-app-configuration/oauth2/callback'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/azure-key-vault/oauth2/callback'
@@ -8140,10 +7523,6 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/restore'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/'
fileRoutesById: FileRoutesById
}
@@ -8757,15 +8136,8 @@ export const routeTree = rootRoute
"filePath": "pam/layout.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId",
"children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/access-management",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/groups/$groupId",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/identities/$identityId",
@@ -8876,18 +8248,6 @@ export const routeTree = rootRoute
"filePath": "kms/SettingsPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/account-policies": {
- "filePath": "pam/PamAccountPoliciesPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/insights": {
- "filePath": "pam/InsightsPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/settings": {
- "filePath": "pam/SettingsPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/allowlist": {
"filePath": "secret-manager/IPAllowlistPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout"
@@ -9024,42 +8384,10 @@ export const routeTree = rootRoute
"filePath": "project/AccessControlPage/route-pam.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId"
- ]
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs": {
"filePath": "project/AuditLogsPage/route-pam.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId"
- ]
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId"
- ]
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId"
- ]
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
@@ -9220,22 +8548,6 @@ export const routeTree = rootRoute
"filePath": "cert-manager/PkiSubscribersPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/": {
- "filePath": "pam/ApprovalsPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/": {
- "filePath": "pam/PamDiscoveryPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/": {
- "filePath": "pam/PamDomainsPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/": {
- "filePath": "pam/PamResourcesPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/": {
"filePath": "pam/PamSessionsPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions"
@@ -9296,10 +8608,6 @@ export const routeTree = rootRoute
"filePath": "cert-manager/PkiSubscriberDetailsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId": {
- "filePath": "pam/ApprovalRequestDetailPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId": {
"filePath": "pam/PamSessionsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions"
@@ -9444,10 +8752,6 @@ export const routeTree = rootRoute
"filePath": "cert-manager/InstallationDetailsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/discovery"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId": {
- "filePath": "pam/PamDiscoveryDetailPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/aws-parameter-store/authorize": {
"filePath": "secret-manager/integrations/AwsParameterStoreAuthorizePage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations"
@@ -9712,22 +9016,6 @@ export const routeTree = rootRoute
"filePath": "secret-scanning/SecretScanningDataSourceByIdPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId"
- ]
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId"
- ]
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout",
@@ -9736,14 +9024,6 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId"
]
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/": {
- "filePath": "pam/PamDomainByIDPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/": {
- "filePath": "pam/PamResourceByIDPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/": {
"filePath": "secret-manager/CommitsPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId"
@@ -9803,28 +9083,6 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/restore": {
"filePath": "secret-manager/CommitDetailsPage/components/RollbackPreviewTab/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/"
- ]
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId": {
- "filePath": "",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId",
- "children": [
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/"
- ]
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/": {
- "filePath": "pam/PamDomainAccountByIDPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId"
- },
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/": {
- "filePath": "pam/PamAccountByIDPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId"
}
}
}
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index dbcecb90e8..167e318367 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -399,32 +399,7 @@ const pamRoutes = route("/organizations/$orgId/projects/pam/$projectId", [
index("pam/PamSessionsPage/route.tsx"),
route("/$sessionId", "pam/PamSessionsByIDPage/route.tsx")
]),
- route("/resources", [
- index("pam/PamResourcesPage/route.tsx"),
- route("/$resourceType/$resourceId", [
- index("pam/PamResourceByIDPage/route.tsx"),
- route("/accounts/$accountId", [index("pam/PamAccountByIDPage/route.tsx")])
- ])
- ]),
- route("/domains", [
- index("pam/PamDomainsPage/route.tsx"),
- route("/$domainType/$domainId", [
- index("pam/PamDomainByIDPage/route.tsx"),
- route("/accounts/$accountId", [index("pam/PamDomainAccountByIDPage/route.tsx")])
- ])
- ]),
- route("/discovery", [
- index("pam/PamDiscoveryPage/route.tsx"),
- route("/$discoveryType/$discoverySourceId", "pam/PamDiscoveryDetailPage/route.tsx")
- ]),
route("/audit-logs", "project/AuditLogsPage/route-pam.tsx"),
- route("/insights", "pam/InsightsPage/route.tsx"),
- route("/settings", "pam/SettingsPage/route.tsx"),
- route("/account-policies", "pam/PamAccountPoliciesPage/route.tsx"),
- route("/approvals", [
- index("pam/ApprovalsPage/route.tsx"),
- route("/$approvalRequestId", "pam/ApprovalRequestDetailPage/route.tsx")
- ]),
// Access Management
route("/access-management", "project/AccessControlPage/route-pam.tsx"),