Skip to content

Commit

Permalink
feat(ui): Provide filtering capability for Sub Types inside the UI (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 authored and shirshanka committed Nov 6, 2021
1 parent 937747a commit edf9d2c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions datahub-web-react/src/app/search/SearchFilterLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styled from 'styled-components';

import { AggregationMetadata, DataPlatform, EntityType, GlossaryTerm, Tag as TagType } from '../../types.generated';
import { StyledTag } from '../entity/shared/components/styled/StyledTag';
import { capitalizeFirstLetter } from '../shared/capitalizeFirstLetter';
import { useEntityRegistry } from '../useEntityRegistry';
import { ENTITY_FILTER_NAME } from './utils/constants';

Expand Down Expand Up @@ -71,6 +72,18 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => {
);
}

// Warning: Special casing for Sub-Types
if (field === 'typeNames') {
const subTypeDisplayName = capitalizeFirstLetter(aggregation.value);
return (
<>
<span>
{subTypeDisplayName} ({countText})
</span>
</>
);
}

return (
<>
{aggregation.value} ({countText})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AllEntitiesSearchAggregator {
private final EntitySearchServiceCache _entitySearchServiceCache;

private static final List<String> FILTER_RANKING =
ImmutableList.of("entity", "platform", "origin", "tags", "glossaryTerms");
ImmutableList.of("entity", "typeNames", "platform", "origin", "tags", "glossaryTerms");

public AllEntitiesSearchAggregator(EntityRegistry entityRegistry, EntitySearchService entitySearchService,
SearchRanker searchRanker, CacheManager cacheManager, int batchSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ record SubTypes {
/**
* The names of the specific types.
**/
@Searchable = {
"/*": {
"fieldType": "KEYWORD",
"addToFilters": true,
"filterNameOverride": "Sub Type",
"queryByDefault": true
}
}
typeNames: array[string]

}

0 comments on commit edf9d2c

Please sign in to comment.