improvements: remove unused imports and various minor ui improvements

This commit is contained in:
Scott Wilson
2025-11-13 12:52:41 +05:30
committed by =
parent 31c81aca5e
commit 5e936cc89f
5 changed files with 24 additions and 25 deletions
@@ -1,5 +1,5 @@
import { useState } from "react"; 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 { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { AnimatePresence, motion } from "framer-motion"; import { AnimatePresence, motion } from "framer-motion";
import { LinkIcon, PlusIcon } from "lucide-react"; import { LinkIcon, PlusIcon } from "lucide-react";
@@ -7,15 +7,7 @@ import { LinkIcon, PlusIcon } from "lucide-react";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications"; import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions"; import { OrgPermissionCan } from "@app/components/permissions";
import { import { Button, DeleteActionModal, Modal, ModalContent } from "@app/components/v2";
Button,
DeleteActionModal,
DropdownMenu,
DropdownMenuContent,
DropdownMenuTrigger,
Modal,
ModalContent
} from "@app/components/v2";
import { DocumentationLinkBadge } from "@app/components/v3"; import { DocumentationLinkBadge } from "@app/components/v3";
import { import {
OrgPermissionIdentityActions, OrgPermissionIdentityActions,
@@ -25,7 +17,7 @@ import {
} from "@app/context"; } from "@app/context";
import { OrgPermissionMachineIdentityAuthTemplateActions } from "@app/context/OrgPermissionContext/types"; import { OrgPermissionMachineIdentityAuthTemplateActions } from "@app/context/OrgPermissionContext/types";
import { withPermission } from "@app/hoc"; 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 { useDeleteIdentityAuthTemplate } from "@app/hooks/api/identityAuthTemplates";
import { usePopUp } from "@app/hooks/usePopUp"; import { usePopUp } from "@app/hooks/usePopUp";
@@ -293,6 +293,8 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
lastLoginAuthMethod, lastLoginAuthMethod,
lastLoginTime lastLoginTime
}) => { }) => {
const isSubOrgIdentity = currentOrg.id === orgId;
return ( return (
<Tr <Tr
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700" className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
@@ -357,8 +359,8 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
</Td> </Td>
{isSubOrganization && ( {isSubOrganization && (
<Td> <Td>
<Badge variant="ghost"> <Badge variant={isSubOrgIdentity ? "sub-org" : "org"}>
{currentOrg.id === orgId ? ( {isSubOrgIdentity ? (
<> <>
<SubOrgIcon /> <SubOrgIcon />
Sub-Organization Sub-Organization
@@ -403,7 +405,7 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
}} }}
isDisabled={!isAllowed} isDisabled={!isAllowed}
> >
Edit Identity Edit Identity {isSubOrgIdentity ? "" : "Membership"}
</DropdownMenuItem> </DropdownMenuItem>
)} )}
</OrgPermissionCan> </OrgPermissionCan>
@@ -423,9 +425,9 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
isDisabled={!isAllowed} isDisabled={!isAllowed}
icon={<FontAwesomeIcon icon={faTrash} />} icon={<FontAwesomeIcon icon={faTrash} />}
> >
{orgId !== currentOrg.id {isSubOrgIdentity
? "Remove From Sub-organization" ? "Delete Identity"
: "Delete Identity"} : "Remove From Sub-Organization"}
</DropdownMenuItem> </DropdownMenuItem>
)} )}
</OrgPermissionCan> </OrgPermissionCan>
@@ -14,8 +14,6 @@ import {
FormLabel, FormLabel,
IconButton, IconButton,
Input, Input,
Modal,
ModalContent,
Switch Switch
} from "@app/components/v2"; } from "@app/components/v2";
import { useOrganization } from "@app/context"; import { useOrganization } from "@app/context";
@@ -110,7 +110,7 @@ export const IdentityDetailsSection = ({ identityId, handlePopUpOpen, isOrgIdent
icon={<FontAwesomeIcon icon={faTrash} />} icon={<FontAwesomeIcon icon={faTrash} />}
disabled={!isAllowed} disabled={!isAllowed}
> >
{!isOrgIdentity ? "Unlink Identity" : "Delete Identity"} {!isOrgIdentity ? "Remove From Sub-Organization" : "Delete Identity"}
</DropdownMenuItem> </DropdownMenuItem>
)} )}
</OrgPermissionCan> </OrgPermissionCan>
@@ -46,6 +46,7 @@ import {
Tooltip, Tooltip,
Tr Tr
} from "@app/components/v2"; } from "@app/components/v2";
import { Blur } from "@app/components/v2/Blur";
import { import {
Badge, Badge,
DocumentationLinkBadge, DocumentationLinkBadge,
@@ -79,7 +80,6 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { ProjectIdentityModal } from "@app/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal"; import { ProjectIdentityModal } from "@app/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal";
import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal"; import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal";
import { Blur } from "@app/components/v2/Blur";
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2; const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
@@ -389,7 +389,16 @@ export const IdentityTab = withProjectPermission(
</div> </div>
</Td> </Td>
<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 */} {/* eslint-disable-next-line no-nested-ternary */}
{identityProjectId ? ( {identityProjectId ? (
<> <>
@@ -443,9 +452,7 @@ export const IdentityTab = withProjectPermission(
}); });
}} }}
> >
{identityProjectId {identityProjectId ? "Delete Identity" : "Remove From Project"}
? "Delete Project Identity"
: "Remove Identity From Project"}
</DropdownMenuItem> </DropdownMenuItem>
)} )}
</ProjectPermissionCan> </ProjectPermissionCan>