mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-03 20:19:31 +00:00 
			
		
		
		
	MINOR: fix the wrong team count displayed on team tab (#19368)
* fix the wrong team count displayed on team tab * added playwright test for checking counts (cherry picked from commit 58f95e9e98fec96e05d9853969706a8980b92e8d)
This commit is contained in:
		
							parent
							
								
									6224b54900
								
							
						
					
					
						commit
						b33fb9b22f
					
				@ -34,6 +34,7 @@ import { settingClick } from '../../utils/sidebar';
 | 
			
		||||
import {
 | 
			
		||||
  addTeamOwnerToEntity,
 | 
			
		||||
  addUserInTeam,
 | 
			
		||||
  checkTeamTabCount,
 | 
			
		||||
  createTeam,
 | 
			
		||||
  hardDeleteTeam,
 | 
			
		||||
  searchTeam,
 | 
			
		||||
@ -114,6 +115,8 @@ test.describe('Teams Page', () => {
 | 
			
		||||
  test('Teams Page Flow', async ({ page }) => {
 | 
			
		||||
    await test.step('Create a new team', async () => {
 | 
			
		||||
      await settingClick(page, GlobalSettingOptions.TEAMS);
 | 
			
		||||
 | 
			
		||||
      await checkTeamTabCount(page);
 | 
			
		||||
      await page.waitForLoadState('networkidle');
 | 
			
		||||
 | 
			
		||||
      await page.waitForSelector('[data-testid="add-team"]');
 | 
			
		||||
 | 
			
		||||
@ -349,3 +349,17 @@ export const addUserInTeam = async (page: Page, user: UserClass) => {
 | 
			
		||||
    page.locator(`[data-testid="${userName.toLowerCase()}"]`)
 | 
			
		||||
  ).toBeVisible();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const checkTeamTabCount = async (page: Page) => {
 | 
			
		||||
  const fetchResponse = page.waitForResponse(
 | 
			
		||||
    '/api/v1/teams/name/*?fields=*childrenCount*include=all'
 | 
			
		||||
  );
 | 
			
		||||
  const response = await fetchResponse;
 | 
			
		||||
  const jsonRes = await response.json();
 | 
			
		||||
 | 
			
		||||
  await expect(
 | 
			
		||||
    page.locator(
 | 
			
		||||
      '[data-testid="teams"] [data-testid="count"] [data-testid="filter-count"]'
 | 
			
		||||
    )
 | 
			
		||||
  ).toContainText(jsonRes.childrenCount.toString());
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -210,11 +210,8 @@ const TeamDetailsV1 = ({
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  const teamCount = useMemo(
 | 
			
		||||
    () =>
 | 
			
		||||
      isOrganization && currentTeam && currentTeam.childrenCount
 | 
			
		||||
        ? currentTeam.childrenCount + 1
 | 
			
		||||
        : childTeamList.length,
 | 
			
		||||
    [childTeamList, isOrganization, currentTeam.childrenCount]
 | 
			
		||||
    () => currentTeam.childrenCount ?? childTeamList.length,
 | 
			
		||||
    [childTeamList, currentTeam.childrenCount]
 | 
			
		||||
  );
 | 
			
		||||
  const updateActiveTab = (key: string) => {
 | 
			
		||||
    history.push({ search: Qs.stringify({ activeTab: key }) });
 | 
			
		||||
 | 
			
		||||
@ -288,8 +288,8 @@ const TeamsPage = () => {
 | 
			
		||||
 | 
			
		||||
      const res = await createTeam(teamData);
 | 
			
		||||
      if (res) {
 | 
			
		||||
        fetchTeamBasicDetails(selectedTeam.name, true);
 | 
			
		||||
        handleAddTeam(false);
 | 
			
		||||
        await fetchTeamBasicDetails(selectedTeam.name, true);
 | 
			
		||||
        loadAdvancedDetails();
 | 
			
		||||
      }
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user