diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/LandingPageWidgets/DataAssetsWidget.spec.ts similarity index 77% rename from openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts rename to openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/LandingPageWidgets/DataAssetsWidget.spec.ts index 510ba93cfc97..5e6c29779aa4 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataAssetsWidget.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/LandingPageWidgets/DataAssetsWidget.spec.ts @@ -12,19 +12,19 @@ */ import { test } from '@playwright/test'; import { toLower } from 'lodash'; -import { ContainerClass } from '../../support/entity/ContainerClass'; -import { DashboardClass } from '../../support/entity/DashboardClass'; -import { MlModelClass } from '../../support/entity/MlModelClass'; -import { PipelineClass } from '../../support/entity/PipelineClass'; -import { SearchIndexClass } from '../../support/entity/SearchIndexClass'; -import { TableClass } from '../../support/entity/TableClass'; -import { TopicClass } from '../../support/entity/TopicClass'; +import { ContainerClass } from '../../../support/entity/ContainerClass'; +import { DashboardClass } from '../../../support/entity/DashboardClass'; +import { MlModelClass } from '../../../support/entity/MlModelClass'; +import { PipelineClass } from '../../../support/entity/PipelineClass'; +import { SearchIndexClass } from '../../../support/entity/SearchIndexClass'; +import { TableClass } from '../../../support/entity/TableClass'; +import { TopicClass } from '../../../support/entity/TopicClass'; import { createNewPage, getEntityTypeSearchIndexMapping, redirectToHomePage, -} from '../../utils/common'; -import { checkDataAssetWidget } from '../../utils/entity'; +} from '../../../utils/common'; +import { checkDataAssetWidget } from '../../../utils/entity'; const entities = [ TableClass, diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/LandingPageWidgets/FollowingWidget.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/LandingPageWidgets/FollowingWidget.spec.ts new file mode 100644 index 000000000000..10f462ae47a4 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/LandingPageWidgets/FollowingWidget.spec.ts @@ -0,0 +1,88 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Page, test as base } from '@playwright/test'; +import { ApiEndpointClass } from '../../../support/entity/ApiEndpointClass'; +import { ContainerClass } from '../../../support/entity/ContainerClass'; +import { DashboardClass } from '../../../support/entity/DashboardClass'; +import { DashboardDataModelClass } from '../../../support/entity/DashboardDataModelClass'; +import { MlModelClass } from '../../../support/entity/MlModelClass'; +import { PipelineClass } from '../../../support/entity/PipelineClass'; +import { SearchIndexClass } from '../../../support/entity/SearchIndexClass'; +import { StoredProcedureClass } from '../../../support/entity/StoredProcedureClass'; +import { TableClass } from '../../../support/entity/TableClass'; +import { TopicClass } from '../../../support/entity/TopicClass'; +import { UserClass } from '../../../support/user/UserClass'; +import { performAdminLogin } from '../../../utils/admin'; +import { redirectToHomePage } from '../../../utils/common'; +import { + followEntity, + validateFollowedEntityToWidget, +} from '../../../utils/entity'; + +const entities = [ + TableClass, + DashboardClass, + PipelineClass, + TopicClass, + ContainerClass, + MlModelClass, + SearchIndexClass, + ApiEndpointClass, + DashboardDataModelClass, + StoredProcedureClass, +] as const; + +const adminUser = new UserClass(); + +const test = base.extend<{ adminPage: Page }>({ + adminPage: async ({ browser }, use) => { + const adminPage = await browser.newPage(); + await adminUser.login(adminPage); + await use(adminPage); + await adminPage.close(); + }, +}); + +entities.forEach((EntityClass) => { + const entity = new EntityClass(); + + test.describe(entity.getType(), () => { + test.beforeAll('Setup pre-requests', async ({ browser }) => { + const { apiContext, afterAction } = await performAdminLogin(browser); + + await adminUser.create(apiContext); + await adminUser.setAdminRole(apiContext); + await entity.create(apiContext); + await afterAction(); + }); + + test.afterAll('Cleanup', async ({ browser }) => { + const { apiContext, afterAction } = await performAdminLogin(browser); + await entity.delete(apiContext); + await afterAction(); + }); + + test('Check followed entity present in following widget', async ({ + adminPage, + }) => { + await redirectToHomePage(adminPage); + + await entity.visitEntityPage(adminPage); + + const entityName = entity.entityResponseData?.['displayName']; + + await followEntity(adminPage, entity.endpoint); + await validateFollowedEntityToWidget(adminPage, entityName, true); + }); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Explore/ExploreQuickFilters.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Explore/ExploreQuickFilters.tsx index 74981e6bcdea..a5df119827df 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Explore/ExploreQuickFilters.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Explore/ExploreQuickFilters.tsx @@ -181,7 +181,7 @@ const ExploreQuickFilters: FC = ({ }, [fields]); return ( - + {fields.map((field) => { const hasNullOption = fieldsWithNullValues.includes( field.key as EntityFields diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomizeMyData/CustomizeMyData.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomizeMyData/CustomizeMyData.tsx index 463107c321bc..7e1b6de91b33 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomizeMyData/CustomizeMyData.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomizeMyData/CustomizeMyData.tsx @@ -24,7 +24,7 @@ import { GlobalSettingsMenuCategory, } from '../../../../constants/GlobalSettings.constants'; import { LandingPageWidgetKeys } from '../../../../enums/CustomizablePage.enum'; -import { AssetsType, TabSpecificField } from '../../../../enums/entity.enum'; +import { TabSpecificField } from '../../../../enums/entity.enum'; import { Document } from '../../../../generated/entity/docStore/document'; import { EntityReference } from '../../../../generated/entity/type'; import { useApplicationStore } from '../../../../hooks/useApplicationStore'; @@ -150,13 +150,9 @@ function CustomizeMyData({ }); if (userData) { - const includeData = Object.values(AssetsType); const follows: EntityReference[] = userData.follows ?? []; - const includedFollowsData = follows.filter((data) => - includeData.includes(data.type as AssetsType) - ); - setFollowedDataCount(includedFollowsData.length); - setFollowedData(includedFollowsData.slice(0, 8)); + setFollowedDataCount(follows.length); + setFollowedData(follows.slice(0, 8)); } } catch (err) { setFollowedData([]); diff --git a/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts b/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts index 289fa61ef3ad..30734c945127 100644 --- a/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts +++ b/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts @@ -74,16 +74,6 @@ export enum EntityType { API_ENDPOINT = 'apiEndpoint', } -export enum AssetsType { - TABLE = 'table', - TOPIC = 'topic', - DASHBOARD = 'dashboard', - PIPELINE = 'pipeline', - MLMODEL = 'mlmodel', - DASHBOARD_DATA_MODEL = 'dashboardDataModel', - STORED_PROCEDURE = 'storedProcedure', -} - export enum EntityLineageDirection { TOP_BOTTOM = 'TB', LEFT_RIGHT = 'LR', diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx index 2a8eca41f410..fce0d9f918a6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx @@ -27,11 +27,7 @@ import Loader from '../../components/common/Loader/Loader'; import WelcomeScreen from '../../components/MyData/WelcomeScreen/WelcomeScreen.component'; import PageLayoutV1 from '../../components/PageLayoutV1/PageLayoutV1'; import { LOGGED_IN_USER_STORAGE_KEY } from '../../constants/constants'; -import { - AssetsType, - EntityType, - TabSpecificField, -} from '../../enums/entity.enum'; +import { EntityType, TabSpecificField } from '../../enums/entity.enum'; import { Thread } from '../../generated/entity/feed/thread'; import { PageType } from '../../generated/system/ui/page'; import { EntityReference } from '../../generated/type/entityReference'; @@ -124,13 +120,9 @@ const MyDataPage = () => { }); if (userData) { - const includeData = Object.values(AssetsType); const follows: EntityReference[] = userData.follows ?? []; - const includedFollowsData = follows.filter((data) => - includeData.includes(data.type as AssetsType) - ); - setFollowedDataCount(includedFollowsData.length); - setFollowedData(includedFollowsData.slice(0, 8)); + setFollowedDataCount(follows.length); + setFollowedData(follows.slice(0, 8)); } } catch (err) { setFollowedData([]); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx index d38845bcf9cc..7e4af11435f4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx @@ -61,12 +61,7 @@ import { } from '../constants/GlobalSettings.constants'; import { TAG_START_WITH } from '../constants/Tag.constants'; import { ResourceEntity } from '../context/PermissionProvider/PermissionProvider.interface'; -import { - AssetsType, - EntityTabs, - EntityType, - FqnPart, -} from '../enums/entity.enum'; +import { EntityTabs, EntityType, FqnPart } from '../enums/entity.enum'; import { ExplorePageTabs } from '../enums/Explore.enum'; import { SearchIndex } from '../enums/search.enum'; import { ServiceCategory, ServiceCategoryPlural } from '../enums/service.enum'; @@ -1220,12 +1215,6 @@ export const getTitleCase = (text?: string) => { return text ? startCase(text) : ''; }; -export const filterEntityAssets = (data: EntityReference[]) => { - const includedEntity = Object.values(AssetsType); - - return data.filter((d) => includedEntity.includes(d.type as AssetsType)); -}; - export const getResourceEntityFromEntityType = (entityType: string) => { switch (entityType) { case EntityType.TABLE: