Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): search filter entity ui update #4866

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/preview/DefaultPreviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PlatformInfo = styled.div`
`;

const TitleContainer = styled.div`
margin-bottom: 0px;
margin-bottom: 5px;
line-height: 30px;
`;

Expand Down
26 changes: 18 additions & 8 deletions datahub-web-react/src/app/search/SearchFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ type Props = {
onFilterSelect: (selected: boolean, field: string, value: string) => void;
};

const SearchFilterWrapper = styled.div`
padding: 0 25px 15px 25px;
`;

const Title = styled.div`
font-weight: bold;
margin-bottom: 10px;
`;

const CheckBox = styled(Checkbox)`
margin: 5px 0;
`;

const ExpandButton = styled(Button)`
&&& {
padding: 4px;
Expand All @@ -30,19 +43,16 @@ export const SearchFilter = ({ facet, selectedFilters, onFilterSelect }: Props)
FILTERS_TO_TRUNCATE.indexOf(facet.field) > -1 && facet.aggregations.length > TRUNCATED_FILTER_LENGTH;

return (
// TODO(gabe-lyons): fix up styes to use styled-components
<div key={facet.field} style={{ padding: '0px 25px 15px 25px' }}>
<div style={{ fontWeight: 'bold', marginBottom: '10px' }}>{facet?.displayName}</div>
<SearchFilterWrapper key={facet.field}>
<Title>{facet?.displayName}</Title>
{facet.aggregations.map((aggregation, i) => {
if (i >= TRUNCATED_FILTER_LENGTH && !expanded && shouldTruncate) {
return null;
}
return (
<span key={`${facet.field}-${aggregation.value}`}>
<Checkbox
<CheckBox
data-testid={`facet-${facet.field}-${aggregation.value}`}
// TODO(gabe-lyons): fix up styling to use styled-components
style={{ margin: '5px 0px' }}
checked={
selectedFilters.find(
(f) => f.field === facet.field && f.value === aggregation.value,
Expand All @@ -53,7 +63,7 @@ export const SearchFilter = ({ facet, selectedFilters, onFilterSelect }: Props)
}
>
<SearchFilterLabel field={facet.field} aggregation={aggregation} />
</Checkbox>
</CheckBox>
<br />
</span>
);
Expand All @@ -63,6 +73,6 @@ export const SearchFilter = ({ facet, selectedFilters, onFilterSelect }: Props)
{expanded ? '- Less' : '+ More'}
</ExpandButton>
)}
</div>
</SearchFilterWrapper>
);
};
5 changes: 5 additions & 0 deletions datahub-web-react/src/app/search/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ export const GLOSSARY_FILTER_NAME = 'glossaryTerms';
export const CONTAINER_FILTER_NAME = 'container';
export const DOMAINS_FILTER_NAME = 'domains';
export const OWNERS_FILTER_NAME = 'owners';
export const TYPE_FILTER_NAME = 'typeNames';
export const PLATFORM_FILTER_NAME = 'platform';

export const FILTERS_TO_TRUNCATE = [
TAG_FILTER_NAME,
GLOSSARY_FILTER_NAME,
CONTAINER_FILTER_NAME,
DOMAINS_FILTER_NAME,
OWNERS_FILTER_NAME,
ENTITY_FILTER_NAME,
TYPE_FILTER_NAME,
PLATFORM_FILTER_NAME,
];
export const TRUNCATED_FILTER_LENGTH = 5;