Skip to content

Commit ace74fa

Browse files
fix(ui) Make multiple small updates to new search and browse (#8524)
Co-authored-by: Aseem Bansal <[email protected]>
1 parent 843f82b commit ace74fa

File tree

7 files changed

+24
-9
lines changed

7 files changed

+24
-9
lines changed

datahub-web-react/src/app/entity/domain/DataProductsTab/DataProductsTab.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ export default function DataProductsTab() {
5757
const domainUrn = entityData?.urn || '';
5858

5959
const { data, loading } = useGetSearchResultsForMultipleQuery({
60+
skip: !domainUrn,
6061
variables: {
6162
input: {
6263
types: [EntityType.DataProduct],
6364
query: query || '',
6465
start,
6566
count: DEFAULT_PAGE_SIZE,
6667
orFilters: [{ and: [{ field: DOMAINS_FILTER_NAME, values: [domainUrn] }] }],
68+
searchFlags: { skipCache: true },
6769
},
6870
},
6971
});

datahub-web-react/src/app/preview/DefaultPreviewCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export default function DefaultPreviewCard({
294294
{deprecation?.deprecated && (
295295
<DeprecationPill deprecation={deprecation} urn="" showUndeprecate={false} />
296296
)}
297-
{health && health.length && <EntityHealth baseUrl={url} health={health} />}
297+
{health && health.length > 0 && <EntityHealth baseUrl={url} health={health} />}
298298
{externalUrl && (
299299
<ExternalUrlButton
300300
externalUrl={externalUrl}

datahub-web-react/src/app/search/SearchFilterLabel.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { StyledTag } from '../entity/shared/components/styled/StyledTag';
1818
import { capitalizeFirstLetterOnly } from '../shared/textUtil';
1919
import { DomainLink } from '../shared/tags/DomainLink';
2020
import { useEntityRegistry } from '../useEntityRegistry';
21-
import { BROWSE_PATH_V2_FILTER_NAME, ENTITY_FILTER_NAME } from './utils/constants';
21+
import { BROWSE_PATH_V2_FILTER_NAME, ENTITY_FILTER_NAME, MAX_COUNT_VAL } from './utils/constants';
2222
import CustomAvatar from '../shared/avatar/CustomAvatar';
2323
import { IconStyleType } from '../entity/Entity';
2424
import { formatNumber } from '../shared/formatNumber';
@@ -40,8 +40,6 @@ const PreviewImage = styled.img`
4040
margin-right: 4px;
4141
`;
4242

43-
const MAX_COUNT_VAL = 10000;
44-
4543
// SearchFilterLabel renders custom labels for entity, tag, term & data platform filters. All other filters use the default behavior.
4644
export const SearchFilterLabel = ({ field, value, entity, count, hideCount }: Props) => {
4745
const entityRegistry = useEntityRegistry();

datahub-web-react/src/app/search/filters/FilterOption.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ import { EntityType, GlossaryNode, GlossaryTerm, Tag } from '../../../types.gene
77
import { generateColor } from '../../entity/shared/components/styled/StyledTag';
88
import { ANTD_GRAY } from '../../entity/shared/constants';
99
import { useEntityRegistry } from '../../useEntityRegistry';
10-
import { PLATFORM_FILTER_NAME, TAGS_FILTER_NAME, TYPE_NAMES_FILTER_NAME } from '../utils/constants';
10+
import {
11+
ENTITY_SUB_TYPE_FILTER_NAME,
12+
MAX_COUNT_VAL,
13+
PLATFORM_FILTER_NAME,
14+
TAGS_FILTER_NAME,
15+
TYPE_NAMES_FILTER_NAME,
16+
} from '../utils/constants';
1117
import { IconSpacer, Label } from './ActiveFilter';
1218
import { isFilterOptionSelected, getFilterIconAndLabel, isAnyOptionSelected } from './utils';
1319
import { capitalizeFirstLetterOnly } from '../../shared/textUtil';
1420
import ParentNodes from './ParentNodes';
21+
import { formatNumber } from '../../shared/formatNumber';
1522

1623
const FilterOptionWrapper = styled.div<{ centerAlign?: boolean; addPadding?: boolean }>`
1724
display: flex;
@@ -119,6 +126,8 @@ export default function FilterOption({
119126
const isSubTypeFilter = field === TYPE_NAMES_FILTER_NAME;
120127
const isGlossaryTerm = entity?.type === EntityType.GlossaryTerm;
121128
const parentNodes: GlossaryNode[] = isGlossaryTerm ? (entity as GlossaryTerm).parentNodes?.nodes || [] : [];
129+
// only entity type filters return 10,000 max aggs
130+
const countText = count === MAX_COUNT_VAL && field === ENTITY_SUB_TYPE_FILTER_NAME ? '10k+' : formatNumber(count);
122131

123132
function updateFilterValues() {
124133
if (isFilterOptionSelected(selectedFilterOptions, value)) {
@@ -156,7 +165,7 @@ export default function FilterOption({
156165
<Label ellipsis={{ tooltip: label }} style={{ maxWidth: 150 }}>
157166
{isSubTypeFilter ? capitalizeFirstLetterOnly(label as string) : label}
158167
</Label>
159-
<CountText>{count}</CountText>
168+
<CountText>{countText}</CountText>
160169
{nestedOptions && nestedOptions.length > 0 && (
161170
<ArrowButton
162171
icon={<CaretUpOutlined />}

datahub-web-react/src/app/search/filters/OptionsDropdownMenu.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from 'react';
44
import styled from 'styled-components/macro';
55
import { useEntityRegistry } from '../../useEntityRegistry';
66
import { SearchBar } from '../SearchBar';
7+
import { useEnterKeyListener } from '../../shared/useEnterKeyListener';
78

89
const StyledButton = styled(Button)`
910
width: 100%;
@@ -73,6 +74,8 @@ export default function OptionsDropdownMenu({
7374
}: Props) {
7475
const entityRegistry = useEntityRegistry();
7576

77+
useEnterKeyListener({ querySelectorToExecuteClick: '#updateFiltersButton' });
78+
7679
return (
7780
<DropdownMenu alignRight={alignRight} data-testid="filter-dropdown">
7881
<ScrollableContent>
@@ -101,7 +104,7 @@ export default function OptionsDropdownMenu({
101104
</LoadingWrapper>
102105
)}
103106
</ScrollableContent>
104-
<StyledButton type="text" onClick={updateFilters} data-testid="update-filters">
107+
<StyledButton id="updateFiltersButton" type="text" onClick={updateFilters} data-testid="update-filters">
105108
Update
106109
</StyledButton>
107110
</DropdownMenu>

datahub-web-react/src/app/search/sidebar/EntityNode.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { formatNumber } from '../../shared/formatNumber';
88
import ExpandableNode from './ExpandableNode';
99
import EnvironmentNode from './EnvironmentNode';
1010
import useAggregationsQuery from './useAggregationsQuery';
11-
import { ORIGIN_FILTER_NAME, PLATFORM_FILTER_NAME } from '../utils/constants';
11+
import { MAX_COUNT_VAL, ORIGIN_FILTER_NAME, PLATFORM_FILTER_NAME } from '../utils/constants';
1212
import PlatformNode from './PlatformNode';
1313
import SidebarLoadingError from './SidebarLoadingError';
1414
import useToggle from '../../shared/useToggle';
@@ -28,6 +28,7 @@ const EntityNode = () => {
2828
const entityAggregation = useEntityAggregation();
2929
const hasEnvironmentFilter = useHasFilterField(ORIGIN_FILTER_NAME);
3030
const { count } = entityAggregation;
31+
const countText = count === MAX_COUNT_VAL ? '10k+' : formatNumber(count);
3132
const registry = useEntityRegistry();
3233
const { trackToggleNodeEvent } = useSidebarAnalytics();
3334

@@ -67,7 +68,7 @@ const EntityNode = () => {
6768
<ExpandableNode.Title color={color} size={16} padLeft>
6869
{registry.getCollectionName(entityType)}
6970
</ExpandableNode.Title>
70-
<Count color={color}>{formatNumber(entityAggregation.count)}</Count>
71+
<Count color={color}>{countText}</Count>
7172
</ExpandableNode.HeaderLeft>
7273
<ExpandableNode.CircleButton isOpen={isOpen && !isClosing} color={color} />
7374
</ExpandableNode.Header>

datahub-web-react/src/app/search/utils/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,5 @@ export const FilterModes = {
124124
} as const;
125125

126126
export type FilterMode = typeof FilterModes[keyof typeof FilterModes];
127+
128+
export const MAX_COUNT_VAL = 10000;

0 commit comments

Comments
 (0)