Skip to content

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

scott suggestions

Matheus Nogueira729abef990ac
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/EditProjectTemplateSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/EditProjectTemplateSection.tsx
index c83982936e..909d94e4f8 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/EditProjectTemplateSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/EditProjectTemplateSection.tsx
@@ -42,7 +42,7 @@ export const EditProjectTemplateSection = ({ templateId, onBack }: Props) => {
onBack={onBack}
/>
) : (
- <Empty className="py-12">
+ <Empty className="border border-dashed">
<EmptyHeader>
<EmptyTitle>Error: Unable to find project template.</EmptyTitle>
</EmptyHeader>
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx
index 648625c7bb..53a138f6ee 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx
@@ -224,20 +224,20 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {
</OrgPermissionCan>
</div>
{errors.groups && <span className="my-4 text-sm text-red">{errors.groups.message}</span>}
- <Table
- className="table-fixed"
- containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
- >
- <TableHeader>
- <TableRow>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Group</TableHead>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Roles</TableHead>
- <TableHead className="h-12 w-20 px-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {groups.length > 0 ? (
- groups.map(({ id }, pos) => (
+ {groups.length > 0 ? (
+ <Table
+ className="table-fixed"
+ containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
+ >
+ <TableHeader>
+ <TableRow>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Group</TableHead>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Roles</TableHead>
+ <TableHead className="h-12 w-20 px-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {groups.map(({ id }, pos) => (
<TableRow key={id} className="hover:bg-transparent">
<TableCell className="h-[58px] w-1/3 max-w-0 px-5 py-2">
<Controller
@@ -320,20 +320,16 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {
</div>
</TableCell>
</TableRow>
- ))
- ) : (
- <TableRow>
- <TableCell colSpan={3} className="h-24 p-0">
- <Empty className="h-full rounded-none border-0 bg-mineshaft-800 p-6 md:p-8">
- <EmptyHeader>
- <EmptyTitle>No groups assigned to this template</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ ))}
+ </TableBody>
+ </Table>
+ ) : (
+ <Empty className="border border-dashed">
+ <EmptyHeader>
+ <EmptyTitle>No groups assigned to this template</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ )}
</form>
<Dialog open={isAddGroupModalOpen} onOpenChange={setIsAddGroupModalOpen}>
@@ -394,16 +390,17 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {
)}
/>
</div>
- <div className="mt-8 flex items-center gap-4">
+ <div className="mt-8 flex items-center justify-end gap-4">
+ <Button type="button" variant="ghost" onClick={handleCloseAddGroupModal}>
+ Cancel
+ </Button>
<Button
type="submit"
+ variant="project"
isDisabled={selectedGroupsInModal.length === 0 || selectedRolesInModal.length === 0}
>
Add Groups
</Button>
- <Button type="button" variant="ghost" onClick={handleCloseAddGroupModal}>
- Cancel
- </Button>
</div>
</form>
</DialogContent>
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx
index d3d404776b..2216194e84 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx
@@ -2,7 +2,6 @@ import { useMemo, useState } from "react";
import { Controller, useFieldArray, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { InfoIcon, Plus, Save, Trash2 } from "lucide-react";
-import { twMerge } from "tailwind-merge";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
@@ -26,6 +25,9 @@ import {
Input,
OrgIcon,
ProjectIcon,
+ Tabs,
+ TabsList,
+ TabsTrigger,
Table,
TableBody,
TableCell,
@@ -341,20 +343,20 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
{errors.projectManagedIdentities && (
<span className="my-4 text-sm text-red">{errors.projectManagedIdentities.message}</span>
)}
- <Table
- className="table-fixed"
- containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
- >
- <TableHeader>
- <TableRow>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Identity</TableHead>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Roles</TableHead>
- <TableHead className="h-12 w-20 px-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {allIdentitiesForTable.length > 0 ? (
- allIdentitiesForTable.map((item) => (
+ {allIdentitiesForTable.length > 0 ? (
+ <Table
+ className="table-fixed"
+ containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
+ >
+ <TableHeader>
+ <TableRow>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Identity</TableHead>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Roles</TableHead>
+ <TableHead className="h-12 w-20 px-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {allIdentitiesForTable.map((item) => (
<TableRow key={item.id} className="hover:bg-transparent">
<TableCell className="h-[58px] w-1/3 max-w-0 px-5 py-2">
<p className="flex items-center gap-3 truncate">
@@ -453,20 +455,16 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
</div>
</TableCell>
</TableRow>
- ))
- ) : (
- <TableRow>
- <TableCell colSpan={3} className="h-24 p-0">
- <Empty className="h-full rounded-none border-0 bg-mineshaft-800 p-6 md:p-8">
- <EmptyHeader>
- <EmptyTitle>No machine identities assigned to this template</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ ))}
+ </TableBody>
+ </Table>
+ ) : (
+ <Empty className="border border-dashed">
+ <EmptyHeader>
+ <EmptyTitle>No machine identities assigned to this template</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ )}
</form>
<Dialog open={isAddIdentityModalOpen} onOpenChange={setIsAddIdentityModalOpen}>
@@ -478,38 +476,18 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
</DialogDescription>
</DialogHeader>
<div className="mb-4 flex items-center justify-center gap-x-2">
- <div className="flex w-3/4 gap-x-0.5 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-1">
- <Button
- variant="outline"
- onClick={() => {
- setAddMachineIdentityType(AddIdentityType.CreateNew);
- }}
- size="xs"
- className={twMerge(
- "min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600",
- addMachineIdentityType === AddIdentityType.CreateNew
- ? "bg-mineshaft-500"
- : "bg-transparent"
- )}
- >
- Create New
- </Button>
- <Button
- variant="outline"
- onClick={() => {
- setAddMachineIdentityType(AddIdentityType.AssignExisting);
- }}
- size="xs"
- className={twMerge(
- "min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600",
- addMachineIdentityType === AddIdentityType.AssignExisting
- ? "bg-mineshaft-500"
- : "bg-transparent"
- )}
- >
- Assign Existing
- </Button>
- </div>
+ <Tabs
+ value={String(addMachineIdentityType)}
+ onValueChange={(val) => setAddMachineIdentityType(Number(val) as AddIdentityType)}
+ className="w-3/4"
+ >
+ <TabsList variant="filled" className="w-full">
+ <TabsTrigger value={String(AddIdentityType.CreateNew)}>Create New</TabsTrigger>
+ <TabsTrigger value={String(AddIdentityType.AssignExisting)}>
+ Assign Existing
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
<Tooltip>
<TooltipTrigger asChild>
<InfoIcon size={16} className="text-mineshaft-400" />
@@ -574,18 +552,18 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
</Field>
)}
/>
- <div className="mt-4 flex items-center">
+ <div className="mt-4 flex items-center justify-end gap-4">
+ <Button type="button" variant="ghost" onClick={handleCloseAddIdentityModal}>
+ Cancel
+ </Button>
<Button
- className="mr-4"
size="sm"
type="submit"
+ variant="project"
isDisabled={!projectIdentityName || selectedProjectRolesInModal.length === 0}
>
Add to Template
</Button>
- <Button type="button" variant="ghost" onClick={handleCloseAddIdentityModal}>
- Cancel
- </Button>
</div>
</form>
)}
@@ -634,18 +612,18 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
</Field>
)}
/>
- <div className="mt-4 flex items-center">
+ <div className="mt-4 flex items-center justify-end gap-4">
+ <Button type="button" variant="ghost" onClick={handleCloseAddIdentityModal}>
+ Cancel
+ </Button>
<Button
- className="mr-4"
size="sm"
type="submit"
+ variant="project"
isDisabled={!selectedOrgIdentity || selectedOrgRolesInModal.length === 0}
>
Assign to Template
</Button>
- <Button type="button" variant="ghost" onClick={handleCloseAddIdentityModal}>
- Cancel
- </Button>
</div>
</form>
)}
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
index ee9fad512e..f20e12c52d 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
@@ -131,20 +131,20 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTempla
)}
</div>
<div>
- <Table
- className="table-fixed"
- containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
- >
- <TableHeader>
- <TableRow>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Name</TableHead>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Type</TableHead>
- <TableHead className="h-12 w-20 px-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {roles.length ? (
- roles.map((role) => {
+ {roles.length ? (
+ <Table
+ className="table-fixed"
+ containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
+ >
+ <TableHeader>
+ <TableRow>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Name</TableHead>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Type</TableHead>
+ <TableHead className="h-12 w-20 px-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {roles.map((role) => {
const isCustomRole = isCustomProjectRole(role.slug);
return (
@@ -208,20 +208,16 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTempla
</TableCell>
</TableRow>
);
- })
- ) : (
- <TableRow>
- <TableCell colSpan={3} className="h-24 p-0">
- <Empty className="h-full rounded-none border-0 bg-mineshaft-800 p-6 md:p-8">
- <EmptyHeader>
- <EmptyTitle>No roles assigned to template</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ })}
+ </TableBody>
+ </Table>
+ ) : (
+ <Empty className="border border-dashed">
+ <EmptyHeader>
+ <EmptyTitle>No roles assigned to template</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ )}
</div>
<DeleteActionModal
isOpen={popUp.removeRole.isOpen}
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx
index fda6a0301f..944673899c 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx
@@ -225,20 +225,20 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {
</OrgPermissionCan>
</div>
{errors.users && <span className="my-4 text-sm text-red">{errors.users.message}</span>}
- <Table
- className="table-fixed"
- containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
- >
- <TableHeader>
- <TableRow>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Username</TableHead>
- <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Roles</TableHead>
- <TableHead className="h-12 w-20 px-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {users.length > 0 ? (
- users.map(({ id }, pos) => (
+ {users.length > 0 ? (
+ <Table
+ className="table-fixed"
+ containerClassName="rounded-lg border-mineshaft-600 bg-mineshaft-800"
+ >
+ <TableHeader>
+ <TableRow>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Username</TableHead>
+ <TableHead className="h-12 px-5 text-sm text-mineshaft-200">Roles</TableHead>
+ <TableHead className="h-12 w-20 px-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {users.map(({ id }, pos) => (
<TableRow key={id} className="hover:bg-transparent">
<TableCell className="h-[58px] w-1/3 max-w-0 px-5 py-2">
<Controller
@@ -321,20 +321,16 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {
</div>
</TableCell>
</TableRow>
- ))
- ) : (
- <TableRow>
- <TableCell colSpan={3} className="h-24 p-0">
- <Empty className="h-full rounded-none border-0 bg-mineshaft-800 p-6 md:p-8">
- <EmptyHeader>
- <EmptyTitle>No users assigned to this template</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ ))}
+ </TableBody>
+ </Table>
+ ) : (
+ <Empty className="border border-dashed">
+ <EmptyHeader>
+ <EmptyTitle>No users assigned to this template</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ )}
</form>
<Dialog open={isAddUserModalOpen} onOpenChange={setIsAddUserModalOpen}>
@@ -393,16 +389,17 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {
)}
/>
</div>
- <div className="mt-8 flex items-center gap-4">
+ <div className="mt-8 flex items-center justify-end gap-4">
+ <Button type="button" variant="ghost" onClick={handleCloseAddUserModal}>
+ Cancel
+ </Button>
<Button
type="submit"
+ variant="project"
isDisabled={selectedUsersInModal.length === 0 || selectedRolesInModal.length === 0}
>
Add Users
</Button>
- <Button type="button" variant="ghost" onClick={handleCloseAddUserModal}>
- Cancel
- </Button>
</div>
</form>
</DialogContent>
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplateDetailsModal.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplateDetailsModal.tsx
index 3612157546..91d98daaa2 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplateDetailsModal.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplateDetailsModal.tsx
@@ -98,19 +98,19 @@ const ProjectTemplateForm = ({ onComplete, projectTemplate }: FormProps) => {
/>
{errors.description?.message && <FieldError>{errors.description.message}</FieldError>}
</Field>
- <div className="mt-4 flex items-center">
+ <div className="mt-4 flex items-center justify-end gap-4">
+ <DialogClose asChild>
+ <Button variant="ghost">Cancel</Button>
+ </DialogClose>
<Button
- className="mr-4"
size="sm"
type="submit"
+ variant="project"
isPending={isSubmitting}
isDisabled={isSubmitting}
>
{projectTemplate ? "Update" : "Add"} Template
</Button>
- <DialogClose asChild>
- <Button variant="ghost">Cancel</Button>
- </DialogClose>
</div>
</form>
);
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplatesTable.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplatesTable.tsx
index b26e04305e..d76b99ce83 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplatesTable.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/project-templates/ProjectTemplatesTable.tsx
@@ -1,6 +1,5 @@
import { useMemo, useState } from "react";
-import { faCircleInfo, faMagnifyingGlass, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon, Search, Trash2 } from "lucide-react";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -27,6 +26,7 @@ import { usePopUp } from "@app/hooks";
import { TProjectTemplate, useListProjectTemplates } from "@app/hooks/api/projectTemplates";
import { DeleteProjectTemplateModal } from "./DeleteProjectTemplateModal";
+import { ProjectType } from "@app/hooks/api/projects/types";
type Props = {
onEdit: (projectTemplate: TProjectTemplate) => void;
@@ -57,19 +57,21 @@ export const ProjectTemplatesTable = ({ onEdit }: Props) => {
() =>
projectTemplates?.filter(
(template) =>
- template.name !== "default" &&
+ template.name !== 'default' &&
+ template.type === ProjectType.SecretManager &&
template.name.toLowerCase().includes(search.toLowerCase().trim())
) ?? [],
[search, projectTemplates]
);
- const colSpan = tableColumnKeys.length;
+ const shouldShowEmptyState =
+ !subscription?.projectTemplates || (!isPending && filteredTemplates?.length === 0);
return (
<div>
<InputGroup>
<InputGroupAddon>
- <FontAwesomeIcon icon={faMagnifyingGlass} />
+ <Search className="size-4" />
</InputGroupAddon>
<InputGroupInput
value={search}
@@ -77,197 +79,174 @@ export const ProjectTemplatesTable = ({ onEdit }: Props) => {
placeholder="Search templates..."
/>
</InputGroup>
- <Table containerClassName="mt-4">
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Roles</TableHead>
- <TableHead>Users</TableHead>
- <TableHead>Groups</TableHead>
- <TableHead>Machine Identities</TableHead>
- <TableHead />
- </TableRow>
- </TableHeader>
- <TableBody>
- {subscription?.projectTemplates &&
- isPending &&
- skeletonRowIds.map((rowId) => (
- <TableRow key={rowId}>
- {tableColumnKeys.map((columnKey) => (
- <TableCell key={`${rowId}-${columnKey}`}>
- <Skeleton className="h-5 w-full" />
- </TableCell>
- ))}
- </TableRow>
- ))}
- {filteredTemplates.map((template) => {
- const {
- id,
- name,
- roles,
- description,
- users,
- groups,
- identities,
- projectManagedIdentities
- } = template;
+ {shouldShowEmptyState ? (
+ <Empty className="border border-dashed">
+ <EmptyHeader>
+ <EmptyTitle>
+ {search.trim() ? "No project templates match search" : "No project templates found"}
+ </EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ ) : (
+ <Table containerClassName="mt-4">
+ <TableHeader>
+ <TableRow>
+ <TableHead>Name</TableHead>
+ <TableHead>Roles</TableHead>
+ <TableHead>Users</TableHead>
+ <TableHead>Groups</TableHead>
+ <TableHead>Machine Identities</TableHead>
+ <TableHead />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {subscription?.projectTemplates &&
+ isPending &&
+ skeletonRowIds.map((rowId) => (
+ <TableRow key={rowId}>
+ {tableColumnKeys.map((columnKey) => (
+ <TableCell key={`${rowId}-${columnKey}`}>
+ <Skeleton className="h-5 w-full" />
+ </TableCell>
+ ))}
+ </TableRow>
+ ))}
+ {filteredTemplates.map((template) => {
+ const {
+ id,
+ name,
+ roles,
+ description,
+ users,
+ groups,
+ identities,
+ projectManagedIdentities
+ } = template;
- const totalIdentities =
- (identities?.length || 0) + (projectManagedIdentities?.length || 0);
+ const totalIdentities =
+ (identities?.length || 0) + (projectManagedIdentities?.length || 0);
- return (
- <TableRow
- onClick={() => onEdit(template)}
- className="cursor-pointer hover:bg-mineshaft-700"
- key={id}
- >
- <TableCell>
- {name}
- {description && (
- <Tooltip>
- <TooltipTrigger asChild>
- <FontAwesomeIcon
- size="sm"
- className="ml-2 text-mineshaft-400"
- icon={faCircleInfo}
- />
- </TooltipTrigger>
- <TooltipContent>{description}</TooltipContent>
- </Tooltip>
- )}
- </TableCell>
- <TableCell className="pl-8">
- {roles.length}
- {roles.length > 0 && (
- <Tooltip>
- <TooltipTrigger asChild>
- <FontAwesomeIcon
- size="sm"
- className="ml-2 text-mineshaft-400"
- icon={faCircleInfo}
- />
- </TooltipTrigger>
- <TooltipContent>
- <ul className="ml-2 list-disc">
- {roles.map((role) => (
- <li key={role.name}>{role.name}</li>
- ))}
- </ul>
- </TooltipContent>
- </Tooltip>
- )}
- </TableCell>
- <TableCell className="pl-8">
- {users?.length || 0}
- {users && Boolean(users.length) && (
- <Tooltip>
- <TooltipTrigger asChild>
- <FontAwesomeIcon
- size="sm"
- className="ml-2 text-mineshaft-400"
- icon={faCircleInfo}
- />
- </TooltipTrigger>
- <TooltipContent>
- <ul className="ml-2 list-disc">
- {users.map((user) => (
- <li key={user.username}>{user.username}</li>
- ))}
- </ul>
- </TooltipContent>
- </Tooltip>
- )}
- </TableCell>
- <TableCell className="pl-8">
- {groups?.length || 0}
- {groups && Boolean(groups.length) && (
- <Tooltip>
- <TooltipTrigger asChild>
- <FontAwesomeIcon
- size="sm"
- className="ml-2 text-mineshaft-400"
- icon={faCircleInfo}
- />
- </TooltipTrigger>
- <TooltipContent>
- <ul className="ml-2 list-disc">
- {groups.map((group) => (
- <li key={group.groupSlug}>{group.groupSlug}</li>
- ))}
- </ul>
- </TooltipContent>
- </Tooltip>
- )}
- </TableCell>
- <TableCell className="pl-8">
- {totalIdentities}
- {Boolean(totalIdentities) && (
- <Tooltip>
- <TooltipTrigger asChild>
- <FontAwesomeIcon
- size="sm"
- className="ml-2 text-mineshaft-400"
- icon={faCircleInfo}
- />
- </TooltipTrigger>
- <TooltipContent>
- <ul className="ml-2 list-disc">
- {(projectManagedIdentities || []).map((identity) => (
- <li key={identity.name}>{identity.name}</li>
- ))}
- {identities && Boolean(identities?.length) && (
- <li key="org">
- {identities.length} Organization Identit
- {identities.length === 1 ? "y" : "ies"}
- </li>
- )}
- </ul>
- </TooltipContent>
- </Tooltip>
- )}
- </TableCell>
- <TableCell className="w-5">
- {name !== "default" && (
- <OrgPermissionCan
- I={OrgPermissionActions.Delete}
- a={OrgPermissionSubjects.ProjectTemplates}
- >
- {(isAllowed) => (
- <IconButton
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteTemplate", template);
- }}
- variant="ghost"
- aria-label="Delete template"
- isDisabled={!isAllowed}
- >
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
- )}
- </OrgPermissionCan>
- )}
- </TableCell>
- </TableRow>
- );
- })}
- {(!subscription?.projectTemplates || (!isPending && filteredTemplates?.length === 0)) && (
- <TableRow className="hover:bg-transparent">
- <TableCell colSpan={colSpan} className="p-0">
- <Empty className="h-28 rounded-none border-0 shadow-none">
- <EmptyHeader>
- <EmptyTitle>
- {search.trim()
- ? "No project templates match search"
- : "No project templates found"}
- </EmptyTitle>
- </EmptyHeader>
- </Empty>
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ const isDefault = name === "default";
+
+ return (
+ <TableRow
+ onClick={isDefault ? undefined : () => onEdit(template)}
+ className={isDefault ? "" : "cursor-pointer hover:bg-mineshaft-700"}
+ key={id}
+ >
+ <TableCell>
+ {name}
+ {description && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />
+ </TooltipTrigger>
+ <TooltipContent>{description}</TooltipContent>
+ </Tooltip>
+ )}
+ </TableCell>
+ <TableCell className="pl-8">
+ {roles.length}
+ {roles.length > 0 && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <ul className="ml-2 list-disc">
+ {roles.map((role) => (
+ <li key={role.name}>{role.name}</li>
+ ))}
+ </ul>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </TableCell>
+ <TableCell className="pl-8">
+ {users?.length || 0}
+ {users && Boolean(users.length) && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <ul className="ml-2 list-disc">
+ {users.map((user) => (
+ <li key={user.username}>{user.username}</li>
+ ))}
+ </ul>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </TableCell>
+ <TableCell className="pl-8">
+ {groups?.length || 0}
+ {groups && Boolean(groups.length) && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <ul className="ml-2 list-disc">
+ {groups.map((group) => (
+ <li key={group.groupSlug}>{group.groupSlug}</li>
+ ))}
+ </ul>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </TableCell>
+ <TableCell className="pl-8">
+ {totalIdentities}
+ {Boolean(totalIdentities) && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon size={14} className="ml-2 inline text-mineshaft-400" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <ul className="ml-2 list-disc">
+ {(projectManagedIdentities || []).map((identity) => (
+ <li key={identity.name}>{identity.name}</li>
+ ))}
+ {identities && Boolean(identities?.length) && (
+ <li key="org">
+ {identities.length} Organization Identit
+ {identities.length === 1 ? "y" : "ies"}
+ </li>
+ )}
+ </ul>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </TableCell>
+ <TableCell className="w-5">
+ {name !== "default" && (
+ <OrgPermissionCan
+ I={OrgPermissionActions.Delete}
+ a={OrgPermissionSubjects.ProjectTemplates}
+ >
+ {(isAllowed) => (
+ <IconButton
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deleteTemplate", template);
+ }}
+ variant="ghost-muted"
+ aria-label="Delete template"
+ isDisabled={!isAllowed}
+ >
+ <Trash2 className="size-4" />
+ </IconButton>
+ )}
+ </OrgPermissionCan>
+ )}
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ )}
<DeleteProjectTemplateModal
isOpen={popUp.deleteTemplate.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("deleteTemplate", isOpen)}