Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(ui): compose machine identity dialog body and footer (#8624)
Andrew Huang4e4eb91aea70
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsxindex 7195022a9d..160165a921 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx@@ -10,6 +10,8 @@ import { createNotification } from "@app/components/notifications";import { RoleOption } from "@app/components/roles";import {Button,+ DialogBody,+ DialogFooter,Field,FieldContent,FieldDescription,@@ -146,152 +148,149 @@ export const OrgIdentityModal = ({ popUp, handlePopUpToggle }: Props) => {};return (- <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4">- {isOrgIdentity && (+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex min-h-0 flex-col gap-4">+ <DialogBody className="flex flex-col gap-4">+ {isOrgIdentity && (+ <Controller+ control={control}+ defaultValue=""+ name="name"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Name</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ placeholder="Machine 1"+ isError={Boolean(error)}+ autoComplete="off"+ name="machine-identity-name"+ />+ </FieldContent>+ {error && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />+ )}<Controllercontrol={control}- defaultValue=""- name="name"- render={({ field, fieldState: { error } }) => (+ name="role"+ render={({ field: { onChange, value }, fieldState: { error } }) => (<Field>- <FieldLabel>Name</FieldLabel>+ <FieldLabel>{`${popUp?.identity?.data ? "Update " : ""}Role`}</FieldLabel><FieldContent>- <Input- {...field}- autoFocus- placeholder="Machine 1"+ <FilterableSelect+ placeholder="Select role..."+ options={roles}+ onChange={onChange}+ value={value}+ getOptionValue={(option) => option.slug}+ getOptionLabel={(option) => option.name}+ components={{ Option: RoleOption }}isError={Boolean(error)}- autoComplete="off"- name="machine-identity-name"/></FieldContent>{error && <FieldError>{error.message}</FieldError>}</Field>)}/>- )}- <Controller- control={control}- name="role"- render={({ field: { onChange, value }, fieldState: { error } }) => (- <Field>- <FieldLabel>{`${popUp?.identity?.data ? "Update " : ""}Role`}</FieldLabel>- <FieldContent>- <FilterableSelect- placeholder="Select role..."- options={roles}- onChange={onChange}- value={value}- getOptionValue={(option) => option.slug}- getOptionLabel={(option) => option.name}- components={{ Option: RoleOption }}- isError={Boolean(error)}- />- </FieldContent>- {error && <FieldError>{error.message}</FieldError>}- </Field>- )}- />- {isOrgIdentity && (- <Controller- control={control}- name="hasDeleteProtection"- render={({ field: { onChange, value } }) => (- <Field orientation="horizontal">- <Toggle- id="delete-protection-enabled"- variant={isSubOrganization ? "sub-org" : "org"}- checked={value}- onCheckedChange={onChange}- />- <FieldContent>- <Label htmlFor="delete-protection-enabled">Delete Protection</Label>- <FieldDescription>- Prevents this identity from being deleted while enabled.- </FieldDescription>- </FieldContent>- </Field>- )}- />- )}- {isOrgIdentity && (- <div className="flex flex-col gap-2">- <Label>Metadata</Label>- <div- className={`flex max-h-[30vh] thin-scrollbar flex-col gap-3 overflow-y-auto rounded-md border border-border bg-container/50 p-4 ${- metadataFormFields.fields.length === 0 ? "border-dashed" : ""- }`}- >- {metadataFormFields.fields.length === 0 ? (- <p className="text-center text-sm text-muted">- No metadata entries. Click below to add.- </p>- ) : (- metadataFormFields.fields.map(({ id: metadataFieldId }, i) => (- <div key={metadataFieldId} className="flex items-start gap-2">- <Field className="flex-1">- {i === 0 && <FieldLabel className="text-xs">Key</FieldLabel>}- <FieldContent>- <Controller- control={control}- name={`metadata.${i}.key`}- render={({ field, fieldState: { error } }) => (- <>- <Input {...field} isError={Boolean(error)} />- {error && <FieldError>{error.message}</FieldError>}- </>- )}- />- </FieldContent>- </Field>- <Field className="flex-1">- {i === 0 && <FieldLabel className="text-xs">Value</FieldLabel>}- <FieldContent>- <Controller- control={control}- name={`metadata.${i}.value`}- render={({ field, fieldState: { error } }) => (- <>- <Input {...field} isError={Boolean(error)} />- {error && <FieldError>{error.message}</FieldError>}- </>- )}- />- </FieldContent>- </Field>- <IconButton- aria-label="Remove metadata entry"- variant="ghost"- size="sm"- type="button"- className={twMerge(i === 0 ? "mt-[27px]" : "mt-[3px]", "hover:text-danger")}- onClick={() => metadataFormFields.remove(i)}- >- <TrashIcon />- </IconButton>- </div>- ))+ {isOrgIdentity && (+ <Controller+ control={control}+ name="hasDeleteProtection"+ render={({ field: { onChange, value } }) => (+ <Field orientation="horizontal">+ <Toggle+ id="delete-protection-enabled"+ variant={isSubOrganization ? "sub-org" : "org"}+ checked={value}+ onCheckedChange={onChange}+ />+ <FieldContent>+ <Label htmlFor="delete-protection-enabled">Delete Protection</Label>+ <FieldDescription>+ Prevents this identity from being deleted while enabled.+ </FieldDescription>+ </FieldContent>+ </Field>)}- </div>- <div>- <Button- variant="ghost"- size="xs"- type="button"- onClick={() => metadataFormFields.append({ key: "", value: "" })}+ />+ )}+ {isOrgIdentity && (+ <div className="flex flex-col gap-2">+ <Label>Metadata</Label>+ <div+ className={`flex max-h-[30vh] thin-scrollbar flex-col gap-3 overflow-y-auto rounded-md border border-border bg-container/50 p-4 ${+ metadataFormFields.fields.length === 0 ? "border-dashed" : ""+ }`}>- <PlusIcon className="mr-1 size-4" />- Add Entry- </Button>+ {metadataFormFields.fields.length === 0 ? (+ <p className="text-center text-sm text-muted">+ No metadata entries. Click below to add.+ </p>+ ) : (+ metadataFormFields.fields.map(({ id: metadataFieldId }, i) => (+ <div key={metadataFieldId} className="flex items-start gap-2">+ <Field className="flex-1">+ {i === 0 && <FieldLabel className="text-xs">Key</FieldLabel>}+ <FieldContent>+ <Controller+ control={control}+ name={`metadata.${i}.key`}+ render={({ field, fieldState: { error } }) => (+ <>+ <Input {...field} isError={Boolean(error)} />+ {error && <FieldError>{error.message}</FieldError>}+ </>+ )}+ />+ </FieldContent>+ </Field>+ <Field className="flex-1">+ {i === 0 && <FieldLabel className="text-xs">Value</FieldLabel>}+ <FieldContent>+ <Controller+ control={control}+ name={`metadata.${i}.value`}+ render={({ field, fieldState: { error } }) => (+ <>+ <Input {...field} isError={Boolean(error)} />+ {error && <FieldError>{error.message}</FieldError>}+ </>+ )}+ />+ </FieldContent>+ </Field>+ <IconButton+ aria-label="Remove metadata entry"+ variant="ghost"+ size="sm"+ type="button"+ className={twMerge(i === 0 ? "mt-[27px]" : "mt-[3px]", "hover:text-danger")}+ onClick={() => metadataFormFields.remove(i)}+ >+ <TrashIcon />+ </IconButton>+ </div>+ ))+ )}+ </div>+ <div>+ <Button+ variant="ghost"+ size="xs"+ type="button"+ onClick={() => metadataFormFields.append({ key: "", value: "" })}+ >+ <PlusIcon className="mr-1 size-4" />+ Add Entry+ </Button>+ </div></div>- </div>- )}- <div className="flex items-center justify-end gap-2">- <Button- type="button"- variant="outline"- onClick={() => handlePopUpToggle("identity", false)}- >+ )}+ </DialogBody>+ <DialogFooter>+ <Button type="button" variant="ghost" onClick={() => handlePopUpToggle("identity", false)}>Cancel</Button><Button@@ -302,7 +301,7 @@ export const OrgIdentityModal = ({ popUp, handlePopUpToggle }: Props) => {>Update</Button>- </div>+ </DialogFooter><UpgradeGatepaywallKey="organization.org-identity"isOpen={upgradePlanPopUp.upgradePlan.isOpen}