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
improvement: adjust styling of project templates ui
Scott Wilson01cc2889cd8c
diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.tsindex cad4cc3d55..d82e352a7a 100644--- a/backend/src/ee/services/license/license-fns.ts+++ b/backend/src/ee/services/license/license-fns.ts@@ -84,7 +84,7 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({oidcSSO: false,scim: false,ldap: false,- groups: false,+ groups: true,status: null,trial_end: null,has_used_trial: true,@@ -104,11 +104,11 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({pkiPqc: false,kmsPqc: false,enforceMfa: false,- projectTemplates: false,+ projectTemplates: true,kmip: false,gateway: false,gatewayPool: false,- sshHostGroups: false,+ sshHostGroups: true,secretScanning: false,enterpriseSecretSyncs: false,enterpriseCertificateSyncs: false,@@ -118,8 +118,8 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({machineIdentityAuthTemplates: false,pkiLegacyTemplates: false,secretShareExternalBranding: false,- honeyTokens: false,- honeyTokenLimit: 0+ honeyTokens: true,+ honeyTokenLimit: 5});export const setupLicenseRequestWithStore = (diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/honey-token-config/HoneyTokenModal.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/honey-token-config/HoneyTokenModal.tsxindex 8a115ef02b..cb68bf031b 100644--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/honey-token-config/HoneyTokenModal.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/honey-token-config/HoneyTokenModal.tsx@@ -171,18 +171,11 @@ export const HoneyTokenModal = ({ isOpen, onOpenChange }: Props) => {});const onNext = async (data: FormData) => {- try {- await saveConfig(data);- createNotification({- text: "Settings saved. Deploy the CloudFormation stack, then click Save.",- type: "success"- });- } catch {- createNotification({- text: "Failed to save honey token settings",- type: "error"- });- }+ await saveConfig(data);+ createNotification({+ text: "Settings saved. Deploy the CloudFormation stack, then click Save.",+ type: "success"+ });};const onSave = async (data: FormData) => {@@ -373,10 +366,7 @@ export const HoneyTokenModal = ({ isOpen, onOpenChange }: Props) => {)}</div>- <SheetFooter>- <Button variant="ghost" onClick={() => onOpenChange(false)} type="button">- Cancel- </Button>+ <SheetFooter className="border-t"><OrgPermissionCanI={OrgPermissionHoneyTokenActions.Setup}a={OrgPermissionSubjects.HoneyTokens}@@ -392,6 +382,9 @@ export const HoneyTokenModal = ({ isOpen, onOpenChange }: Props) => {</Button>)}</OrgPermissionCan>+ <Button variant="ghost" onClick={() => onOpenChange(false)} type="button">+ Cancel+ </Button></SheetFooter></form></SheetContent>diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/EditProjectTemplate.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/EditProjectTemplate.tsxindex 34bdab1484..ed1c64dc60 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/EditProjectTemplate.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/EditProjectTemplate.tsx@@ -16,7 +16,7 @@ export const EditProjectTemplate = ({ isInfisicalTemplate, projectTemplate }: Prconst { type } = projectTemplate;return (- <>+ <div className="flex flex-col gap-6">{type === ProjectType.SecretManager && (<ProjectTemplateEnvironmentsFormisInfisicalTemplate={isInfisicalTemplate}@@ -34,6 +34,6 @@ export const EditProjectTemplate = ({ isInfisicalTemplate, projectTemplate }: Pr<ProjectTemplateIdentitiesSection projectTemplate={projectTemplate} /></>)}- </>+ </div>);};diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsxindex 899e01f4e0..8e5aae08e7 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx@@ -5,7 +5,7 @@ import { ChevronLeftIcon, SaveIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import { Accordion, Button, Field, FieldError, FieldLabel, Input } from "@app/components/v3";+import { Accordion, Button, Card, Field, FieldError, FieldLabel, Input } from "@app/components/v3";import { ProjectPermissionSub } from "@app/context";import { isCustomProjectRole } from "@app/helpers/roles";import { TProjectTemplate, useUpdateProjectTemplate } from "@app/hooks/api/projectTemplates";@@ -111,106 +111,107 @@ export const ProjectTemplateEditRoleForm = ({});return (- <form- onSubmit={handleFormSubmit}- className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"- >- <FormProvider {...formMethods}>- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <Button variant="ghost" disabled={isSubmitting} onClick={onGoBack}>- <ChevronLeftIcon />- {isDisabled ? "Back" : "Cancel"}- </Button>- {!isDisabled && (- <div className="flex items-center gap-2">- {isDirty && (- <Button- type="button"- className="mr-4 text-muted"- variant="ghost"- disabled={isSubmitting}- onClick={() => {- if (role) {- reset({ ...role, permissions: rolePermission2Form(role.permissions) });- } else {- onGoBack();- }- }}- >- Discard+ <form onSubmit={handleFormSubmit}>+ <Card className="gap-0 p-4">+ <FormProvider {...formMethods}>+ <div className="flex items-center justify-between border-b border-border pb-2">+ <Button variant="ghost" disabled={isSubmitting} onClick={onGoBack}>+ <ChevronLeftIcon />+ {isDisabled ? "Back" : "Cancel"}+ </Button>+ {!isDisabled && (+ <div className="flex items-center gap-2">+ {isDirty && (+ <Button+ type="button"+ className="mr-4 text-muted"+ variant="ghost"+ disabled={isSubmitting}+ onClick={() => {+ if (role) {+ reset({ ...role, permissions: rolePermission2Form(role.permissions) });+ } else {+ onGoBack();+ }+ }}+ >+ Discard+ </Button>+ )}+ <Button variant="project" type="submit" disabled={isSubmitting || !isDirty}>+ <SaveIcon />+ Save</Button>- )}- <Button variant="project" type="submit" disabled={isSubmitting || !isDirty}>- <SaveIcon />- Save- </Button>- <div className="ml-2 border-l border-border pl-4">- <AddPoliciesButton isDisabled={isDisabled} projectType={projectTemplate.type} />+ <div className="ml-2 border-l border-border pl-4">+ <AddPoliciesButton isDisabled={isDisabled} projectType={projectTemplate.type} />+ </div></div>- </div>- )}- </div>- <div className="mt-2 border-b border-gray-800 p-4 pt-2 first:rounded-t-md last:rounded-b-md">- {isDisabled ? (- <div className="flex flex-col">- <span className="text-lg font-medium">{role?.name}</span>- <span className="text-mineshaft-400">{role?.slug}</span>- </div>- ) : (- <div className="flex w-full gap-2">- <Controller- control={control}- name="name"- render={({ field, fieldState: { error } }) => (- <Field className="mb-0 flex-1">- <FieldLabel>Name</FieldLabel>- <Input {...field} autoFocus placeholder="Role name..." />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>- )}- />- <Controller- control={control}- name="slug"- render={({ field, fieldState: { error } }) => (- <Field className="mb-0 flex-1">- <FieldLabel>Slug</FieldLabel>- <Input {...field} placeholder="Role slug..." />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>+ )}+ </div>+ <div className="mt-2 border-b border-border p-4 pt-2 first:rounded-t-md last:rounded-b-md">+ {isDisabled ? (+ <div className="flex flex-col">+ <span className="text-lg font-medium">{role?.name}</span>+ <span className="text-mineshaft-400">{role?.slug}</span>+ </div>+ ) : (+ <div className="flex w-full gap-2">+ <Controller+ control={control}+ name="name"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-0 flex-1">+ <FieldLabel>Name</FieldLabel>+ <Input {...field} autoFocus placeholder="Role name..." />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />+ <Controller+ control={control}+ name="slug"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-0 flex-1">+ <FieldLabel>Slug</FieldLabel>+ <Input {...field} placeholder="Role slug..." />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />+ </div>+ )}+ </div>+ <div className="p-4">+ <div className="mb-2 text-lg">Policies</div>+ <PermissionEmptyState />+ {hasPermissions && (+ <Accordion+ type="multiple"+ value={openPolicies}+ onValueChange={setOpenPolicies}+ className="overflow-clip rounded-md border border-border bg-container"+ >+ {(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[]).map(+ (subject) => (+ <GeneralPermissionPolicies+ subject={subject}+ actions={PROJECT_PERMISSION_OBJECT[subject].actions as TPermissionAction[]}+ title={PROJECT_PERMISSION_OBJECT[subject].title}+ description={PROJECT_PERMISSION_OBJECT[subject].description}+ key={`project-permission-${subject}`}+ isDisabled={isDisabled}+ isOpen={openPolicies.includes(subject)}+ isConditional={isConditionalSubjects(subject)}+ >+ {renderConditionalComponents(subject, isDisabled)}+ </GeneralPermissionPolicies>+ ))}- />- </div>- )}- </div>- <div className="p-4">- <div className="mb-2 text-lg">Policies</div>- <PermissionEmptyState />- {hasPermissions && (- <Accordion- type="multiple"- value={openPolicies}- onValueChange={setOpenPolicies}- className="overflow-clip rounded-md border border-border bg-container"- >- {(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[]).map((subject) => (- <GeneralPermissionPolicies- subject={subject}- actions={PROJECT_PERMISSION_OBJECT[subject].actions as TPermissionAction[]}- title={PROJECT_PERMISSION_OBJECT[subject].title}- description={PROJECT_PERMISSION_OBJECT[subject].description}- key={`project-permission-${subject}`}- isDisabled={isDisabled}- isOpen={openPolicies.includes(subject)}- isConditional={isConditionalSubjects(subject)}- >- {renderConditionalComponents(subject, isDisabled)}- </GeneralPermissionPolicies>- ))}- </Accordion>- )}- </div>- </FormProvider>+ </Accordion>+ )}+ </div>+ </FormProvider>+ </Card></form>);};diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsxindex 2ff6a94454..1281d05a05 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx@@ -7,6 +7,15 @@ import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";import {Button,+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+ Empty,+ EmptyHeader,+ EmptyTitle,Field,FieldError,IconButton,@@ -87,188 +96,196 @@ export const ProjectTemplateEnvironmentsForm = ({Boolean(subscription.environmentLimit) && environments.length >= subscription.environmentLimit;return (- <form- onSubmit={handleSubmit(onFormSubmit)}- className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-7"- >- <div className="mb-8 flex items-start justify-between gap-4">- <div>- <h2 className="text-2xl font-semibold tracking-normal">Project Environments</h2>+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <Card>+ <CardHeader>+ <CardTitle>Project Environments</CardTitle>{!isInfisicalTemplate && (- <p className="mt-2 text-base text-mineshaft-300">+ <CardDescription>Add, rename, remove and reorder environments for this project template.- </p>+ </CardDescription>)}- </div>- {!isInfisicalTemplate && (- <div className="flex shrink-0 gap-2">- {isDirty && (+ {!isInfisicalTemplate && (+ <CardAction className="flex items-center gap-2">+ {isDirty && (+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <Button type="submit" variant="outline" isDisabled={!isAllowed}>+ <Save className="size-4" />+ Save Changes+ </Button>+ )}+ </OrgPermissionCan>+ )}<OrgPermissionCanI={OrgPermissionActions.Edit}a={OrgPermissionSubjects.ProjectTemplates}+ renderTooltip={isEnvironmentLimitExceeded ? true : undefined}+ allowedLabel={`Plan environment limit of ${subscription.environmentLimit} exceeded. Contact Infisical to increase limit.`}>{(isAllowed) => (- <Button type="submit" size="lg" variant="outline" isDisabled={!isAllowed}>- <Save className="size-4" />- Save Changes+ <Button+ onClick={() => append({ name: "", slug: "" })}+ variant="project"+ isDisabled={!isAllowed || isEnvironmentLimitExceeded}+ >+ <Plus className="size-4" />+ Add Environment</Button>)}</OrgPermissionCan>- )}- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- renderTooltip={isEnvironmentLimitExceeded ? true : undefined}- allowedLabel={`Plan environment limit of ${subscription.environmentLimit} exceeded. Contact Infisical to increase limit.`}- >- {(isAllowed) => (- <Button- onClick={() => append({ name: "", slug: "" })}- variant="project"- size="lg"- isDisabled={!isAllowed || isEnvironmentLimitExceeded}- >- <Plus className="size-4" />- Add Environment- </Button>- )}- </OrgPermissionCan>- </div>- )}- </div>- {errors.environments && (- <span className="my-4 text-sm text-red">{errors.environments.message}</span>- )}- <Table className="table-fixed">- <TableHeader>- <TableRow>- <TableHead>Name</TableHead>- <TableHead>Slug</TableHead>- {!isInfisicalTemplate && <TableHead className="h-12 w-44 px-5" />}- </TableRow>- </TableHeader>- <TableBody>- {environments.map(({ id, name, slug }, pos) => (- <TableRow key={id} className="hover:bg-transparent">- <TableCell>- {isInfisicalTemplate ? (- name- ) : (- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <Controller- control={control}- name={`environments.${pos}.name`}- render={({ field, fieldState: { error } }) => (- <Field className="mb-0 grow">- <Input- disabled={!isAllowed}- {...field}- className="h-8 border-transparent px-2 text-sm shadow-none hover:border-mineshaft-500 focus-visible:border-ring"- placeholder="Name..."- />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>- )}- />- )}- </OrgPermissionCan>- )}- </TableCell>- <TableCell>- {isInfisicalTemplate ? (- slug- ) : (- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <Controller- control={control}- name={`environments.${pos}.slug`}- render={({ field, fieldState: { error } }) => (- <Field className="mb-0 grow">- <Input- disabled={!isAllowed}- {...field}- className="h-8 border-transparent px-2 font-mono text-sm shadow-none hover:border-mineshaft-500 focus-visible:border-ring"- placeholder="Slug..."- />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>- )}- />- )}- </OrgPermissionCan>- )}- </TableCell>- {!isInfisicalTemplate && (- <TableCell>- <div className="flex items-center justify-end gap-3 text-mineshaft-400">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <IconButton- className={pos === 0 ? "pointer-events-none opacity-50" : ""}- onClick={() => move(pos, pos - 1)}- variant="ghost-muted"- size="xs"- aria-label="Move environment up"- isDisabled={pos === 0 || !isAllowed}- >- <ChevronUp className="size-4" />- </IconButton>- )}- </OrgPermissionCan>- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <IconButton- className={- pos === environments.length - 1 ? "pointer-events-none opacity-50" : ""- }- onClick={() => move(pos, pos + 1)}- variant="ghost-muted"- size="xs"- aria-label="Move environment down"- isDisabled={pos === environments.length - 1 || !isAllowed}+ </CardAction>+ )}+ </CardHeader>+ <CardContent>+ {errors.environments && (+ <span className="my-4 text-sm text-danger">{errors.environments.message}</span>+ )}+ {environments.length > 0 ? (+ <Table className="table-fixed">+ <TableHeader>+ <TableRow>+ <TableHead>Name</TableHead>+ <TableHead>Slug</TableHead>+ {!isInfisicalTemplate && <TableHead className="h-12 w-44 px-5" />}+ </TableRow>+ </TableHeader>+ <TableBody>+ {environments.map(({ id, name, slug }, pos) => (+ <TableRow key={id} className="h-14 hover:bg-transparent">+ <TableCell>+ {isInfisicalTemplate ? (+ name+ ) : (+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}>- <ChevronDown className="size-4" />- </IconButton>+ {(isAllowed) => (+ <Controller+ control={control}+ name={`environments.${pos}.name`}+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-0 grow">+ <Input+ disabled={!isAllowed}+ {...field}+ className="h-8 px-2 text-sm"+ placeholder="Name..."+ />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />+ )}+ </OrgPermissionCan>)}- </OrgPermissionCan>- <div className="h-7 w-px bg-mineshaft-600" />- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <IconButton- onClick={() => remove(pos)}- variant="ghost-muted"- size="xs"- aria-label="Remove environment"- isDisabled={!isAllowed}+ </TableCell>+ <TableCell>+ {isInfisicalTemplate ? (+ slug+ ) : (+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}>- <Trash2 className="size-4" />- </IconButton>+ {(isAllowed) => (+ <Controller+ control={control}+ name={`environments.${pos}.slug`}+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-0 grow">+ <Input+ disabled={!isAllowed}+ {...field}+ className="h-8 px-2 text-sm"+ placeholder="Slug..."+ />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />+ )}+ </OrgPermissionCan>)}- </OrgPermissionCan>- </div>- </TableCell>- )}- </TableRow>- ))}- </TableBody>- </Table>+ </TableCell>+ {!isInfisicalTemplate && (+ <TableCell>+ <div className="flex items-center justify-end gap-3 text-mineshaft-400">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <IconButton+ className={pos === 0 ? "pointer-events-none opacity-50" : ""}+ onClick={() => move(pos, pos - 1)}+ variant="ghost-muted"+ size="xs"+ aria-label="Move environment up"+ isDisabled={pos === 0 || !isAllowed}+ >+ <ChevronUp className="size-4" />+ </IconButton>+ )}+ </OrgPermissionCan>+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <IconButton+ className={+ pos === environments.length - 1+ ? "pointer-events-none opacity-50"+ : ""+ }+ onClick={() => move(pos, pos + 1)}+ variant="ghost-muted"+ size="xs"+ aria-label="Move environment down"+ isDisabled={pos === environments.length - 1 || !isAllowed}+ >+ <ChevronDown className="size-4" />+ </IconButton>+ )}+ </OrgPermissionCan>+ <div className="h-7 w-px bg-mineshaft-600" />+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <IconButton+ onClick={() => remove(pos)}+ variant="ghost-muted"+ size="xs"+ aria-label="Remove environment"+ isDisabled={!isAllowed}+ >+ <Trash2 className="size-4" />+ </IconButton>+ )}+ </OrgPermissionCan>+ </div>+ </TableCell>+ )}+ </TableRow>+ ))}+ </TableBody>+ </Table>+ ) : (+ <Empty className="border border-dashed">+ <EmptyHeader>+ <EmptyTitle>No environments added to this template</EmptyTitle>+ </EmptyHeader>+ </Empty>+ )}+ </CardContent>+ </Card></form>);};diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsxindex 8fbc6cd304..5a4e24fe62 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx@@ -8,6 +8,12 @@ import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";import {Button,+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,Dialog,DialogContent,DialogDescription,@@ -180,153 +186,156 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {return (<>- <form- onSubmit={handleSubmit(onFormSubmit)}- className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-7"- >- <div className="mb-8 flex items-start justify-between gap-4">- <div>- <h2 className="text-2xl font-semibold tracking-normal">Project Groups</h2>- <p className="mt-2 text-base text-mineshaft-300">+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <Card>+ <CardHeader>+ <CardTitle>Project Groups</CardTitle>+ <CardDescription>Add groups that will be automatically added to projects created from this template.- </p>- </div>-- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <div className="flex gap-3">- {isAllowed && isDirty && (- <>- <Button onClick={handleDiscard} variant="ghost" type="button" size="lg">- Discard- </Button>- <Button type="submit" variant="outline" size="lg">- <Save className="size-4" />- Save Changes+ </CardDescription>+ <CardAction>+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <div className="flex gap-3">+ {isAllowed && isDirty && (+ <>+ <Button onClick={handleDiscard} variant="ghost" type="button">+ Discard+ </Button>+ <Button type="submit" variant="outline">+ <Save className="size-4" />+ Save Changes+ </Button>+ </>+ )}+ <Button+ onClick={() => setIsAddGroupModalOpen(true)}+ variant="project"+ isDisabled={!isAllowed}+ type="button"+ >+ <Plus className="size-4" />+ Add Group</Button>- </>+ </div>)}- <Button- onClick={() => setIsAddGroupModalOpen(true)}- variant="project"- size="lg"- isDisabled={!isAllowed || availableOrgGroups.length === 0}- type="button"- >- <Plus className="size-4" />- Add Group- </Button>- </div>+ </OrgPermissionCan>+ </CardAction>+ </CardHeader>+ <CardContent>+ {errors.groups && (+ <span className="my-4 text-sm text-danger">{errors.groups.message}</span>)}- </OrgPermissionCan>- </div>- {errors.groups && <span className="my-4 text-sm text-red">{errors.groups.message}</span>}- {groups.length > 0 ? (- <Table className="table-fixed">- <TableHeader>- <TableRow>- <TableHead>Group</TableHead>- <TableHead>Roles</TableHead>- <TableHead />- </TableRow>- </TableHeader>- <TableBody>- {groups.map(({ id }, pos) => (- <TableRow key={id}>- <TableCell className="py-2">- <Controller- control={control}- name={`groups.${pos}.groupSlug`}- render={({ field }) => (- <p className="truncate">- <span className="text-sm font-medium text-mineshaft-100">- {getGroupName(field.value)}- </span>- </p>- )}- />- </TableCell>- <TableCell className="py-2">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (+ {groups.length > 0 ? (+ <Table className="table-fixed">+ <TableHeader>+ <TableRow>+ <TableHead>Group</TableHead>+ <TableHead>Roles</TableHead>+ <TableHead />+ </TableRow>+ </TableHeader>+ <TableBody>+ {groups.map(({ id }, pos) => (+ <TableRow key={id}>+ <TableCell className="py-2"><Controllercontrol={control}- name={`groups.${pos}.roles`}- render={({ field, fieldState: { error } }) => {- const availableRoleSlugs = new Set(availableRoles.map((r) => r.slug));- const orphanedRoles = field.value- .filter((slug) => !availableRoleSlugs.has(slug))- .map((slug) => ({ slug, name: slug }));- const allOptions = [...availableRoles, ...orphanedRoles];+ name={`groups.${pos}.groupSlug`}+ render={({ field }) => (+ <p className="truncate">+ <span className="text-sm font-medium text-mineshaft-100">+ {getGroupName(field.value)}+ </span>+ </p>+ )}+ />+ </TableCell>+ <TableCell className="py-2">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <Controller+ control={control}+ name={`groups.${pos}.roles`}+ render={({ field, fieldState: { error } }) => {+ const availableRoleSlugs = new Set(+ availableRoles.map((r) => r.slug)+ );+ const orphanedRoles = field.value+ .filter((slug) => !availableRoleSlugs.has(slug))+ .map((slug) => ({ slug, name: slug }));+ const allOptions = [...availableRoles, ...orphanedRoles];- const selectedValues = allOptions.filter((role) =>- field.value.includes(role.slug)- );+ const selectedValues = allOptions.filter((role) =>+ field.value.includes(role.slug)+ );- return (- <Field className="mb-0 max-w-[786px]">- <FilterableSelect- isMulti- isDisabled={!isAllowed}- options={allOptions}- value={selectedValues}- onChange={(selected) => {- field.onChange(- (selected as { slug: string; name: string }[]).map(- (s) => s.slug- )- );- }}- getOptionValue={(option) => option.slug}- getOptionLabel={(option) => option.name}- placeholder="Select roles..."- menuPosition="fixed"- />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>- );- }}- />- )}- </OrgPermissionCan>- </TableCell>- <TableCell className="py-2">- <div className="flex justify-end">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <IconButton- onClick={() => remove(pos)}- variant="ghost-muted"- size="xs"- aria-label="Remove group"- isDisabled={!isAllowed}+ return (+ <Field className="mb-0 max-w-[786px]">+ <FilterableSelect+ isMulti+ isDisabled={!isAllowed}+ options={allOptions}+ value={selectedValues}+ onChange={(selected) => {+ field.onChange(+ (selected as { slug: string; name: string }[]).map(+ (s) => s.slug+ )+ );+ }}+ getOptionValue={(option) => option.slug}+ getOptionLabel={(option) => option.name}+ placeholder="Select roles..."+ menuPosition="fixed"+ />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ );+ }}+ />+ )}+ </OrgPermissionCan>+ </TableCell>+ <TableCell className="py-2">+ <div className="flex justify-end">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}>- <Trash2 className="size-4" />- </IconButton>- )}- </OrgPermissionCan>- </div>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- ) : (- <Empty className="border border-dashed">- <EmptyHeader>- <EmptyTitle>No groups assigned to this template</EmptyTitle>- </EmptyHeader>- </Empty>- )}+ {(isAllowed) => (+ <IconButton+ onClick={() => remove(pos)}+ variant="ghost-muted"+ size="xs"+ aria-label="Remove group"+ isDisabled={!isAllowed}+ >+ <Trash2 className="size-4" />+ </IconButton>+ )}+ </OrgPermissionCan>+ </div>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ ) : (+ <Empty className="border border-dashed">+ <EmptyHeader>+ <EmptyTitle>No groups assigned to this template</EmptyTitle>+ </EmptyHeader>+ </Empty>+ )}+ </CardContent>+ </Card></form><Dialog open={isAddGroupModalOpen} onOpenChange={setIsAddGroupModalOpen}>diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsxindex f5a12f9a54..58de756183 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx@@ -9,6 +9,12 @@ import { OrgPermissionCan } from "@app/components/permissions";import {Badge,Button,+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,Dialog,DialogContent,DialogDescription,@@ -293,175 +299,173 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>return (<>- <form- onSubmit={handleSubmit(onFormSubmit)}- className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-7"- >- <div className="mb-8 flex items-start justify-between gap-4">- <div>- <h2 className="text-2xl font-semibold tracking-normal">Project Machine Identities</h2>- <p className="mt-2 text-base text-mineshaft-300">+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <Card>+ <CardHeader>+ <CardTitle>Project Machine Identities</CardTitle>+ <CardDescription>Add machine identities that will be automatically added to projects created from thistemplate.- </p>- </div>-- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <div className="flex gap-3">- {isAllowed && isDirty && (- <>- <Button onClick={handleDiscard} variant="ghost" type="button" size="lg">- Discard- </Button>- <Button type="submit" variant="outline" size="lg">- <Save className="size-4" />- Save Changes+ </CardDescription>+ <CardAction>+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <div className="flex gap-3">+ {isAllowed && isDirty && (+ <>+ <Button onClick={handleDiscard} variant="ghost" type="button">+ Discard+ </Button>+ <Button type="submit" variant="outline">+ <Save className="size-4" />+ Save Changes+ </Button>+ </>+ )}+ <Button+ onClick={() => setIsAddIdentityModalOpen(true)}+ variant="project"+ isDisabled={!isAllowed}+ type="button"+ >+ <Plus className="size-4" />+ Add Machine Identity</Button>- </>+ </div>)}- <Button- onClick={() => setIsAddIdentityModalOpen(true)}- variant="project"- size="lg"- isDisabled={!isAllowed}- type="button"- >- <Plus className="size-4" />- Add Machine Identity- </Button>- </div>+ </OrgPermissionCan>+ </CardAction>+ </CardHeader>+ <CardContent>+ {errors.identities && (+ <span className="my-4 text-sm text-danger">{errors.identities.message}</span>)}- </OrgPermissionCan>- </div>- {errors.identities && (- <span className="my-4 text-sm text-red">{errors.identities.message}</span>- )}- {errors.projectManagedIdentities && (- <span className="my-4 text-sm text-red">{errors.projectManagedIdentities.message}</span>- )}- {allIdentitiesForTable.length > 0 ? (- <Table className="table-fixed">- <TableHeader>- <TableRow>- <TableHead>Identity</TableHead>- <TableHead>Roles</TableHead>- <TableHead />- </TableRow>- </TableHeader>- <TableBody>- {allIdentitiesForTable.map((item) => (- <TableRow key={item.id}>- <TableCell className="py-2">- <p className="flex items-center gap-3 truncate">- <Tooltip>- <TooltipTrigger asChild>- <Badge isSquare variant={item.type === "project" ? "project" : "org"}>- {item.type === "project" ? <ProjectIcon /> : <OrgIcon />}- </Badge>- </TooltipTrigger>- <TooltipContent>- {item.type === "project"- ? "Managed by project"- : "Managed by organization"}- </TooltipContent>- </Tooltip>- <span className="truncate text-sm font-medium text-mineshaft-100">- {item.name}- </span>- </p>- </TableCell>- <TableCell className="py-2">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <Controller- control={control}- name={- item.type === "org"- ? `identities.${item.index}.roles`- : `projectManagedIdentities.${item.index}.roles`- }- render={({ field, fieldState: { error } }) => {- const availableRoleSlugs = new Set(availableRoles.map((r) => r.slug));- const orphanedRoles = field.value- .filter((slug) => !availableRoleSlugs.has(slug))- .map((slug) => ({ slug, name: slug }));- const allOptions = [...availableRoles, ...orphanedRoles];-- const selectedValues = allOptions.filter((role) =>- field.value.includes(role.slug)- );-- return (- <Field className="mb-0 max-w-[786px]">- <FilterableSelect- isMulti- isDisabled={!isAllowed}- options={allOptions}- value={selectedValues}- onChange={(selected) => {- field.onChange(- (selected as { slug: string; name: string }[]).map(- (s) => s.slug- )- );- }}- getOptionValue={(option) => option.slug}- getOptionLabel={(option) => option.name}- placeholder="Select roles..."- menuPosition="fixed"- />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>- );- }}- />- )}- </OrgPermissionCan>- </TableCell>- <TableCell className="py-2">- <div className="flex justify-end">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <IconButton- onClick={() => {- if (item.type === "org") {- removeIdentity(item.index);- } else {- removeProjectManagedIdentity(item.index);+ {errors.projectManagedIdentities && (+ <span className="my-4 text-sm text-danger">+ {errors.projectManagedIdentities.message}+ </span>+ )}+ {allIdentitiesForTable.length > 0 ? (+ <Table className="table-fixed">+ <TableHeader>+ <TableRow>+ <TableHead>Identity</TableHead>+ <TableHead>Roles</TableHead>+ <TableHead className="w-40">Managed By</TableHead>+ <TableHead className="w-16" />+ </TableRow>+ </TableHeader>+ <TableBody>+ {allIdentitiesForTable.map((item) => (+ <TableRow key={item.id}>+ <TableCell className="py-2">+ <p className="truncate">+ <span className="truncate text-sm font-medium text-mineshaft-100">+ {item.name}+ </span>+ </p>+ </TableCell>+ <TableCell className="py-2">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <Controller+ control={control}+ name={+ item.type === "org"+ ? `identities.${item.index}.roles`+ : `projectManagedIdentities.${item.index}.roles`}- }}- variant="ghost-muted"- size="xs"- aria-label="Remove identity"- isDisabled={!isAllowed}+ render={({ field, fieldState: { error } }) => {+ const availableRoleSlugs = new Set(+ availableRoles.map((r) => r.slug)+ );+ const orphanedRoles = field.value+ .filter((slug) => !availableRoleSlugs.has(slug))+ .map((slug) => ({ slug, name: slug }));+ const allOptions = [...availableRoles, ...orphanedRoles];++ const selectedValues = allOptions.filter((role) =>+ field.value.includes(role.slug)+ );++ return (+ <Field className="mb-0 max-w-[786px]">+ <FilterableSelect+ isMulti+ isDisabled={!isAllowed}+ options={allOptions}+ value={selectedValues}+ onChange={(selected) => {+ field.onChange(+ (selected as { slug: string; name: string }[]).map(+ (s) => s.slug+ )+ );+ }}+ getOptionValue={(option) => option.slug}+ getOptionLabel={(option) => option.name}+ placeholder="Select roles..."+ menuPosition="fixed"+ />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ );+ }}+ />+ )}+ </OrgPermissionCan>+ </TableCell>+ <TableCell className="py-2">+ <Badge variant={item.type === "project" ? "project" : "org"}>+ {item.type === "project" ? <ProjectIcon /> : <OrgIcon />}+ {item.type === "project" ? "Project" : "Organization"}+ </Badge>+ </TableCell>+ <TableCell className="py-2">+ <div className="flex justify-end">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}>- <Trash2 className="size-4" />- </IconButton>- )}- </OrgPermissionCan>- </div>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- ) : (- <Empty className="border border-dashed">- <EmptyHeader>- <EmptyTitle>No machine identities assigned to this template</EmptyTitle>- </EmptyHeader>- </Empty>- )}+ {(isAllowed) => (+ <IconButton+ onClick={() => {+ if (item.type === "org") {+ removeIdentity(item.index);+ } else {+ removeProjectManagedIdentity(item.index);+ }+ }}+ variant="ghost-muted"+ size="xs"+ aria-label="Remove identity"+ isDisabled={!isAllowed}+ >+ <Trash2 className="size-4" />+ </IconButton>+ )}+ </OrgPermissionCan>+ </div>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ ) : (+ <Empty className="border border-dashed">+ <EmptyHeader>+ <EmptyTitle>No machine identities assigned to this template</EmptyTitle>+ </EmptyHeader>+ </Empty>+ )}+ </CardContent>+ </Card></form><Dialog open={isAddIdentityModalOpen} onOpenChange={setIsAddIdentityModalOpen}>diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsxindex 621809d5bb..a53b0983cb 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx@@ -4,7 +4,14 @@ import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";import { DeleteActionModal } from "@app/components/v2";import {+ Badge,Button,+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,Empty,EmptyHeader,EmptyTitle,@@ -87,7 +94,7 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTemplaconst roleToDelete = popUp?.removeRole?.data as TProjectRole;return (- <div className="relative mb-6">+ <div>{popUp?.editRole.isOpen ? (<ProjectTemplateEditRoleFormonGoBack={() => handlePopUpClose("editRole")}@@ -99,38 +106,37 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTempla}/>) : (- <div className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-7">- <div className="mb-8 flex items-start justify-between gap-4">- <div>- <h2 className="text-2xl font-semibold tracking-normal">Project Roles</h2>- <p className="mt-2 text-base text-mineshaft-300">- {isInfisicalTemplate- ? "Click a role to view the associated permissions."- : "Add, edit and remove roles for this project template."}- </p>- </div>+ <Card>+ <CardHeader>+ <CardTitle>Project Roles</CardTitle>+ <CardDescription>+ {isInfisicalTemplate+ ? "Click a role to view the associated permissions."+ : "Add, edit and remove roles for this project template."}+ </CardDescription>{!isInfisicalTemplate && (- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <Button- onClick={() => {- handlePopUpOpen("editRole");- }}- variant="project"- size="lg"- isDisabled={!isAllowed}- >- <Plus className="size-4" />- Add Role- </Button>- )}- </OrgPermissionCan>+ <CardAction>+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <Button+ onClick={() => {+ handlePopUpOpen("editRole");+ }}+ variant="project"+ isDisabled={!isAllowed}+ >+ <Plus className="size-4" />+ Add Role+ </Button>+ )}+ </OrgPermissionCan>+ </CardAction>)}- </div>- <div>+ </CardHeader>+ <CardContent>{roles.length ? (<Table className="table-fixed"><TableHeader>@@ -158,19 +164,19 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTempla><TableCell>{role.name}</TableCell><TableCell>- <span className="inline-flex items-center gap-1.5 rounded-md border border-mineshaft-500 bg-mineshaft-700 px-2 py-0.5 text-sm font-medium text-mineshaft-200">+ <Badge variant="neutral">{isCustomRole ? (<>- <WrenchIcon className="size-4 text-mineshaft-300" />+ <WrenchIcon />Custom</>) : (<>- <Rows3 className="size-4 text-mineshaft-300" />+ <Rows3 />Platform</>)}- </span>+ </Badge></TableCell><TableCell><div className="flex justify-end">@@ -212,7 +218,7 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTempla</EmptyHeader></Empty>)}- </div>+ </CardContent><DeleteActionModalisOpen={popUp.removeRole.isOpen}deleteKey="remove"@@ -220,7 +226,7 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTemplaonChange={(isOpen) => handlePopUpToggle("removeRole", isOpen)}onDeleteApproved={() => handleRemoveRole(roleToDelete?.slug)}/>- </div>+ </Card>)}</div>);diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsxindex 9e65b1a945..d9ba8043b7 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx@@ -8,6 +8,12 @@ import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";import {Button,+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,Dialog,DialogContent,DialogDescription,@@ -181,153 +187,156 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {return (<>- <form- onSubmit={handleSubmit(onFormSubmit)}- className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-7"- >- <div className="mb-8 flex items-start justify-between gap-4">- <div>- <h2 className="text-2xl font-semibold tracking-normal">Project Members</h2>- <p className="mt-2 text-base text-mineshaft-300">+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <Card>+ <CardHeader>+ <CardTitle>Project Members</CardTitle>+ <CardDescription>Add users who will be automatically added to projects created from this template.- </p>- </div>-- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <div className="flex gap-3">- {isAllowed && isDirty && (- <>- <Button onClick={handleDiscard} variant="ghost" type="button" size="lg">- Discard- </Button>- <Button type="submit" variant="outline" size="lg">- <Save className="size-4" />- Save Changes+ </CardDescription>+ <CardAction>+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <div className="flex gap-3">+ {isAllowed && isDirty && (+ <>+ <Button onClick={handleDiscard} variant="ghost" type="button">+ Discard+ </Button>+ <Button type="submit" variant="outline">+ <Save className="size-4" />+ Save Changes+ </Button>+ </>+ )}+ <Button+ onClick={() => setIsAddUserModalOpen(true)}+ variant="project"+ isDisabled={!isAllowed || availableOrgUsers.length === 0}+ type="button"+ >+ <Plus className="size-4" />+ Add User</Button>- </>+ </div>)}- <Button- onClick={() => setIsAddUserModalOpen(true)}- variant="project"- size="lg"- isDisabled={!isAllowed || availableOrgUsers.length === 0}- type="button"- >- <Plus className="size-4" />- Add User- </Button>- </div>+ </OrgPermissionCan>+ </CardAction>+ </CardHeader>+ <CardContent>+ {errors.users && (+ <span className="my-4 text-sm text-danger">{errors.users.message}</span>)}- </OrgPermissionCan>- </div>- {errors.users && <span className="my-4 text-sm text-red">{errors.users.message}</span>}- {users.length > 0 ? (- <Table className="table-fixed">- <TableHeader>- <TableRow>- <TableHead>Username</TableHead>- <TableHead>Roles</TableHead>- <TableHead />- </TableRow>- </TableHeader>- <TableBody>- {users.map(({ id }, pos) => (- <TableRow key={id}>- <TableCell className="py-2">- <Controller- control={control}- name={`users.${pos}.username`}- render={({ field }) => (- <p className="truncate">- <span className="text-sm font-medium text-mineshaft-100">- {field.value}- </span>- </p>- )}- />- </TableCell>- <TableCell className="py-2">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (+ {users.length > 0 ? (+ <Table className="table-fixed">+ <TableHeader>+ <TableRow>+ <TableHead>Username</TableHead>+ <TableHead>Roles</TableHead>+ <TableHead />+ </TableRow>+ </TableHeader>+ <TableBody>+ {users.map(({ id }, pos) => (+ <TableRow key={id}>+ <TableCell className="py-2"><Controllercontrol={control}- name={`users.${pos}.roles`}- render={({ field, fieldState: { error } }) => {- const availableRoleSlugs = new Set(availableRoles.map((r) => r.slug));- const orphanedRoles = field.value- .filter((slug) => !availableRoleSlugs.has(slug))- .map((slug) => ({ slug, name: slug }));- const allOptions = [...availableRoles, ...orphanedRoles];+ name={`users.${pos}.username`}+ render={({ field }) => (+ <p className="truncate">+ <span className="text-sm font-medium text-mineshaft-100">+ {field.value}+ </span>+ </p>+ )}+ />+ </TableCell>+ <TableCell className="py-2">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}+ >+ {(isAllowed) => (+ <Controller+ control={control}+ name={`users.${pos}.roles`}+ render={({ field, fieldState: { error } }) => {+ const availableRoleSlugs = new Set(+ availableRoles.map((r) => r.slug)+ );+ const orphanedRoles = field.value+ .filter((slug) => !availableRoleSlugs.has(slug))+ .map((slug) => ({ slug, name: slug }));+ const allOptions = [...availableRoles, ...orphanedRoles];- const selectedValues = allOptions.filter((role) =>- field.value.includes(role.slug)- );+ const selectedValues = allOptions.filter((role) =>+ field.value.includes(role.slug)+ );- return (- <Field className="mb-0 max-w-[786px]">- <FilterableSelect- isMulti- isDisabled={!isAllowed}- options={allOptions}- value={selectedValues}- onChange={(selected) => {- field.onChange(- (selected as { slug: string; name: string }[]).map(- (s) => s.slug- )- );- }}- getOptionValue={(option) => option.slug}- getOptionLabel={(option) => option.name}- placeholder="Select roles..."- menuPosition="fixed"- />- {error?.message && <FieldError>{error.message}</FieldError>}- </Field>- );- }}- />- )}- </OrgPermissionCan>- </TableCell>- <TableCell className="py-2">- <div className="flex justify-end">- <OrgPermissionCan- I={OrgPermissionActions.Edit}- a={OrgPermissionSubjects.ProjectTemplates}- >- {(isAllowed) => (- <IconButton- onClick={() => remove(pos)}- variant="ghost-muted"- size="xs"- aria-label="Remove user"- isDisabled={!isAllowed}+ return (+ <Field className="mb-0 max-w-[786px]">+ <FilterableSelect+ isMulti+ isDisabled={!isAllowed}+ options={allOptions}+ value={selectedValues}+ onChange={(selected) => {+ field.onChange(+ (selected as { slug: string; name: string }[]).map(+ (s) => s.slug+ )+ );+ }}+ getOptionValue={(option) => option.slug}+ getOptionLabel={(option) => option.name}+ placeholder="Select roles..."+ menuPosition="fixed"+ />+ {error?.message && <FieldError>{error.message}</FieldError>}+ </Field>+ );+ }}+ />+ )}+ </OrgPermissionCan>+ </TableCell>+ <TableCell className="py-2">+ <div className="flex justify-end">+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ a={OrgPermissionSubjects.ProjectTemplates}>- <Trash2 className="size-4" />- </IconButton>- )}- </OrgPermissionCan>- </div>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- ) : (- <Empty className="border border-dashed">- <EmptyHeader>- <EmptyTitle>No users assigned to this template</EmptyTitle>- </EmptyHeader>- </Empty>- )}+ {(isAllowed) => (+ <IconButton+ onClick={() => remove(pos)}+ variant="ghost-muted"+ size="xs"+ aria-label="Remove user"+ isDisabled={!isAllowed}+ >+ <Trash2 className="size-4" />+ </IconButton>+ )}+ </OrgPermissionCan>+ </div>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ ) : (+ <Empty className="border border-dashed">+ <EmptyHeader>+ <EmptyTitle>No users assigned to this template</EmptyTitle>+ </EmptyHeader>+ </Empty>+ )}+ </CardContent>+ </Card></form><Dialog open={isAddUserModalOpen} onOpenChange={setIsAddUserModalOpen}>diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsxindex 15df24944c..41642440ef 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx@@ -90,7 +90,6 @@ export const ProjectTemplatePage = ({ templateId, projectType, onBack }: Props){(isAllowed) => (<ButtonisDisabled={!isAllowed}- size="lg"variant="outline"onClick={() => handlePopUpOpen("editDetails")}>@@ -107,9 +106,7 @@ export const ProjectTemplatePage = ({ templateId, projectType, onBack }: Props)<ButtonisDisabled={!isAllowed}onClick={() => handlePopUpOpen("removeTemplate")}- size="lg"variant="danger"- className="text-red-200"><Trash2 className="size-4" />Delete Templatediff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsxindex 918efc8cd8..473bcee264 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx@@ -1,4 +1,4 @@-import { LayoutTemplate } from "lucide-react";+import { LayoutTemplate, PlusIcon } from "lucide-react";import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";import { OrgPermissionCan } from "@app/components/permissions";@@ -64,6 +64,7 @@ export const ProjectTemplatesSection = ({ projectType, onTemplateSelect }: PropshandlePopUpOpen("addTemplate");}}>+ <PlusIcon />Add Template</Button>)}diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesTable.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesTable.tsxindex 3bbbe385b7..e48dad400d 100644--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesTable.tsx+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesTable.tsx@@ -133,18 +133,18 @@ export const ProjectTemplatesTable = ({ projectType, onEdit }: Props) => {{description && (<Tooltip><TooltipTrigger asChild>- <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />+ <InfoIcon className="mb-0.5 ml-2 inline-block size-3.5! text-muted" /></TooltipTrigger><TooltipContent>{description}</TooltipContent></Tooltip>)}</TableCell>- <TableCell className="pl-8">+ <TableCell>{roles.length}{roles.length > 0 && (<Tooltip><TooltipTrigger asChild>- <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />+ <InfoIcon className="mb-0.5 ml-2 inline-block size-3.5! text-muted" /></TooltipTrigger><TooltipContent><ul className="ml-2 list-disc">@@ -156,12 +156,12 @@ export const ProjectTemplatesTable = ({ projectType, onEdit }: Props) => {</Tooltip>)}</TableCell>- <TableCell className="pl-8">+ <TableCell>{users?.length || 0}{users && Boolean(users.length) && (<Tooltip><TooltipTrigger asChild>- <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />+ <InfoIcon className="mb-0.5 ml-2 inline-block size-3.5! text-muted" /></TooltipTrigger><TooltipContent><ul className="ml-2 list-disc">@@ -173,12 +173,12 @@ export const ProjectTemplatesTable = ({ projectType, onEdit }: Props) => {</Tooltip>)}</TableCell>- <TableCell className="pl-8">+ <TableCell>{groups?.length || 0}{groups && Boolean(groups.length) && (<Tooltip><TooltipTrigger asChild>- <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />+ <InfoIcon className="inline-blocktext-muted ml-2" /></TooltipTrigger><TooltipContent><ul className="ml-2 list-disc">@@ -190,12 +190,12 @@ export const ProjectTemplatesTable = ({ projectType, onEdit }: Props) => {</Tooltip>)}</TableCell>- <TableCell className="pl-8">+ <TableCell>{totalIdentities}{Boolean(totalIdentities) && (<Tooltip><TooltipTrigger asChild>- <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />+ <InfoIcon size={14} className="ml-2 inline-block text-muted" /></TooltipTrigger><TooltipContent><ul className="ml-2 list-disc">