mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-03 20:19:31 +00:00 
			
		
		
		
	fix some entities not visible in Following widget (#17665)
* fix some entities not visible in Following widget * added some extra spacing in quick filter (cherry picked from commit 00fe8399adc74273be6a486e8969b0ece0e50d89)
This commit is contained in:
		
							parent
							
								
									d068a59aa8
								
							
						
					
					
						commit
						f52282dfee
					
				@ -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,
 | 
			
		||||
@ -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);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@ -181,7 +181,7 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
 | 
			
		||||
  }, [fields]);
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <Space wrap className="explore-quick-filters-container" size={[4, 0]}>
 | 
			
		||||
    <Space wrap className="explore-quick-filters-container" size={[8, 0]}>
 | 
			
		||||
      {fields.map((field) => {
 | 
			
		||||
        const hasNullOption = fieldsWithNullValues.includes(
 | 
			
		||||
          field.key as EntityFields
 | 
			
		||||
 | 
			
		||||
@ -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([]);
 | 
			
		||||
 | 
			
		||||
@ -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',
 | 
			
		||||
 | 
			
		||||
@ -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([]);
 | 
			
		||||
 | 
			
		||||
@ -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:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user