improvements: remove unused imports and various minor ui improvements

This commit is contained in:
Scott Wilson
2025-11-10 20:12:33 -05:00
committed by =
parent 31c81aca5e
commit 5e936cc89f
5 changed files with 24 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
import { useState } from "react";
import { faChevronDown, faLink, faPlus } from "@fortawesome/free-solid-svg-icons";
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { AnimatePresence, motion } from "framer-motion";
import { LinkIcon, PlusIcon } from "lucide-react";
@@ -7,15 +7,7 @@ import { LinkIcon, PlusIcon } from "lucide-react";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
Button,
DeleteActionModal,
DropdownMenu,
DropdownMenuContent,
DropdownMenuTrigger,
Modal,
ModalContent
} from "@app/components/v2";
import { Button, DeleteActionModal, Modal, ModalContent } from "@app/components/v2";
import { DocumentationLinkBadge } from "@app/components/v3";
import {
OrgPermissionIdentityActions,
@@ -25,7 +17,7 @@ import {
} from "@app/context";
import { OrgPermissionMachineIdentityAuthTemplateActions } from "@app/context/OrgPermissionContext/types";
import { withPermission } from "@app/hoc";
import { subOrganizationsQuery, useDeleteOrgIdentity } from "@app/hooks/api";
import { useDeleteOrgIdentity } from "@app/hooks/api";
import { useDeleteIdentityAuthTemplate } from "@app/hooks/api/identityAuthTemplates";
import { usePopUp } from "@app/hooks/usePopUp";

View File

@@ -293,6 +293,8 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
lastLoginAuthMethod,
lastLoginTime
}) => {
const isSubOrgIdentity = currentOrg.id === orgId;
return (
<Tr
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
@@ -357,8 +359,8 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
</Td>
{isSubOrganization && (
<Td>
<Badge variant="ghost">
{currentOrg.id === orgId ? (
<Badge variant={isSubOrgIdentity ? "sub-org" : "org"}>
{isSubOrgIdentity ? (
<>
<SubOrgIcon />
Sub-Organization
@@ -403,7 +405,7 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
}}
isDisabled={!isAllowed}
>
Edit Identity
Edit Identity {isSubOrgIdentity ? "" : "Membership"}
</DropdownMenuItem>
)}
</OrgPermissionCan>
@@ -423,9 +425,9 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
isDisabled={!isAllowed}
icon={<FontAwesomeIcon icon={faTrash} />}
>
{orgId !== currentOrg.id
? "Remove From Sub-organization"
: "Delete Identity"}
{isSubOrgIdentity
? "Delete Identity"
: "Remove From Sub-Organization"}
</DropdownMenuItem>
)}
</OrgPermissionCan>

View File

@@ -14,8 +14,6 @@ import {
FormLabel,
IconButton,
Input,
Modal,
ModalContent,
Switch
} from "@app/components/v2";
import { useOrganization } from "@app/context";

View File

@@ -110,7 +110,7 @@ export const IdentityDetailsSection = ({ identityId, handlePopUpOpen, isOrgIdent
icon={<FontAwesomeIcon icon={faTrash} />}
disabled={!isAllowed}
>
{!isOrgIdentity ? "Unlink Identity" : "Delete Identity"}
{!isOrgIdentity ? "Remove From Sub-Organization" : "Delete Identity"}
</DropdownMenuItem>
)}
</OrgPermissionCan>

View File

@@ -46,6 +46,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
import { Blur } from "@app/components/v2/Blur";
import {
Badge,
DocumentationLinkBadge,
@@ -79,7 +80,6 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { ProjectIdentityModal } from "@app/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal";
import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal";
import { Blur } from "@app/components/v2/Blur";
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
@@ -389,7 +389,16 @@ export const IdentityTab = withProjectPermission(
</div>
</Td>
<Td>
<Badge variant="ghost">
<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 ? (
<>
@@ -443,9 +452,7 @@ export const IdentityTab = withProjectPermission(
});
}}
>
{identityProjectId
? "Delete Project Identity"
: "Remove Identity From Project"}
{identityProjectId ? "Delete Identity" : "Remove From Project"}
</DropdownMenuItem>
)}
</ProjectPermissionCan>