Skip to content

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

fix(ui): make machine identity auth method menu scrollable (#7742)

Andrew Huang68a9e240f7ca
diff --git a/frontend/src/components/v3/generic/Combobox/Combobox.tsx b/frontend/src/components/v3/generic/Combobox/Combobox.tsx
index 7c1646b30a..a8f113a55c 100644
--- a/frontend/src/components/v3/generic/Combobox/Combobox.tsx
+++ b/frontend/src/components/v3/generic/Combobox/Combobox.tsx
@@ -58,8 +58,8 @@ type ComboboxMultipleProps<TOption> = ComboboxSharedProps<TOption> &
type ComboboxProps<TOption> = ComboboxSingleProps<TOption> | ComboboxMultipleProps<TOption>;
-const SINGLE_LIST_MAX_HEIGHT = "min(18.75rem, var(--available-height))";
-const MULTIPLE_LIST_MAX_HEIGHT = "min(18.75rem, var(--available-height))";
+const SINGLE_LIST_MAX_HEIGHT = "min(18.75rem, var(--available-height, 50dvh))";
+const MULTIPLE_LIST_MAX_HEIGHT = "min(18.75rem, var(--available-height, 50dvh))";
const normalizeSearchText = (value: string) =>
value
@@ -125,6 +125,7 @@ const ComboboxList = <TOption,>({
<ComboboxPrimitive.List
aria-label={ariaLabel}
aria-busy={isLoading || undefined}
+ onWheel={(event) => event.stopPropagation()}
className="thin-scrollbar scroll-py-1 overflow-y-auto overscroll-contain p-1 outline-none"
style={{ maxHeight }}
>
@@ -305,7 +306,12 @@ const SingleCombobox = <TOption,>({
{...inputProps}
/>
{!open && value != null && renderValue && (
- <span className="pointer-events-none absolute inset-y-0 right-9 left-2.5 flex min-w-0 items-center truncate text-sm text-foreground">
+ <span
+ className={cn(
+ "pointer-events-none absolute inset-y-0 right-9 left-2.5 flex min-w-0 items-center truncate text-sm text-foreground",
+ isDisabled && "opacity-50"
+ )}
+ >
{renderValue(value)}
</span>
)}
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
index d9cb8e1c38..2d0a8c9e6c 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
@@ -1,15 +1,9 @@
import { type ReactNode, useCallback } from "react";
import { Controller, useForm } from "react-hook-form";
-import {
- components as ReactSelectComponents,
- type OptionProps,
- type SingleValueProps
-} from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
import {
BadgeCheckIcon,
BracesIcon,
- CheckIcon,
FileKeyIcon,
GlobeIcon,
KeyIcon,
@@ -18,7 +12,7 @@ import {
import { z } from "zod";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { Badge, Field, FieldError, FieldLabel, FilterableSelect } from "@app/components/v3";
+import { Badge, Combobox, Field, FieldError, FieldLabel } from "@app/components/v3";
import { MAX_IDENTITY_ACCESS_TOKEN_TTL_FALLBACK } from "@app/helpers/identityAuthSchemas";
import { IdentityAuthMethod } from "@app/hooks/api/identities";
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
@@ -157,41 +151,6 @@ export const identityAuthMethodOptions = [
...otherIdentityAuthMethods
];
-const AuthMethodOption = (props: OptionProps<TIdentityAuthMethodSelectOption>) => {
- const { data, isDisabled, isSelected } = props;
- const option = (
- <ReactSelectComponents.Option {...props}>
- <div
- className={`flex items-center justify-between gap-2 ${
- isDisabled ? "cursor-not-allowed opacity-50" : ""
- }`}
- >
- <span className="flex min-w-0 items-center gap-2">
- {data.icon}
- <span className="truncate">{data.label}</span>
- {data.showConfiguredBadge && <Badge variant="info">Configured</Badge>}
- </span>
- {isSelected && <CheckIcon className="size-4 shrink-0" />}
- </div>
- </ReactSelectComponents.Option>
- );
-
- return option;
-};
-
-const AuthMethodSingleValue = (props: SingleValueProps<TIdentityAuthMethodSelectOption>) => {
- const { data } = props;
-
- return (
- <ReactSelectComponents.SingleValue {...props}>
- <span className="flex min-w-0 items-center gap-2">
- {data.icon}
- <span className="truncate">{data.label}</span>
- </span>
- </ReactSelectComponents.SingleValue>
- );
-};
-
const schema = z
.object({
authMethod: z.nativeEnum(IdentityAuthMethod)
@@ -452,8 +411,8 @@ export const IdentityAuthMethodModalContent = ({
return (
<Field className="mb-2">
<FieldLabel htmlFor="auth-method">Auth Method</FieldLabel>
- <FilterableSelect<TIdentityAuthMethodSelectOption>
- inputId="auth-method"
+ <Combobox<TIdentityAuthMethodSelectOption>
+ id="auth-method"
value={selectedAuthMethod}
options={authMethodOptions}
isDisabled={isSelectedAuthAlreadyConfigured}
@@ -461,19 +420,30 @@ export const IdentityAuthMethodModalContent = ({
isOptionDisabled={({ isConfigured }) => isConfigured}
getOptionLabel={({ label }) => label}
getOptionValue={({ value: methodValue }) => methodValue}
- components={{
- Option: AuthMethodOption,
- SingleValue: AuthMethodSingleValue
- }}
- placeholder="Select auth method"
- onChange={(next) => {
- const nextAuthMethod = next as TIdentityAuthMethodSelectOption | null;
-
- if (nextAuthMethod && !nextAuthMethod.isConfigured) {
+ placeholder="Select auth method..."
+ searchPlaceholder="Search auth methods..."
+ searchAriaLabel="Search auth methods"
+ emptyMessage="No auth methods found."
+ modal
+ onValueChange={(nextAuthMethod) => {
+ if (!nextAuthMethod.isConfigured) {
setSelectedAuthMethod(nextAuthMethod.value);
onChange(nextAuthMethod.value);
}
}}
+ renderOption={(option) => (
+ <span className="flex min-w-0 items-center gap-2">
+ {option.icon}
+ <span className="truncate">{option.label}</span>
+ {option.showConfiguredBadge && <Badge variant="info">Configured</Badge>}
+ </span>
+ )}
+ renderValue={(option) => (
+ <span className="flex min-w-0 items-center gap-2">
+ {option.icon}
+ <span className="truncate">{option.label}</span>
+ </span>
+ )}
/>
<FieldError>{error?.message}</FieldError>
</Field>