From 1b19fb32a4a1a7e1646b81d241d1a151017f656b Mon Sep 17 00:00:00 2001 From: Aniket Katkar <51777795+aniketkatkar97@users.noreply.github.com> Date: Tue, 6 Sep 2022 13:45:59 +0530 Subject: [PATCH] UI: Removed group type option for teams with child teams. (#7243) * removed group type option for teams with child teams. * fixed issue with team count not changing with search results --- .../ui/src/components/TeamDetails/TeamDetailsV1.tsx | 3 ++- .../common/EntitySummaryDetails/EntitySummaryDetails.tsx | 5 ++++- .../common/TeamTypeSelect/TeamTypeSelect.component.tsx | 3 ++- .../common/TeamTypeSelect/TeamTypeSelect.interface.ts | 1 + .../common/TeamTypeSelect/TeamTypeSelect.utils.ts | 6 +++--- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx index 1b6b078ae74..537f6b5b7e5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx @@ -161,7 +161,7 @@ const TeamDetailsV1 = ({ isOrganization, searchTerm ? table.length : undefined ), - [currentTeam, teamUserPagin, searchTerm] + [currentTeam, teamUserPagin, searchTerm, table] ); const createTeamPermission = useMemo( @@ -829,6 +829,7 @@ const TeamDetailsV1 = ({ void; updateTeamType?: (type: TeamType) => void; @@ -47,7 +48,7 @@ const EditIcon = ({ iconClasses }: { iconClasses?: string }): JSX.Element => ( className={classNames('tw-cursor-pointer tw-align-text-top', iconClasses)} icon={Icons.EDIT} title="Edit" - width="15px" + width="16px" /> ); @@ -66,6 +67,7 @@ const EntitySummaryDetails = ({ isGroupType, tier, teamType, + showGroupOption, updateOwner, updateTier, updateTeamType, @@ -307,6 +309,7 @@ const EntitySummaryDetails = ({ showTypeSelector ? ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.component.tsx index 760edbd7879..077f4df909a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.component.tsx @@ -21,6 +21,7 @@ import { getTeamTypeOptions } from './TeamTypeSelect.utils'; function TeamTypeSelect({ handleShowTypeSelector, + showGroupOption, teamType, updateTeamType, }: TeamTypeSelectProps) { @@ -38,7 +39,7 @@ function TeamTypeSelect({ updateTeamType && updateTeamType(value); }; - const options = useMemo(() => getTeamTypeOptions(), []); + const options = useMemo(() => getTeamTypeOptions(showGroupOption), []); return ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.interface.ts index 0d06dc13b78..55bdd7078d4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.interface.ts @@ -16,5 +16,6 @@ import { TeamType } from '../../../generated/entity/teams/team'; export interface TeamTypeSelectProps { handleShowTypeSelector: (value: boolean) => void; teamType: TeamType; + showGroupOption: boolean; updateTeamType?: (type: TeamType) => void; } diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.utils.ts b/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.utils.ts index 8c360930f84..3cf9b9472bb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.utils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/TeamTypeSelect/TeamTypeSelect.utils.ts @@ -13,9 +13,9 @@ import { TeamType } from '../../../generated/entity/teams/team'; -export const getTeamTypeOptions = () => { - const teamTypesArray = Object.values(TeamType).filter( - (key) => key !== TeamType.Organization +export const getTeamTypeOptions = (showGroupOption: boolean) => { + const teamTypesArray = Object.values(TeamType).filter((key) => + key === TeamType.Group ? showGroupOption : key !== TeamType.Organization ); return teamTypesArray.map((teamType) => ({