Skip to content

Commit

Permalink
fix(ui): enable search for tag entity in advanced filters and views
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterchen09 committed Jul 28, 2024
1 parent 01b3461 commit ace75e9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
14 changes: 11 additions & 3 deletions datahub-web-react/src/app/buildEntityRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import { RoleEntity } from './entity/Access/RoleEntity';
import { RestrictedEntity } from './entity/restricted/RestrictedEntity';
import { BusinessAttributeEntity } from './entity/businessAttribute/BusinessAttributeEntity';
import { SchemaFieldPropertiesEntity } from './entity/schemaField/SchemaFieldPropertiesEntity';
import { FeatureFlagsConfig } from '../types.generated';

export default function buildEntityRegistry() {
export default function buildEntityRegistry(featureFlags: FeatureFlagsConfig) {
const registry = new EntityRegistry();
registry.register(new DatasetEntity());
registry.register(new DashboardEntity());
Expand All @@ -48,9 +49,16 @@ export default function buildEntityRegistry() {
registry.register(new DataPlatformEntity());
registry.register(new DataProductEntity());
registry.register(new DataPlatformInstanceEntity());
registry.register(new ERModelRelationshipEntity());
registry.register(new RestrictedEntity());
registry.register(new BusinessAttributeEntity());
registry.register(new SchemaFieldPropertiesEntity());

if (featureFlags.businessAttributeEntityEnabled) {
registry.register(new BusinessAttributeEntity());
}

if (featureFlags.erModelRelationshipFeatureEnabled) {
registry.register(new ERModelRelationshipEntity());
}

return registry;
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ERModelRelationshipEntity implements Entity<ErModelRelationship> {

getPathName = () => 'erModelRelationship';

getCollectionName = () => '';
getCollectionName = () => 'ER-Model-Relationships';

getEntityName = () => 'ER-Model-Relationship';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ export class SchemaFieldPropertiesEntity implements Entity<SchemaFieldEntity> {
// Currently unused.
getPathName = () => 'schemaField';

// Currently unused.
getEntityName = () => 'schemaField';
getEntityName = () => 'Schema Field';

// Currently unused.
getCollectionName = () => 'schemaFields';
getCollectionName = () => 'Schema Fields';

// Currently unused.
renderProfile = (_: string) => <></>;
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/entity/tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class TagEntity implements Entity<Tag> {
);
};

isSearchEnabled = () => false;
isSearchEnabled = () => true;

isBrowseEnabled = () => false;

Expand Down
4 changes: 4 additions & 0 deletions datahub-web-react/src/app/search/ChooseEntityTypeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const ChooseEntityTypeModal = ({ defaultValues, onCloseModal, onOk, title
const entityRegistry = useEntityRegistry();
const entityTypes = entityRegistry.getSearchEntityTypes();

entityTypes.sort((a, b) => {
return entityRegistry.getCollectionName(a).localeCompare(entityRegistry.getCollectionName(b));
});

const [stagedValues, setStagedValues] = useState(defaultValues || []);

const addEntityType = (newType) => {
Expand Down
8 changes: 6 additions & 2 deletions datahub-web-react/src/app/useBuildEntityRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { useMemo } from 'react';
import buildEntityRegistry from './buildEntityRegistry';
import { useAppConfig } from './useAppConfig';

export default function useBuildEntityRegistry() {
const appConfig = useAppConfig();
const { featureFlags } = appConfig.config;

return useMemo(() => {
return buildEntityRegistry();
}, []);
return buildEntityRegistry(featureFlags);
}, [featureFlags]);
}

0 comments on commit ace75e9

Please sign in to comment.