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
This commit is contained in:
Aniket Katkar 2022-09-06 13:45:59 +05:30 committed by GitHub
parent 9ff49c3161
commit 1b19fb32a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View File

@ -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 = ({
<EntitySummaryDetails
data={info}
isGroupType={isGroupType}
showGroupOption={!childTeams.length}
teamType={currentTeam.teamType}
updateOwner={
entityPermissions.EditAll || entityPermissions.EditOwner

View File

@ -36,6 +36,7 @@ export interface GetInfoElementsProps {
tier?: TagLabel;
currentTier?: string;
teamType?: TeamType;
showGroupOption?: boolean;
isGroupType?: boolean;
updateTier?: (value: string) => 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 ? (
<TeamTypeSelect
handleShowTypeSelector={handleShowTypeSelector}
showGroupOption={showGroupOption ?? false}
teamType={teamType ?? TeamType.Department}
updateTeamType={updateTeamType}
/>

View File

@ -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 (
<Space align="center" className="team-type-select" size={4}>

View File

@ -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;
}

View File

@ -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) => ({