Skip to content

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

- Add a max iteration to loop - Hide gateways on frontend if license does not allow them - Fix capitalization issue with GitHub secret sync

x0322050f06c4c27a14
diff --git a/backend/src/services/app-connection/github/github-connection-fns.ts b/backend/src/services/app-connection/github/github-connection-fns.ts
index 5f4057bd29..b86e2ed658 100644
--- a/backend/src/services/app-connection/github/github-connection-fns.ts
+++ b/backend/src/services/app-connection/github/github-connection-fns.ts
@@ -116,6 +116,18 @@ export const getGitHubAppAuthToken = async (appConnection: TGitHubConnection) =>
return token;
};
+function extractNextPageUrl(linkHeader: string | undefined): string | null {
+ if (!linkHeader) return null;
+
+ const links = linkHeader.split(",");
+ const nextLink = links.find((link) => link.includes('rel="next"'));
+
+ if (!nextLink) return null;
+
+ const match = new RE2(/<([^>]+)>/).exec(nextLink);
+ return match ? match[1] : null;
+}
+
export const makePaginatedGitHubRequest = async <T, R = T[]>(
appConnection: TGitHubConnection,
gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">,
@@ -128,8 +140,9 @@ export const makePaginatedGitHubRequest = async <T, R = T[]>(
method === GitHubConnectionMethod.OAuth ? credentials.accessToken : await getGitHubAppAuthToken(appConnection);
let url: string | null = `https://api.${credentials.host || "github.com"}${path}`;
let results: T[] = [];
+ let i = 0;
- while (url) {
+ while (url && i < 1000) {
// eslint-disable-next-line no-await-in-loop
const response: AxiosResponse<R> = await requestWithGitHubGateway<R>(appConnection, gatewayService, {
url,
@@ -144,14 +157,8 @@ export const makePaginatedGitHubRequest = async <T, R = T[]>(
const items = dataMapper ? dataMapper(response.data) : (response.data as unknown as T[]);
results = results.concat(items);
- const linkHeader = response.headers.link as string | undefined;
- const nextLink =
- typeof linkHeader === "string" ? linkHeader.split(",").find((s) => s.includes('rel="next"')) : undefined;
- if (nextLink) {
- url = new RE2(/<(.+)>/).exec(nextLink)?.[1] || null;
- } else {
- url = null;
- }
+ url = extractNextPageUrl(response.headers.link as string | undefined);
+ i += 1;
}
return results;
diff --git a/backend/src/services/secret-sync/github/github-sync-fns.ts b/backend/src/services/secret-sync/github/github-sync-fns.ts
index 580d77bcaf..022490da6e 100644
--- a/backend/src/services/secret-sync/github/github-sync-fns.ts
+++ b/backend/src/services/secret-sync/github/github-sync-fns.ts
@@ -171,9 +171,11 @@ const putSecret = async (
export const GithubSyncFns = {
syncSecrets: async (
secretSync: TGitHubSyncWithCredentials,
- secretMap: TSecretMap,
+ ogSecretMap: TSecretMap,
gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">
) => {
+ const secretMap = Object.fromEntries(Object.entries(ogSecretMap).map(([i, v]) => [i.toUpperCase(), v]));
+
switch (secretSync.destinationConfig.scope) {
case GitHubSyncScope.Organization:
if (Object.values(secretMap).length > 1000) {
@@ -252,9 +254,11 @@ export const GithubSyncFns = {
},
removeSecrets: async (
secretSync: TGitHubSyncWithCredentials,
- secretMap: TSecretMap,
+ ogSecretMap: TSecretMap,
gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">
) => {
+ const secretMap = Object.fromEntries(Object.entries(ogSecretMap).map(([i, v]) => [i.toUpperCase(), v]));
+
const { connection } = secretSync;
const token =
connection.method === GitHubConnectionMethod.OAuth
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx
index 4f2cffd443..eb93993af2 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx
@@ -20,6 +20,7 @@ import {
SelectItem,
Tooltip
} from "@app/components/v2";
+import { useSubscription } from "@app/context";
import {
OrgGatewayPermissionActions,
OrgPermissionSubjects
@@ -80,6 +81,7 @@ export const GitHubConnectionForm = ({ appConnection }: Props) => {
formState: { isSubmitting, isDirty }
} = form;
+ const { subscription } = useSubscription();
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
const selectedMethod = watch("method");
@@ -173,80 +175,81 @@ export const GitHubConnectionForm = ({ appConnection }: Props) => {
</FormControl>
)}
/>
- <Accordion type="single" collapsible className="w-full">
- <AccordionItem value="enterprise-options" className="data-[state=open]:border-none">
- <AccordionTrigger className="h-fit flex-none pl-1 text-sm">
- <div className="order-1 ml-3">GitHub Enterprise Options</div>
- </AccordionTrigger>
- <AccordionContent childrenClassName="px-0">
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.AttachGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed) => (
- <Controller
- control={control}
- name="gatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Gateway"
- >
- <Tooltip
- isDisabled={isAllowed}
- content="Restricted access. You don't have permission to attach gateways to resources."
+ {subscription.gateway && (
+ <Accordion type="single" collapsible className="w-full">
+ <AccordionItem value="enterprise-options" className="data-[state=open]:border-none">
+ <AccordionTrigger className="h-fit flex-none pl-1 text-sm">
+ <div className="order-1 ml-3">GitHub Enterprise Options</div>
+ </AccordionTrigger>
+ <AccordionContent childrenClassName="px-0">
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
>
- <div>
- <Select
- isDisabled={!isAllowed}
- value={value as string}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isGatewaysLoading}
- placeholder="Default: Internet Gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value as string}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
>
- Internet Gateway
- </SelectItem>
- {gateways?.map((el) => (
- <SelectItem value={el.id} key={el.id}>
- {el.name}
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
</SelectItem>
- ))}
- </Select>
- </div>
- </Tooltip>
- </FormControl>
- )}
- />
- )}
- </OrgPermissionCan>
- <Controller
- name="credentials.host"
- control={control}
- shouldUnregister
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Hostname"
- isOptional
- >
- <Input {...field} placeholder="github.com" />
- </FormControl>
- )}
- />
- </AccordionContent>
- </AccordionItem>
- </Accordion>
-
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
+ )}
+ </OrgPermissionCan>
+ <Controller
+ name="credentials.host"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Hostname"
+ isOptional
+ >
+ <Input {...field} placeholder="github.com" />
+ </FormControl>
+ )}
+ />
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+ )}
<div className="mt-8 flex items-center">
<Button
className="mr-4"
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx
index 0735a863c6..082cdad3b5 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { OrgPermissionCan } from "@app/components/permissions";
import { Button, FormControl, ModalClose, Select, SelectItem, Tooltip } from "@app/components/v2";
+import { useSubscription } from "@app/context";
import {
OrgGatewayPermissionActions,
OrgPermissionSubjects
@@ -78,6 +79,7 @@ export const MsSqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
formState: { isSubmitting, isDirty }
} = form;
+ const { subscription } = useSubscription();
const isPlatformManagedCredentials = appConnection?.isPlatformManagedCredentials ?? false;
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
@@ -99,55 +101,57 @@ export const MsSqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
}}
>
{!isUpdate && <GenericAppConnectionsFields />}
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.AttachGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed) => (
- <Controller
- control={control}
- name="gatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Gateway"
- >
- <Tooltip
- isDisabled={isAllowed}
- content="Restricted access. You don't have permission to attach gateways to resources."
+ {subscription.gateway && (
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
>
- <div>
- <Select
- isDisabled={!isAllowed}
- value={value as string}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isGatewaysLoading}
- placeholder="Default: Internet Gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value as string}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
>
- Internet Gateway
- </SelectItem>
- {gateways?.map((el) => (
- <SelectItem value={el.id} key={el.id}>
- {el.name}
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
</SelectItem>
- ))}
- </Select>
- </div>
- </Tooltip>
- </FormControl>
- )}
- />
- )}
- </OrgPermissionCan>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
+ )}
+ </OrgPermissionCan>
+ )}
<Controller
name="method"
control={control}
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MySqlConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MySqlConnectionForm.tsx
index 8c8616c7ed..a3108226ae 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MySqlConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MySqlConnectionForm.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { OrgPermissionCan } from "@app/components/permissions";
import { Button, FormControl, ModalClose, Select, SelectItem, Tooltip } from "@app/components/v2";
+import { useSubscription } from "@app/context";
import {
OrgGatewayPermissionActions,
OrgPermissionSubjects
@@ -75,6 +76,7 @@ export const MySqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
formState: { isSubmitting, isDirty }
} = form;
+ const { subscription } = useSubscription();
const isPlatformManagedCredentials = appConnection?.isPlatformManagedCredentials ?? false;
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
@@ -96,55 +98,57 @@ export const MySqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
}}
>
{!isUpdate && <GenericAppConnectionsFields />}
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.AttachGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed) => (
- <Controller
- control={control}
- name="gatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Gateway"
- >
- <Tooltip
- isDisabled={isAllowed}
- content="Restricted access. You don't have permission to attach gateways to resources."
+ {subscription.gateway && (
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
>
- <div>
- <Select
- isDisabled={!isAllowed}
- value={value as string}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isGatewaysLoading}
- placeholder="Default: Internet Gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value as string}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
>
- Internet Gateway
- </SelectItem>
- {gateways?.map((el) => (
- <SelectItem value={el.id} key={el.id}>
- {el.name}
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
</SelectItem>
- ))}
- </Select>
- </div>
- </Tooltip>
- </FormControl>
- )}
- />
- )}
- </OrgPermissionCan>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
+ )}
+ </OrgPermissionCan>
+ )}
<Controller
name="method"
control={control}
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx
index 87d4fe07b4..d16763132e 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { OrgPermissionCan } from "@app/components/permissions";
import { Button, FormControl, ModalClose, Select, SelectItem, Tooltip } from "@app/components/v2";
+import { useSubscription } from "@app/context";
import {
OrgGatewayPermissionActions,
OrgPermissionSubjects
@@ -75,6 +76,7 @@ export const OracleDBConnectionForm = ({ appConnection, onSubmit }: Props) => {
formState: { isSubmitting, isDirty }
} = form;
+ const { subscription } = useSubscription();
const isPlatformManagedCredentials = appConnection?.isPlatformManagedCredentials ?? false;
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
@@ -96,55 +98,57 @@ export const OracleDBConnectionForm = ({ appConnection, onSubmit }: Props) => {
}}
>
{!isUpdate && <GenericAppConnectionsFields />}
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.AttachGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed) => (
- <Controller
- control={control}
- name="gatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Gateway"
- >
- <Tooltip
- isDisabled={isAllowed}
- content="Restricted access. You don't have permission to attach gateways to resources."
+ {subscription.gateway && (
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
>
- <div>
- <Select
- isDisabled={!isAllowed}
- value={value as string}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isGatewaysLoading}
- placeholder="Default: Internet Gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value as string}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
>
- Internet Gateway
- </SelectItem>
- {gateways?.map((el) => (
- <SelectItem value={el.id} key={el.id}>
- {el.name}
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
</SelectItem>
- ))}
- </Select>
- </div>
- </Tooltip>
- </FormControl>
- )}
- />
- )}
- </OrgPermissionCan>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
+ )}
+ </OrgPermissionCan>
+ )}
<Controller
name="method"
control={control}
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PostgresConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PostgresConnectionForm.tsx
index 9d48d27b0f..ae00d7b574 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PostgresConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PostgresConnectionForm.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { OrgPermissionCan } from "@app/components/permissions";
import { Button, FormControl, ModalClose, Select, SelectItem, Tooltip } from "@app/components/v2";
+import { useSubscription } from "@app/context";
import {
OrgGatewayPermissionActions,
OrgPermissionSubjects
@@ -75,6 +76,7 @@ export const PostgresConnectionForm = ({ appConnection, onSubmit }: Props) => {
formState: { isSubmitting, isDirty }
} = form;
+ const { subscription } = useSubscription();
const isPlatformManagedCredentials = appConnection?.isPlatformManagedCredentials ?? false;
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
@@ -96,55 +98,57 @@ export const PostgresConnectionForm = ({ appConnection, onSubmit }: Props) => {
}}
>
{!isUpdate && <GenericAppConnectionsFields />}
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.AttachGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed) => (
- <Controller
- control={control}
- name="gatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Gateway"
- >
- <Tooltip
- isDisabled={isAllowed}
- content="Restricted access. You don't have permission to attach gateways to resources."
+ {subscription.gateway && (
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
>
- <div>
- <Select
- isDisabled={!isAllowed}
- value={value as string}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isGatewaysLoading}
- placeholder="Default: Internet Gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value as string}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
>
- Internet Gateway
- </SelectItem>
- {gateways?.map((el) => (
- <SelectItem value={el.id} key={el.id}>
- {el.name}
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
</SelectItem>
- ))}
- </Select>
- </div>
- </Tooltip>
- </FormControl>
- )}
- />
- )}
- </OrgPermissionCan>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
+ )}
+ </OrgPermissionCan>
+ )}
<Controller
name="method"
control={control}