Skip to content

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

style changes

Andrey91c176e3679b
diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx
index 5c69413b6f..adfaacec40 100644
--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx
+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx
@@ -18,15 +18,12 @@ import {
FieldContent,
FieldDescription,
FieldTitle,
- IconButton,
- ProviderIcon
+ IconButton
} from "@app/components/v3";
import { Skeleton } from "@app/components/v3/generic/Skeleton";
import { OrgPermissionSubjects, useOrgPermission } from "@app/context";
import { OrgPermissionAppConnectionActions } from "@app/context/OrgPermissionContext/types";
-import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
import { TAppConnection } from "@app/hooks/api/appConnections";
-import { AppConnection } from "@app/hooks/api/appConnections/enums";
import {
approvalPolicyQuery,
ApprovalPolicyScope,
@@ -41,7 +38,7 @@ import {
newKey,
TAutoApprovalDraft
} from "./autoApprovalDraft";
-import { DisabledReason, LogicConnector } from "./AutoApprovalLabels";
+import { ConnectionIcon, DisabledReason, LogicConnector } from "./AutoApprovalLabels";
import { AutoApprovalRuleCard } from "./AutoApprovalRuleCard";
type Props = {
@@ -54,12 +51,6 @@ type Props = {
hasApprovers: boolean;
};
-const ConnectionIcon = ({ app }: { app: string }) => {
- const details = APP_CONNECTION_MAP[app as AppConnection];
- if (!details) return null;
- return <ProviderIcon icon={details.image} alt="" className="size-4 shrink-0" />;
-};
-
export const AutoApprovalCard = ({
policyType,
scope,
@@ -246,6 +237,7 @@ export const AutoApprovalCard = ({
key={`${input.connectionId}:${input.subject}`}
className="flex items-center gap-3 px-4 py-2.5"
>
+ {connection && <ConnectionIcon app={connection.app} />}
<span className="text-sm text-foreground">
{subject?.input?.label ?? input.subject}
</span>
diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx
index b083375057..43615ef050 100644
--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx
+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalLabels.tsx
@@ -1,6 +1,15 @@
import { ReactElement, ReactNode } from "react";
-import { Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
+import { ProviderIcon, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
+import { cn } from "@app/components/v3/utils";
+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+
+export const ConnectionIcon = ({ app, className }: { app: string; className?: string }) => {
+ const details = APP_CONNECTION_MAP[app as AppConnection];
+ if (!details) return null;
+ return <ProviderIcon icon={details.image} alt="" className={cn("size-4 shrink-0", className)} />;
+};
export const SectionLabel = ({ children }: { children: ReactNode }) => (
<p className="text-xs font-medium tracking-wider text-muted uppercase">{children}</p>
diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx
index 7061d62b09..a2e94f62e9 100644
--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx
+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalRuleCard.tsx
@@ -30,6 +30,7 @@ import {
findSubject,
getConditionError,
getRuleError,
+ getSubjectDisplayLabel,
getSubjectsMissingCheck,
newKey,
TAutoApprovalDraft,
@@ -37,7 +38,7 @@ import {
TDraftRule,
UNUSED_CONSTRAINT
} from "./autoApprovalDraft";
-import { DisabledReason, SectionLabel } from "./AutoApprovalLabels";
+import { ConnectionIcon, DisabledReason, SectionLabel } from "./AutoApprovalLabels";
import { AutoApprovalValuePicker } from "./AutoApprovalValuePicker";
type TSubjectChoice = {
@@ -97,6 +98,7 @@ const ConditionRow = ({
showConnector,
condition,
rule,
+ inputs,
catalog,
policyType,
scope,
@@ -108,6 +110,7 @@ const ConditionRow = ({
showConnector: boolean;
condition: TDraftCondition;
rule: TDraftRule;
+ inputs: TAutoApprovalDraft["inputs"];
catalog: TAutoApprovalCatalogConnection[];
policyType: ApprovalPolicyType;
scope: ApprovalPolicyScope;
@@ -116,7 +119,13 @@ const ConditionRow = ({
onChange: (condition: TDraftCondition) => void;
onRemove: () => void;
}) => {
- const { subject } = findSubject(catalog, condition.connectionId, condition.subject);
+ const { connection, subject } = findSubject(catalog, condition.connectionId, condition.subject);
+ const subjectLabel = getSubjectDisplayLabel(
+ inputs,
+ catalog,
+ condition.connectionId,
+ condition.subject
+ );
const constraint = subject?.constraints.find(
(candidate) => candidate.id === condition.constraint
);
@@ -143,7 +152,10 @@ const ConditionRow = ({
</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>
+ <Badge variant="neutral">
+ {connection && <ConnectionIcon app={connection.app} className="size-3.5" />}
+ {subjectLabel ?? "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>
@@ -297,6 +309,7 @@ export const AutoApprovalRuleCard = ({
showConnector={conditionIndex > 0}
condition={condition}
rule={rule}
+ inputs={inputs}
catalog={catalog}
policyType={policyType}
scope={scope}
@@ -317,7 +330,12 @@ export const AutoApprovalRuleCard = ({
)}
{missingChecks.map(({ condition, constraint, message, action }) => {
- const { subject } = findSubject(catalog, condition.connectionId, condition.subject);
+ const subjectLabel = getSubjectDisplayLabel(
+ inputs,
+ catalog,
+ condition.connectionId,
+ condition.subject
+ );
return (
<Alert
key={`${condition.connectionId}:${condition.subject}:${constraint}`}
@@ -326,7 +344,7 @@ export const AutoApprovalRuleCard = ({
>
<ShieldAlert />
<AlertDescription className="text-xs">
- <span>{message(subject?.label ?? "record")}</span>
+ <span>{message(subjectLabel ?? "record")}</span>
<AlertAction>
<Button
type="button"
diff --git a/frontend/src/pages/pam/components/auto-approval/autoApprovalDraft.ts b/frontend/src/pages/pam/components/auto-approval/autoApprovalDraft.ts
index 56b0746f48..66f00cf51a 100644
--- a/frontend/src/pages/pam/components/auto-approval/autoApprovalDraft.ts
+++ b/frontend/src/pages/pam/components/auto-approval/autoApprovalDraft.ts
@@ -86,6 +86,23 @@ export const findSubject = (
};
};
+// Fields from two connections of the same app share a label, so the connection name tells them apart
+export const getSubjectDisplayLabel = (
+ inputs: TAutoApprovalDraft["inputs"],
+ catalog: TAutoApprovalCatalogConnection[] | undefined,
+ connectionId: string,
+ subjectId: string
+) => {
+ const { connection, subject } = findSubject(catalog, connectionId, subjectId);
+ if (!subject) return null;
+ const isShared = inputs.some(
+ (input) =>
+ (input.connectionId !== connectionId || input.subject !== subjectId) &&
+ findSubject(catalog, input.connectionId, input.subject).subject?.label === subject.label
+ );
+ return isShared && connection ? `${subject.label} from ${connection.name}` : subject.label;
+};
+
export const isRequesterSubject = (subjectId: string) =>
subjectId === AUTO_APPROVAL_REQUESTER_SUBJECT;