handleRowClick(request.id)}
>
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx
index 397631508..c767f5e48 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/PolicyTab.tsx
@@ -38,10 +38,14 @@ export const PolicyTab = () => {
return (
-
-
- Approval Policies
+
+
+
+ View and manage PAM access policies
+
+
{
|
Policy Name |
- Access Duration (min - max) |
+ Max. Access Duration |
Conditions |
|
@@ -141,10 +141,7 @@ export const PoliciesTable = ({ handlePopUpOpen }: Props) => {
|
{policy.name} |
-
- {policy.constraints.constraints.accessDuration.min} -{" "}
- {policy.constraints.constraints.accessDuration.max}
- |
+ {policy.constraints.constraints.accessDuration.max} |
{conditionsCount} condition{conditionsCount !== 1 ? "s" : ""}
|
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx
index 790ade93f..2cbd2f104 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx
@@ -15,7 +15,6 @@ import {
import { UsePopUpState } from "@app/hooks/usePopUp";
import { PolicyApprovalSteps } from "./PolicySteps/PolicyApprovalSteps";
-import { PolicyConstraintsStep } from "./PolicySteps/PolicyConstraintsStep";
import { PolicyDetailsStep } from "./PolicySteps/PolicyDetailsStep";
import { PolicyReviewStep } from "./PolicySteps/PolicyReviewStep";
import { PolicyFormSchema, TPolicyForm } from "./PolicySchema";
@@ -26,9 +25,12 @@ type Props = {
};
const FORM_STEPS: { name: string; key: string; fields: (keyof TPolicyForm)[] }[] = [
- { name: "Details", key: "details", fields: ["name", "maxRequestTtl", "constraints"] },
- { name: "Conditions", key: "conditions", fields: ["conditions"] },
- { name: "Approvals", key: "approvals", fields: ["steps"] },
+ {
+ name: "Configuration",
+ key: "configuration",
+ fields: ["name", "constraints", "conditions"]
+ },
+ { name: "Approval Sequence", key: "approvals", fields: ["steps"] },
{ name: "Review", key: "review", fields: [] }
];
@@ -61,8 +63,7 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {
approvers: []
}
]
- },
- mode: "onChange"
+ }
});
const { handleSubmit, trigger, reset } = formMethods;
@@ -184,7 +185,7 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {
return (
handlePopUpToggle("policy", open)}>
@@ -215,9 +216,6 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {
-
-
-
@@ -237,7 +235,8 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {
isLoading={isCreating || isUpdating}
isDisabled={isCreating || isUpdating}
>
- {policyData?.policyId ? "Update" : "Create"} {isFinalStep ? "" : "Next"}
+ {isFinalStep && (policyData?.policyId ? "Update" : "Create")}
+ {!isFinalStep && "Next"}
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx
index e371c0663..6115a1a93 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx
@@ -28,7 +28,13 @@ export const PolicyFormSchema = z.object({
).nullish(),
conditions: z
.object({
- accountPaths: z.array(z.string().min(1))
+ accountPaths: z
+ .string()
+ .array()
+ .min(1, "Must have at least one account path")
+ .refine((val) => val.every((path) => path.length > 0), {
+ message: "All account paths must be non-empty"
+ })
})
.array()
.min(1, "At least one condition is required"),
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyApprovalSteps.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyApprovalSteps.tsx
index a1ca976be..1d0fa9993 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyApprovalSteps.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyApprovalSteps.tsx
@@ -78,7 +78,7 @@ export const PolicyApprovalSteps = () => {
{stepFields.map((field, index) => (
-
+
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyConstraintsStep.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyConstraintsStep.tsx
deleted file mode 100644
index 52289ef14..000000000
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyConstraintsStep.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import { Controller, useFieldArray, useFormContext } from "react-hook-form";
-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { Button, FormControl, IconButton, Input } from "@app/components/v2";
-
-import { TPolicyForm } from "../PolicySchema";
-
-export const PolicyConstraintsStep = () => {
- const { control } = useFormContext();
-
- const {
- fields: conditionFields,
- append: appendCondition,
- remove: removeCondition
- } = useFieldArray({
- control,
- name: "conditions"
- });
-
- return (
-
-
-
-
-
Conditions
-
- Define which resources and account paths this policy applies to
-
-
-
}
- onClick={() => appendCondition({ accountPaths: [] })}
- >
- Add Condition
-
-
-
- {conditionFields.map((field, index) => (
-
-
-
-
- Condition {index + 1}
-
- {conditionFields.length > 1 && (
- removeCondition(index)}
- >
-
-
- )}
-
-
- (
-
- {
- const paths = e.target.value
- .split(",")
- .map((path) => path.trim())
- .filter(Boolean);
- pathField.onChange(paths);
- }}
- placeholder="e.g., /admin/**, /users/john, /**"
- />
-
- )}
- />
-
-
- {index < conditionFields.length - 1 && (
-
- )}
-
- ))}
-
-
-
- );
-};
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
index 228d474ad..d365283d0 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
@@ -1,3 +1,4 @@
+import { useEffect } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { TtlFormLabel } from "@app/components/features";
@@ -6,80 +7,72 @@ import { FormControl, Input } from "@app/components/v2";
import { TPolicyForm } from "../PolicySchema";
export const PolicyDetailsStep = () => {
- const { control } = useFormContext();
+ const {
+ control,
+ formState: { errors }
+ } = useFormContext();
+
+ useEffect(() => {
+ console.log("YOOOO");
+ console.log(errors);
+ }, [errors]);
return (
-
+
);
};
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
index 7abb78867..d4c4a46bc 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx
@@ -45,61 +45,23 @@ export const PolicyReviewStep = () => {
-
Policy Details
+ Policy Configuration
-
-
- PAM Account Access Duration TTL
-
-
-
-
-
-
-
-
-
-
-
- Conditions ({conditions.length})
-
-
-
- {conditions.map((condition, index) => (
-
-
- Condition {index + 1}
-
-
-
- Account Paths:
-
- {condition.accountPaths.length > 0
- ? condition.accountPaths.join(", ")
- : "None specified"}
-
-
-
-
- ))}
-
-
-
-
-
-
- Approval Workflow ({steps.length} step{steps.length !== 1 ? "s" : ""})
-
+ Approval Sequence
{steps.map((step, index) => {
@@ -109,7 +71,7 @@ export const PolicyReviewStep = () => {
return (
diff --git a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx
index 9f611aa00..92e3ce40e 100644
--- a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx
+++ b/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx
@@ -180,8 +180,11 @@ export const RequestGrantTab = () => {
return (
-
-
Access Grants
+
+
+
View and revoke access grants to PAM accounts