diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/TeamDetailsV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/TeamDetailsV1.tsx
index 68342ade874..be14f55cac1 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/TeamDetailsV1.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/TeamDetailsV1.tsx
@@ -748,7 +748,7 @@ const TeamDetailsV1 = ({
heading: t('label.role'),
doc: ROLE_DOCS,
children: t('message.assigning-team-entity-description', {
- entity: t('label.role'),
+ entity: t('label.role-lowercase'),
name: currentTeam.name,
}),
type: ERROR_PLACEHOLDER_TYPE.ASSIGN,
@@ -819,7 +819,7 @@ const TeamDetailsV1 = ({
fetchErrorPlaceHolder({
permission: entityPermissions.EditAll,
children: t('message.assigning-team-entity-description', {
- entity: t('label.policy-plural'),
+ entity: t('label.policy-lowercase-plural'),
name: currentTeam.name,
}),
type: ERROR_PLACEHOLDER_TYPE.ASSIGN,
diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json
index 38ff9cb9a51..77baca2cb3d 100644
--- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json
+++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json
@@ -1345,7 +1345,7 @@
"are-you-want-to-restore": "Are you sure you want to restore {{entity}}?",
"assess-data-reliability-with-data-profiler-lineage": "Gain a competitive edge in the data-driven world with the right approach to data governance. Secure your data and empower your business to fuel innovation and growth.",
"assigned-you-a-new-task-lowercase": "a new task has been assigned to you",
- "assigning-team-entity-description": "Add a {{entity}} to {{name}}. This {{entity}} will be inherited by all the Users in the Team {{name}} as well as all the Teams under {{name}}",
+ "assigning-team-entity-description": "Add a {{entity}} to {{name}}. This {{entity}} will be inherited by all the users in the team {{name}} as well as all the teams under {{name}}",
"at-least-one-policy": "Enter at least one policy",
"auth-configuration-missing": "Auth configuration is missing",
"authProvider-is-not-basic": "AuthProvider is not Basic",
diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json
index 8fbbffcf171..5eddea1b8e7 100644
--- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json
+++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json
@@ -1345,7 +1345,7 @@
"are-you-want-to-restore": "本当に{{entity}}をリストアしてよろしいですか?",
"assess-data-reliability-with-data-profiler-lineage": "Assess data reliability with data profiler, lineage, sample data, and more.",
"assigned-you-a-new-task-lowercase": "新しいタスクがアサインされました",
- "assigning-team-entity-description": "Add a {{entity}} to {{name}}. This {{entity}} will be inherited by all the Users in the Team {{name}} as well as all the Teams under {{name}}",
+ "assigning-team-entity-description": "Add a {{entity}} to {{name}}. This {{entity}} will be inherited by all the users in the team {{name}} as well as all the teams under {{name}}",
"at-least-one-policy": "Enter at least one policy",
"auth-configuration-missing": "Auth configuration is missing",
"authProvider-is-not-basic": "AuthProvider is not Basic",
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.test.tsx
index 12f980a3e82..2fc135b4c79 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.test.tsx
@@ -16,8 +16,10 @@ import { act, render, screen } from '@testing-library/react';
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
import { ResourceEntity } from '../../context/PermissionProvider/PermissionProvider.interface';
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
+import { TeamType } from '../../generated/entity/teams/team';
import { mockUserData } from '../../mocks/MyDataPage.mock';
import { MOCK_CURRENT_TEAM } from '../../mocks/Teams.mock';
+import { searchData } from '../../rest/miscAPI';
import { getTeamByName } from '../../rest/teamsAPI';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import TeamsPage from './TeamsPage';
@@ -92,11 +94,7 @@ jest.mock('../../rest/teamsAPI', () => ({
}));
jest.mock('../../rest/miscAPI', () => ({
- searchData: jest
- .fn()
- .mockResolvedValue(() =>
- Promise.resolve({ data: [], paging: { total: 5 } })
- ),
+ searchData: jest.fn().mockResolvedValue({ data: [], paging: { total: 0 } }),
}));
jest.mock('../../hooks/useFqn', () => ({
@@ -199,5 +197,53 @@ describe('Test Teams Page', () => {
});
expect(screen.getByText('No_Data_Error_Placeholder')).toBeInTheDocument();
+
+ (getTeamByName as jest.Mock).mockReset();
+ });
+
+ it('should fetchAssetCount on page load', async () => {
+ (usePermissionProvider as jest.Mock).mockImplementationOnce(() => ({
+ getEntityPermissionByFqn: jest.fn().mockImplementationOnce(() => ({
+ ViewBasic: true,
+ })),
+ }));
+
+ (getTeamByName as jest.Mock).mockImplementation(() =>
+ Promise.resolve({ ...MOCK_CURRENT_TEAM, teamType: TeamType.Group })
+ );
+
+ await act(async () => {
+ render();
+ });
+
+ expect(searchData).toHaveBeenCalledWith(
+ '',
+ 0,
+ 0,
+ 'owner.id:f9578f16-363a-4788-80fb-d05816c9e169',
+ '',
+ '',
+ 'all'
+ );
+ });
+
+ it('should not fetchAssetCount on page load if TeamType is not Group', async () => {
+ (usePermissionProvider as jest.Mock).mockImplementationOnce(() => ({
+ getEntityPermissionByFqn: jest.fn().mockImplementationOnce(() => ({
+ ViewBasic: true,
+ })),
+ }));
+
+ (getTeamByName as jest.Mock).mockImplementation(() =>
+ Promise.resolve({ ...MOCK_CURRENT_TEAM, teamType: TeamType.BusinessUnit })
+ );
+
+ await act(async () => {
+ render();
+ });
+
+ expect(searchData).not.toHaveBeenCalled();
+
+ (getTeamByName as jest.Mock).mockReset();
});
});
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.tsx
index 02cd0d242e9..7e7f8b04e19 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/TeamsPage.tsx
@@ -80,11 +80,6 @@ const TeamsPage = () => {
const [isFetchAllTeamAdvancedDetails, setFetchAllTeamAdvancedDetails] =
useState(false);
- const isGroupType = useMemo(
- () => selectedTeam.teamType === TeamType.Group,
- [selectedTeam]
- );
-
const hasViewPermission = useMemo(
() => entityPermissions.ViewAll || entityPermissions.ViewBasic,
[entityPermissions]
@@ -193,8 +188,8 @@ const TeamsPage = () => {
}
};
- const fetchAssets = async () => {
- if (selectedTeam.id && isGroupType) {
+ const fetchAssets = async (selectedTeam: Team) => {
+ if (selectedTeam.id && selectedTeam.teamType === TeamType.Group) {
try {
const res = await searchData(
``,
@@ -241,7 +236,7 @@ const TeamsPage = () => {
});
setSelectedTeam((prev) => ({ ...prev, ...data }));
- fetchAssets();
+ fetchAssets(data);
} catch (error) {
showErrorToast(error as AxiosError, t('server.unexpected-response'));
} finally {