Skip to content

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

AND and OR labels for readability

Andrey9fa175b6d34c
diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx
index 466cfcc6fd..01f5383758 100644
--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx
+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx
@@ -1,3 +1,4 @@
+import { Fragment } from "react";
import { useQuery } from "@tanstack/react-query";
import { Info, Link2, Plus, TriangleAlert, X } from "lucide-react";
@@ -34,7 +35,7 @@ import {
newKey,
TAutoApprovalDraft
} from "./autoApprovalDraft";
-import { DisabledReason, SectionLabel } from "./AutoApprovalLabels";
+import { DisabledReason, LogicConnector, SectionLabel } from "./AutoApprovalLabels";
import { AutoApprovalRuleCard } from "./AutoApprovalRuleCard";
type Props = {
@@ -246,33 +247,37 @@ export const AutoApprovalCard = ({
</div>
)}
- {draft.rules.map((rule, index) => (
- <AutoApprovalRuleCard
- key={rule.key}
- index={index}
- rule={rule}
- inputs={draft.inputs}
- catalog={catalog}
- policyType={policyType}
- scope={scope}
- scopeId={scopeId}
- showErrors={showErrors}
- onChange={(next) =>
- onChange({
- ...draft,
- rules: draft.rules.map((candidate) =>
- candidate.key === next.key ? next : candidate
- )
- })
- }
- onRemove={() =>
- onChange({
- ...draft,
- rules: draft.rules.filter((candidate) => candidate.key !== rule.key)
- })
- }
- />
- ))}
+ <div className="flex flex-col">
+ {draft.rules.map((rule, index) => (
+ <Fragment key={rule.key}>
+ {index > 0 && <LogicConnector label="or" />}
+ <AutoApprovalRuleCard
+ index={index}
+ rule={rule}
+ inputs={draft.inputs}
+ catalog={catalog}
+ policyType={policyType}
+ scope={scope}
+ scopeId={scopeId}
+ showErrors={showErrors}
+ onChange={(next) =>
+ onChange({
+ ...draft,
+ rules: draft.rules.map((candidate) =>
+ candidate.key === next.key ? next : candidate
+ )
+ })
+ }
+ onRemove={() =>
+ onChange({
+ ...draft,
+ rules: draft.rules.filter((candidate) => candidate.key !== rule.key)
+ })
+ }
+ />
+ </Fragment>
+ ))}
+ </div>
</section>
</>
)}
diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx
index 6d4a8c4374..b083375057 100644
--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx
+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx
@@ -24,3 +24,11 @@ export const DisabledReason = ({
</Tooltip>
);
};
+
+export const LogicConnector = ({ label }: { label: string }) => (
+ <div className="flex py-1.5 pl-4">
+ <span className="rounded-sm border border-border bg-foreground/5 px-1 py-0.5 text-[9px] leading-none font-medium tracking-wider text-muted uppercase">
+ {label}
+ </span>
+ </div>
+);
diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx
index 6c3c488165..972ee1f156 100644
--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx
+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx
@@ -91,6 +91,7 @@ const getSubjectChoices = (
};
const ConditionRow = ({
+ showConnector,
condition,
rule,
catalog,
@@ -101,6 +102,7 @@ const ConditionRow = ({
onChange,
onRemove
}: {
+ showConnector: boolean;
condition: TDraftCondition;
rule: TDraftRule;
catalog: TAutoApprovalCatalogConnection[];
@@ -131,10 +133,18 @@ const ConditionRow = ({
);
return (
- <div className="flex flex-col gap-1 py-1.5 pr-1.5 pl-2.5">
+ <div className="relative flex flex-col gap-1 py-1.5 pr-1.5 pl-2.5">
+ {showConnector && (
+ <span className="absolute top-0 left-4 -translate-y-1/2 bg-card px-1 text-[10px] leading-none font-medium tracking-wider text-muted uppercase">
+ and
+ </span>
+ )}
<div className="flex min-h-7 flex-wrap items-center gap-x-3 gap-y-1">
<Badge variant="neutral">{subject?.label ?? "Unavailable record"}</Badge>
<span className="text-sm text-foreground">{constraint?.label ?? condition.constraint}</span>
+ {constraint?.value === AutoApprovalConstraintValue.Many && (
+ <span className="text-xs text-muted">one of</span>
+ )}
{constraint && constraint.value !== AutoApprovalConstraintValue.None && (
<div className="max-w-72 min-w-40 flex-1">
<AutoApprovalValuePicker
@@ -269,9 +279,10 @@ export const AutoApprovalRuleCard = ({
<div className="flex flex-col items-start gap-2">
{rule.conditions.length > 0 && (
<div className="flex w-full flex-col divide-y divide-border rounded-md border border-border">
- {rule.conditions.map((condition) => (
+ {rule.conditions.map((condition, conditionIndex) => (
<ConditionRow
key={condition.key}
+ showConnector={conditionIndex > 0}
condition={condition}
rule={rule}
catalog={catalog}