Skip to content

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

improvement: migrate project MIs tab/table to v3 components and add role filter

Scott Wilson8f37ac71909b
diff --git a/frontend/src/components/v3/generic/Button/Button.tsx b/frontend/src/components/v3/generic/Button/Button.tsx
index 0b2f82d173..5420d00bd1 100644
--- a/frontend/src/components/v3/generic/Button/Button.tsx
+++ b/frontend/src/components/v3/generic/Button/Button.tsx
@@ -8,7 +8,7 @@ import { cn } from "@app/components/v3/utils";
const buttonVariants = cva(
cn(
- "inline-flex items-center rounded-md active:scale-[0.95] justify-center border cursor-pointer whitespace-nowrap",
+ "inline-flex items-center rounded-md active:scale-[0.99] justify-center border cursor-pointer whitespace-nowrap",
" text-sm transition-all disabled:pointer-events-none disabled:opacity-75 shrink-0",
"[&>svg]:pointer-events-none [&>svg]:shrink-0",
"focus-visible:ring-ring outline-0 focus-visible:ring-2 select-none"
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
index 57d33ff928..42bfcb06c6 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
@@ -1,57 +1,61 @@
-import { useState } from "react";
+import { useCallback, useMemo, useState } from "react";
import { subject } from "@casl/ability";
-import {
- faArrowDown,
- faArrowUp,
- faCircleXmark,
- faClock,
- faEllipsisV,
- faMagnifyingGlass,
- faPlus,
- faServer
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
-import { InfoIcon } from "lucide-react";
+import {
+ ChevronDownIcon,
+ ClockIcon,
+ FilterIcon,
+ InfoIcon,
+ MoreHorizontalIcon,
+ PlusIcon,
+ SearchIcon,
+ TrashIcon,
+ XIcon
+} from "lucide-react";
import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Button,
- DeleteActionModal,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- EmptyState,
- HoverCard,
- HoverCardContent,
- HoverCardTrigger,
- IconButton,
- Input,
- Modal,
- ModalContent,
- Pagination,
- Spinner,
- Table,
- TableContainer,
- TableSkeleton,
- Tag,
- TBody,
- Td,
- Th,
- THead,
- Tooltip,
- Tr
-} from "@app/components/v2";
+import { DeleteActionModal, Modal, ModalContent, Spinner } from "@app/components/v2";
import { Blur } from "@app/components/v2/Blur";
import {
Badge,
+ Button,
DocumentationLinkBadge,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
OrgIcon,
ProjectIcon,
- SubOrgIcon
+ Skeleton,
+ SubOrgIcon,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ UnstableCard,
+ UnstableCardAction,
+ UnstableCardContent,
+ UnstableCardDescription,
+ UnstableCardHeader,
+ UnstableCardTitle,
+ UnstableDropdownMenu,
+ UnstableDropdownMenuCheckboxItem,
+ UnstableDropdownMenuContent,
+ UnstableDropdownMenuItem,
+ UnstableDropdownMenuLabel,
+ UnstableDropdownMenuTrigger,
+ UnstableEmpty,
+ UnstableEmptyDescription,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
+ UnstableIconButton,
+ UnstablePagination,
+ UnstableTable,
+ UnstableTableBody,
+ UnstableTableCell,
+ UnstableTableHead,
+ UnstableTableHeader,
+ UnstableTableRow
} from "@app/components/v3";
import {
ProjectPermissionActions,
@@ -71,6 +75,7 @@ import { usePagination, useResetPageHelper } from "@app/hooks";
import {
useDeleteProjectIdentity,
useDeleteProjectIdentityMembership,
+ useGetProjectRoles,
useListProjectIdentityMemberships
} from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
@@ -140,6 +145,29 @@ export const IdentityTab = withProjectPermission(
setPage
});
+ const { data: projectRoles } = useGetProjectRoles(projectId);
+
+ const [filterRoles, setFilterRoles] = useState<string[]>([]);
+ const isTableFiltered = Boolean(filterRoles.length);
+
+ const handleRoleToggle = useCallback(
+ (roleSlug: string) =>
+ setFilterRoles((prev) =>
+ prev.includes(roleSlug) ? prev.filter((r) => r !== roleSlug) : [...prev, roleSlug]
+ ),
+ []
+ );
+
+ const filteredIdentityMemberships = useMemo(() => {
+ if (!filterRoles.length) return data?.identityMemberships ?? [];
+ return (data?.identityMemberships ?? []).filter((member) =>
+ member.roles.some(({ role, customRoleName }) => {
+ const effectiveSlug = role === "custom" ? customRoleName : role;
+ return effectiveSlug && filterRoles.includes(effectiveSlug);
+ })
+ );
+ }, [data?.identityMemberships, filterRoles]);
+
const { mutateAsync: deleteMembershipMutateAsync } = useDeleteProjectIdentityMembership();
const { mutateAsync: deleteProjectIdentity } = useDeleteProjectIdentity();
@@ -194,318 +222,381 @@ export const IdentityTab = withProjectPermission(
);
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="mb-4 flex flex-wrap items-center justify-between gap-2">
- <div className="flex items-center gap-x-2">
- <p className="text-xl font-medium text-mineshaft-100">Project Machine Identities</p>
- <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/identities/machine-identities" />
- </div>
- <div className="flex items-center">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Create}
- a={ProjectPermissionSub.Identity}
- >
- {(isAllowed) => (
- <Button
- variant="outline_bg"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => handlePopUpOpen("createIdentity")}
- isDisabled={!isAllowed}
- >
- Add Machine Identity to Project
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
- </div>
- <Input
- containerClassName="mb-4"
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search project machine identities by name..."
- />
- <TableContainer>
- <Table>
- <THead>
- <Tr className="h-14">
- <Th className="w-1/3">
- <div className="flex items-center">
- Name
- <IconButton
- variant="plain"
- className={`ml-2 ${
- orderBy === ProjectIdentityOrderBy.Name ? "" : "opacity-30"
- }`}
- ariaLabel="sort"
- onClick={() => handleSort(ProjectIdentityOrderBy.Name)}
- >
- <FontAwesomeIcon
- icon={
- orderDirection === OrderByDirection.DESC &&
- orderBy === ProjectIdentityOrderBy.Name
- ? faArrowUp
- : faArrowDown
- }
- />
- </IconButton>
- </div>
- </Th>
- <Th className="w-1/3">Project Role</Th>
- <Th>Managed by</Th>
- <Th className="w-5">{isFetching ? <Spinner size="xs" /> : null}</Th>
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={4} innerKey="project-identities" />}
+ <>
+ <UnstableCard>
+ <UnstableCardHeader>
+ <UnstableCardTitle>
+ Project Machine Identities
+ <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/identities/machine-identities" />
+ </UnstableCardTitle>
+ <UnstableCardDescription>
+ Create and manage project machine identities
+ </UnstableCardDescription>
+ <UnstableCardAction>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Create}
+ a={ProjectPermissionSub.Identity}
+ >
+ {(isAllowed) => (
+ <Button
+ variant="project"
+ onClick={() => handlePopUpOpen("createIdentity")}
+ isDisabled={!isAllowed}
+ >
+ <PlusIcon />
+ Add Machine Identity to Project
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </UnstableCardAction>
+ </UnstableCardHeader>
+ <UnstableCardContent>
+ <div>
+ <div className="mb-4 flex gap-2">
+ <InputGroup className="flex-1">
+ <InputGroupAddon>
+ <SearchIcon />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder="Search project machine identities by name..."
+ />
+ </InputGroup>
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton variant={isTableFiltered ? "project" : "outline"}>
+ <FilterIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent align="end">
+ <UnstableDropdownMenuLabel>
+ Filter by Project Role
+ </UnstableDropdownMenuLabel>
+ {projectRoles?.map(({ id, slug, name }) => (
+ <UnstableDropdownMenuCheckboxItem
+ key={id}
+ checked={filterRoles.includes(slug)}
+ onClick={(e) => {
+ e.preventDefault();
+ handleRoleToggle(slug);
+ }}
+ >
+ {name}
+ </UnstableDropdownMenuCheckboxItem>
+ ))}
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </div>
{!isPending &&
- data &&
- data.identityMemberships.length > 0 &&
- data.identityMemberships.map((identityMember) => {
- const {
- identity: { id, name, projectId: identityProjectId, orgId: identityOrgId },
- roles
- } = identityMember;
- return (
- <Tr
- className="group h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
- key={`st-v3-${id}`}
- role="button"
- tabIndex={0}
- onKeyDown={(evt) => {
- if (evt.key === "Enter") {
- navigate({
- to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
- params: {
- orgId: currentOrg.id,
- projectId: currentProject.id,
- identityId: id
- }
- });
- }
- }}
- onClick={() =>
- navigate({
- to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
- params: {
- orgId: currentOrg.id,
- projectId: currentProject.id,
- identityId: id
- }
- })
- }
- >
- <Td>{name}</Td>
-
- <Td>
- <div className="flex items-center space-x-2">
- {roles
- .slice(0, MAX_ROLES_TO_BE_SHOWN_IN_TABLE)
- .map(
- ({
- role,
- customRoleName,
- id: roleId,
- isTemporary,
- temporaryAccessEndTime
- }) => {
- const isExpired =
- new Date() > new Date(temporaryAccessEndTime || ("" as string));
- return (
- <Tag key={roleId}>
- <div className="flex items-center space-x-2">
- <div className="capitalize">
- {formatProjectRoleName(role, customRoleName)}
- </div>
- {isTemporary && (
- <div>
- <Tooltip
- content={
- isExpired ? "Timed role expired" : "Timed role access"
- }
- >
- <FontAwesomeIcon
- icon={faClock}
- className={twMerge(isExpired && "text-red-600")}
- />
- </Tooltip>
- </div>
- )}
- </div>
- </Tag>
- );
- }
+ data &&
+ filteredIdentityMemberships.length === 0 &&
+ (data.totalCount === 0 || isTableFiltered) ? (
+ <UnstableEmpty className="border">
+ <UnstableEmptyHeader>
+ <UnstableEmptyTitle>
+ {debouncedSearch.trim().length > 0 || isTableFiltered
+ ? "No machine identities match search"
+ : "No machine identities have been added to this project"}
+ </UnstableEmptyTitle>
+ <UnstableEmptyDescription>
+ {debouncedSearch.trim().length > 0 || isTableFiltered
+ ? "Adjust your search or filter criteria."
+ : "Add a machine identity to get started."}
+ </UnstableEmptyDescription>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ ) : (
+ <>
+ <UnstableTable>
+ <UnstableTableHeader>
+ <UnstableTableRow>
+ <UnstableTableHead
+ className="w-1/3"
+ onClick={() => handleSort(ProjectIdentityOrderBy.Name)}
+ >
+ Name
+ <ChevronDownIcon
+ className={twMerge(
+ "transition-transform",
+ orderDirection === OrderByDirection.DESC &&
+ orderBy === ProjectIdentityOrderBy.Name &&
+ "rotate-180",
+ orderBy !== ProjectIdentityOrderBy.Name && "opacity-30"
)}
- {roles.length > MAX_ROLES_TO_BE_SHOWN_IN_TABLE && (
- <HoverCard>
- <HoverCardTrigger>
- <Tag>+{roles.length - MAX_ROLES_TO_BE_SHOWN_IN_TABLE}</Tag>
- </HoverCardTrigger>
- <HoverCardContent className="border border-gray-700 bg-mineshaft-800 p-4">
- {roles
- .slice(MAX_ROLES_TO_BE_SHOWN_IN_TABLE)
- .map(
- ({
- role,
- customRoleName,
- id: roleId,
- isTemporary,
- temporaryAccessEndTime
- }) => {
- const isExpired =
- new Date() >
- new Date(temporaryAccessEndTime || ("" as string));
- return (
- <Tag key={roleId} className="capitalize">
- <div className="flex items-center space-x-2">
- <div>{formatProjectRoleName(role, customRoleName)}</div>
+ />
+ </UnstableTableHead>
+ <UnstableTableHead className="w-1/3">Project Role</UnstableTableHead>
+ <UnstableTableHead>Managed by</UnstableTableHead>
+ <UnstableTableHead className="w-5">
+ {isFetching ? <Spinner size="xs" /> : null}
+ </UnstableTableHead>
+ </UnstableTableRow>
+ </UnstableTableHeader>
+ <UnstableTableBody>
+ {isPending &&
+ Array.from({ length: perPage }).map((_, i) => (
+ <UnstableTableRow key={`skeleton-${i + 1}`}>
+ <UnstableTableCell>
+ <Skeleton className="h-4 w-full" />
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <Skeleton className="h-4 w-full" />
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <Skeleton className="h-4 w-full" />
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <Skeleton className="h-4 w-4" />
+ </UnstableTableCell>
+ </UnstableTableRow>
+ ))}
+ {!isPending &&
+ data &&
+ filteredIdentityMemberships.length > 0 &&
+ filteredIdentityMemberships.map((identityMember) => {
+ const {
+ identity: {
+ id,
+ name,
+ projectId: identityProjectId,
+ orgId: identityOrgId
+ },
+ roles
+ } = identityMember;
+ return (
+ <UnstableTableRow
+ className="group cursor-pointer"
+ key={`st-v3-${id}`}
+ role="button"
+ tabIndex={0}
+ onKeyDown={(evt) => {
+ if (evt.key === "Enter") {
+ navigate({
+ to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
+ params: {
+ orgId: currentOrg.id,
+ projectId: currentProject.id,
+ identityId: id
+ }
+ });
+ }
+ }}
+ onClick={() =>
+ navigate({
+ to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
+ params: {
+ orgId: currentOrg.id,
+ projectId: currentProject.id,
+ identityId: id
+ }
+ })
+ }
+ >
+ <UnstableTableCell isTruncatable>{name}</UnstableTableCell>
+ <UnstableTableCell>
+ <div className="flex items-center gap-1.5">
+ {roles
+ .slice(0, MAX_ROLES_TO_BE_SHOWN_IN_TABLE)
+ .map(
+ ({
+ role,
+ customRoleName,
+ id: roleId,
+ isTemporary,
+ temporaryAccessEndTime
+ }) => {
+ const isExpired =
+ new Date() >
+ new Date(temporaryAccessEndTime || ("" as string));
+ return (
+ <Badge
+ key={roleId}
+ variant={isExpired ? "danger" : "neutral"}
+ >
+ <span className="capitalize">
+ {formatProjectRoleName(role, customRoleName)}
+ </span>
{isTemporary && (
- <div>
- <Tooltip
- content={
- isExpired
- ? "Access expired"
- : "Temporary access"
- }
- >
- <FontAwesomeIcon
- icon={faClock}
- className={twMerge(
- new Date() >
- new Date(
- temporaryAccessEndTime as string
- ) && "text-red-600"
- )}
- />
- </Tooltip>
- </div>
+ <Tooltip>
+ <TooltipTrigger>
+ <ClockIcon />
+ </TooltipTrigger>
+ <TooltipContent>
+ {isExpired
+ ? "Timed role expired"
+ : "Timed role access"}
+ </TooltipContent>
+ </Tooltip>
)}
- </div>
- </Tag>
- );
- }
+ </Badge>
+ );
+ }
+ )}
+ {roles.length > MAX_ROLES_TO_BE_SHOWN_IN_TABLE && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Badge variant="neutral" asChild>
+ <button
+ type="button"
+ onClick={(e) => e.stopPropagation()}
+ >
+ +{roles.length - MAX_ROLES_TO_BE_SHOWN_IN_TABLE}
+ </button>
+ </Badge>
+ </TooltipTrigger>
+ <TooltipContent
+ className="flex flex-wrap gap-1.5"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {roles
+ .slice(MAX_ROLES_TO_BE_SHOWN_IN_TABLE)
+ .map(
+ ({
+ role,
+ customRoleName,
+ id: roleId,
+ isTemporary,
+ temporaryAccessEndTime
+ }) => {
+ const isExpired =
+ new Date() >
+ new Date(temporaryAccessEndTime || ("" as string));
+ return (
+ <Badge
+ key={roleId}
+ className="z-10"
+ variant={isExpired ? "danger" : "neutral"}
+ >
+ <span className="capitalize">
+ {formatProjectRoleName(role, customRoleName)}
+ </span>
+ {isTemporary && (
+ <Tooltip>
+ <TooltipTrigger>
+ <ClockIcon />
+ </TooltipTrigger>
+ <TooltipContent>
+ {isExpired
+ ? "Access expired"
+ : "Temporary access"}
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </Badge>
+ );
+ }
+ )}
+ </TooltipContent>
+ </Tooltip>
)}
- </HoverCardContent>
- </HoverCard>
- )}
- </div>
- </Td>
- <Td>
- <Badge
- variant={
- // eslint-disable-next-line no-nested-ternary
- identityProjectId
- ? "project"
- : isSubOrganization && currentOrg.id === identityOrgId
- ? "sub-org"
- : "org"
- }
- >
- {/* eslint-disable-next-line no-nested-ternary */}
- {identityProjectId ? (
- <>
- <ProjectIcon />
- Project
- </>
- ) : isSubOrganization && currentOrg.id === identityOrgId ? (
- <>
- <SubOrgIcon />
- Sub-Organization
- </>
- ) : (
- <>
- <OrgIcon />
- Organization
- </>
- )}
- </Badge>
- </Td>
- <Td className="flex justify-end space-x-2">
- <Tooltip className="max-w-sm text-center" content="Options">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Options"
- colorSchema="secondary"
- className="w-6"
- variant="plain"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={subject(ProjectPermissionSub.Identity, {
- identityId: id
- })}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- icon={<FontAwesomeIcon icon={faCircleXmark} />}
- isDisabled={!isAllowed}
- onClick={(evt) => {
- evt.stopPropagation();
- evt.preventDefault();
- handlePopUpOpen("deleteIdentity", {
- identityId: id,
- name,
- isProjectIdentity: Boolean(identityProjectId)
- });
- }}
- >
- {identityProjectId
- ? "Delete Machine Identity"
- : "Remove From Project"}
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </Tooltip>
- </Td>
- </Tr>
- );
- })}
- {!isPending &&
- data &&
- data?.totalCount !== 0 &&
- Array.from(Array(noAccessIdentityCount)).map((_e, i) => (
- <Tr key={`hid-identity-${i + 1}`}>
- <Td>No Access</Td>
- <Td colSpan={3}>
- <Blur
- className="w-min"
- tooltipText="You do not have permission to view this machine identity."
- />
- </Td>
- </Tr>
- ))}
- </TBody>
- </Table>
- {!isPending && data && totalCount > 0 && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={handlePerPageChange}
- />
- )}
- {!isPending &&
- data &&
- data?.identityMemberships.length === 0 &&
- data?.totalCount === 0 && (
- <EmptyState
- title={
- debouncedSearch.trim().length > 0
- ? "No machine identities match search filter"
- : "No machine identities have been added to this project"
- }
- icon={faServer}
- />
- )}
- </TableContainer>
+ </div>
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <Badge
+ variant={
+ // eslint-disable-next-line no-nested-ternary
+ identityProjectId
+ ? "project"
+ : isSubOrganization && currentOrg.id === identityOrgId
+ ? "sub-org"
+ : "org"
+ }
+ >
+ {/* eslint-disable-next-line no-nested-ternary */}
+ {identityProjectId ? (
+ <>
+ <ProjectIcon />
+ Project
+ </>
+ ) : isSubOrganization && currentOrg.id === identityOrgId ? (
+ <>
+ <SubOrgIcon />
+ Sub-Organization
+ </>
+ ) : (
+ <>
+ <OrgIcon />
+ Organization
+ </>
+ )}
+ </Badge>
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton
+ variant="ghost"
+ size="xs"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <MoreHorizontalIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent sideOffset={2} align="end">
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={subject(ProjectPermissionSub.Identity, {
+ identityId: id
+ })}
+ >
+ {(isAllowed) => (
+ <UnstableDropdownMenuItem
+ variant="danger"
+ isDisabled={!isAllowed}
+ onClick={(evt) => {
+ evt.stopPropagation();
+ evt.preventDefault();
+ handlePopUpOpen("deleteIdentity", {
+ identityId: id,
+ name,
+ isProjectIdentity: Boolean(identityProjectId)
+ });
+ }}
+ >
+ {identityProjectId ? <TrashIcon /> : <XIcon />}
+ {identityProjectId
+ ? "Delete Machine Identity"
+ : "Remove From Project"}
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ );
+ })}
+ {!isPending &&
+ data &&
+ data?.totalCount !== 0 &&
+ Array.from(Array(noAccessIdentityCount)).map((_e, i) => (
+ <UnstableTableRow key={`hid-identity-${i + 1}`}>
+ <UnstableTableCell>No Access</UnstableTableCell>
+ <UnstableTableCell colSpan={3}>
+ <Blur
+ className="w-min"
+ tooltipText="You do not have permission to view this machine identity."
+ />
+ </UnstableTableCell>
+ </UnstableTableRow>
+ ))}
+ </UnstableTableBody>
+ </UnstableTable>
+ {!isPending && data && totalCount > 0 && (
+ <UnstablePagination
+ count={totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={(newPage) => setPage(newPage)}
+ onChangePerPage={handlePerPageChange}
+ />
+ )}
+ </>
+ )}
+ </div>
+ </UnstableCardContent>
+ </UnstableCard>
<Modal
isOpen={popUp.createIdentity.isOpen}
onOpenChange={(open) => {
@@ -520,7 +611,7 @@ export const IdentityTab = withProjectPermission(
<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_bg"
+ variant="outline"
onClick={() => {
setAddMachineIdentityType(AddIdentityType.CreateNew);
}}
@@ -535,7 +626,7 @@ export const IdentityTab = withProjectPermission(
Create New
</Button>
<Button
- variant="outline_bg"
+ variant="outline"
onClick={() => {
setAddMachineIdentityType(AddIdentityType.AssignExisting);
}}
@@ -550,37 +641,33 @@ export const IdentityTab = withProjectPermission(
Assign Existing
</Button>
</div>
- <Tooltip
- className="max-w-sm"
- position="right"
- align="start"
- content={
- <>
- <p className="mb-2 text-mineshaft-300">
- You can add machine identities to your project in one of two ways:
- </p>
- <ul className="ml-3.5 flex list-disc flex-col gap-y-4">
- <li className="text-mineshaft-200">
- <strong className="font-medium text-mineshaft-100">Create New</strong> -
- Create a dedicated machine identity managed at the project-level.
- <p className="mt-2">
- This method is recommended for autonomous teams that need to manage
- machine identity authentication.
- </p>
- </li>
- <li>
- <strong className="font-medium text-mineshaft-100">Assign Existing</strong>{" "}
- - Assign an existing machine identity from your organization.
- <p className="mt-2">
- This method is recommended for organizations that need to maintain
- centralized control.
- </p>
- </li>
- </ul>
- </>
- }
- >
- <InfoIcon size={16} className="text-mineshaft-400" />
+ <Tooltip>
+ <TooltipTrigger>
+ <InfoIcon size={16} className="text-mineshaft-400" />
+ </TooltipTrigger>
+ <TooltipContent side="right" align="start" className="max-w-sm">
+ <p className="mb-2 text-mineshaft-300">
+ You can add machine identities to your project in one of two ways:
+ </p>
+ <ul className="ml-3.5 flex list-disc flex-col gap-y-4">
+ <li className="text-mineshaft-200">
+ <strong className="font-medium text-mineshaft-100">Create New</strong> -
+ Create a dedicated machine identity managed at the project-level.
+ <p className="mt-2">
+ This method is recommended for autonomous teams that need to manage machine
+ identity authentication.
+ </p>
+ </li>
+ <li>
+ <strong className="font-medium text-mineshaft-100">Assign Existing</strong> -
+ Assign an existing machine identity from your organization.
+ <p className="mt-2">
+ This method is recommended for organizations that need to maintain
+ centralized control.
+ </p>
+ </li>
+ </ul>
+ </TooltipContent>
</Tooltip>
</div>
{addMachineIdentityType === AddIdentityType.CreateNew && (
@@ -609,7 +696,7 @@ export const IdentityTab = withProjectPermission(
)
}
/>
- </div>
+ </>
);
},
{ action: ProjectPermissionActions.Read, subject: ProjectPermissionSub.Identity }