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, isOrganization,
searchTerm ? table.length : undefined searchTerm ? table.length : undefined
), ),
[currentTeam, teamUserPagin, searchTerm] [currentTeam, teamUserPagin, searchTerm, table]
); );
const createTeamPermission = useMemo( const createTeamPermission = useMemo(
@ -829,6 +829,7 @@ const TeamDetailsV1 = ({
<EntitySummaryDetails <EntitySummaryDetails
data={info} data={info}
isGroupType={isGroupType} isGroupType={isGroupType}
showGroupOption={!childTeams.length}
teamType={currentTeam.teamType} teamType={currentTeam.teamType}
updateOwner={ updateOwner={
entityPermissions.EditAll || entityPermissions.EditOwner entityPermissions.EditAll || entityPermissions.EditOwner

View File

@ -36,6 +36,7 @@ export interface GetInfoElementsProps {
tier?: TagLabel; tier?: TagLabel;
currentTier?: string; currentTier?: string;
teamType?: TeamType; teamType?: TeamType;
showGroupOption?: boolean;
isGroupType?: boolean; isGroupType?: boolean;
updateTier?: (value: string) => void; updateTier?: (value: string) => void;
updateTeamType?: (type: TeamType) => 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)} className={classNames('tw-cursor-pointer tw-align-text-top', iconClasses)}
icon={Icons.EDIT} icon={Icons.EDIT}
title="Edit" title="Edit"
width="15px" width="16px"
/> />
); );
@ -66,6 +67,7 @@ const EntitySummaryDetails = ({
isGroupType, isGroupType,
tier, tier,
teamType, teamType,
showGroupOption,
updateOwner, updateOwner,
updateTier, updateTier,
updateTeamType, updateTeamType,
@ -307,6 +309,7 @@ const EntitySummaryDetails = ({
showTypeSelector ? ( showTypeSelector ? (
<TeamTypeSelect <TeamTypeSelect
handleShowTypeSelector={handleShowTypeSelector} handleShowTypeSelector={handleShowTypeSelector}
showGroupOption={showGroupOption ?? false}
teamType={teamType ?? TeamType.Department} teamType={teamType ?? TeamType.Department}
updateTeamType={updateTeamType} updateTeamType={updateTeamType}
/> />

View File

@ -21,6 +21,7 @@ import { getTeamTypeOptions } from './TeamTypeSelect.utils';
function TeamTypeSelect({ function TeamTypeSelect({
handleShowTypeSelector, handleShowTypeSelector,
showGroupOption,
teamType, teamType,
updateTeamType, updateTeamType,
}: TeamTypeSelectProps) { }: TeamTypeSelectProps) {
@ -38,7 +39,7 @@ function TeamTypeSelect({
updateTeamType && updateTeamType(value); updateTeamType && updateTeamType(value);
}; };
const options = useMemo(() => getTeamTypeOptions(), []); const options = useMemo(() => getTeamTypeOptions(showGroupOption), []);
return ( return (
<Space align="center" className="team-type-select" size={4}> <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 { export interface TeamTypeSelectProps {
handleShowTypeSelector: (value: boolean) => void; handleShowTypeSelector: (value: boolean) => void;
teamType: TeamType; teamType: TeamType;
showGroupOption: boolean;
updateTeamType?: (type: TeamType) => void; updateTeamType?: (type: TeamType) => void;
} }

View File

@ -13,9 +13,9 @@
import { TeamType } from '../../../generated/entity/teams/team'; import { TeamType } from '../../../generated/entity/teams/team';
export const getTeamTypeOptions = () => { export const getTeamTypeOptions = (showGroupOption: boolean) => {
const teamTypesArray = Object.values(TeamType).filter( const teamTypesArray = Object.values(TeamType).filter((key) =>
(key) => key !== TeamType.Organization key === TeamType.Group ? showGroupOption : key !== TeamType.Organization
); );
return teamTypesArray.map((teamType) => ({ return teamTypesArray.map((teamType) => ({