Skip to content

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

fix(gateway): rename gateway from the list, fix dialog spacing

bernie-gc5aa13e03ea3
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx
index 8e0ee35262..834a3537d6 100644
--- a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx
@@ -41,7 +41,7 @@ import {
} from "@app/hooks/api/gateways-v2";
import { TGatewayV2 } from "@app/hooks/api/gateways-v2/types";
-import { RenameGatewayModal } from "./RenameGatewayModal";
+import { RenameGatewayModal } from "../../../components/RenameGatewayModal";
export const GatewayPageHeader = ({ gateway, orgId }: { gateway: TGatewayV2; orgId: string }) => {
const navigate = useNavigate();
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
index 7d4e618b3c..7fbb42fdbf 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
@@ -82,7 +82,9 @@ import { useListGatewayPools } from "@app/hooks/api/gateway-pools";
import { TGatewayPool } from "@app/hooks/api/gateway-pools/types";
import { gatewaysQueryKeys, useDeleteGatewayById } from "@app/hooks/api/gateways";
import { useDeleteGatewayV2ById, useTriggerGatewayV2Heartbeat } from "@app/hooks/api/gateways-v2";
+import { TGatewayV2 } from "@app/hooks/api/gateways-v2/types";
+import { RenameGatewayModal } from "../RenameGatewayModal";
import { CreateGatewayPoolModal } from "./components/CreateGatewayPoolModal";
import { EditGatewayDetailsModal } from "./components/EditGatewayDetailsModal";
import { GatewayDeployModal } from "./components/GatewayDeployModal";
@@ -126,6 +128,7 @@ export const GatewayTab = withPermission(
"deployGateway",
"deleteGateway",
"editDetails",
+ "renameGateway",
"createPool",
"upgradePlan"
] as const);
@@ -421,22 +424,25 @@ export const GatewayTab = withPermission(
Trigger Health Check
</DropdownMenuItem>
)}
- {el.isV1 && (
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.EditGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("editDetails", el)}
- >
- <PencilIcon />
- Edit Details
- </DropdownMenuItem>
- )}
- </OrgPermissionCan>
- )}
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.EditGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed: boolean) => (
+ <DropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={() =>
+ handlePopUpOpen(
+ el.isV1 ? "editDetails" : "renameGateway",
+ el
+ )
+ }
+ >
+ <PencilIcon />
+ {el.isV1 ? "Edit Details" : "Rename Gateway"}
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
<OrgPermissionCan
I={OrgGatewayPermissionActions.DeleteGateways}
a={OrgPermissionSubjects.Gateway}
@@ -475,6 +481,13 @@ export const GatewayTab = withPermission(
/>
</DialogContent>
</Dialog>
+ {Boolean(popUp.renameGateway.data) && (
+ <RenameGatewayModal
+ isOpen={popUp.renameGateway.isOpen}
+ onToggle={(isOpen) => handlePopUpToggle("renameGateway", isOpen)}
+ gateway={popUp.renameGateway.data as TGatewayV2}
+ />
+ )}
<AlertDialog
open={popUp.deleteGateway.isOpen}
confirmationValue={
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/RenameGatewayModal.tsx b/frontend/src/pages/organization/NetworkingPage/components/RenameGatewayModal.tsx
similarity index 74%
rename from frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/RenameGatewayModal.tsx
rename to frontend/src/pages/organization/NetworkingPage/components/RenameGatewayModal.tsx
index f7790ef39f..9194c52ca8 100644
--- a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/RenameGatewayModal.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/RenameGatewayModal.tsx
@@ -7,13 +7,12 @@ import { createNotification } from "@app/components/notifications";
import {
Button,
Dialog,
+ DialogClose,
DialogContent,
- DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
Field,
- FieldContent,
FieldError,
FieldLabel,
Input
@@ -70,31 +69,35 @@ export const RenameGatewayModal = ({ isOpen, onToggle, gateway }: Props) => {
return (
<Dialog open={isOpen} onOpenChange={onToggle}>
<DialogContent>
- <form onSubmit={handleSubmit(onFormSubmit)}>
- <DialogHeader>
- <DialogTitle>Rename Gateway</DialogTitle>
- <DialogDescription>
- The gateway keeps its ID, so anything already pointing at it carries on working.
- </DialogDescription>
- </DialogHeader>
+ <DialogHeader>
+ <DialogTitle>Rename Gateway</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4">
<Controller
control={control}
name="name"
render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Name</FieldLabel>
- <FieldContent>
- <Input {...field} isError={Boolean(error)} placeholder="prod-us-east" />
- </FieldContent>
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="gateway-name">Name</FieldLabel>
+ <Input
+ {...field}
+ id="gateway-name"
+ placeholder="prod-us-east"
+ isError={Boolean(error)}
+ autoFocus
+ autoComplete="off"
+ />
<FieldError>{error?.message}</FieldError>
</Field>
)}
/>
<DialogFooter>
- <Button variant="ghost" type="button" onClick={() => onToggle(false)}>
- Cancel
- </Button>
- <Button variant="org" type="submit" isPending={isSubmitting}>
+ <DialogClose asChild>
+ <Button variant="ghost" type="button">
+ Cancel
+ </Button>
+ </DialogClose>
+ <Button variant="org" type="submit" isPending={isSubmitting} isDisabled={isSubmitting}>
Save Changes
</Button>
</DialogFooter>