Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into kafka-message-size-…
Browse files Browse the repository at this point in the history
…parameters
  • Loading branch information
david-leifker committed Oct 28, 2023
2 parents 1bacbbe + 9ae0e93 commit 83479a9
Show file tree
Hide file tree
Showing 136 changed files with 7,544 additions and 2,476 deletions.
1 change: 1 addition & 0 deletions datahub-web-react/src/app/home/HomePageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export const HomePageHeader = () => {
viewsEnabled={viewsEnabled}
combineSiblings
showQuickFilters
showViewAllResults
/>
{searchResultsToShow && searchResultsToShow.length > 0 && (
<SuggestionsContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const NameSourceStep = ({ state, updateState, prev, submit }: StepProps)
<Input
data-testid="cli-version-input"
className="cli-version-input"
placeholder="(e.g. 0.10.5)"
placeholder="(e.g. 0.12.0)"
value={state.config?.version || ''}
onChange={(event) => setVersion(event.target.value)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export default function PolicyDetailsModal({ policy, visible, onClose, privilege
const isMetadataPolicy = policy?.type === PolicyType.Metadata;

const resources = convertLegacyResourceFilter(policy?.resources);
const resourceTypes = getFieldValues(resources?.filter, 'RESOURCE_TYPE') || [];
const resourceEntities = getFieldValues(resources?.filter, 'RESOURCE_URN') || [];
const resourceTypes = getFieldValues(resources?.filter, 'TYPE') || [];
const resourceEntities = getFieldValues(resources?.filter, 'URN') || [];
const domains = getFieldValues(resources?.filter, 'DOMAIN') || [];

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export default function PolicyPrivilegeForm({
} = useAppConfig();

const resources: ResourceFilter = convertLegacyResourceFilter(maybeResources) || EMPTY_POLICY.resources;
const resourceTypes = getFieldValues(resources.filter, 'RESOURCE_TYPE') || [];
const resourceEntities = getFieldValues(resources.filter, 'RESOURCE_URN') || [];
const resourceTypes = getFieldValues(resources.filter, 'TYPE') || [];
const resourceEntities = getFieldValues(resources.filter, 'URN') || [];

const getDisplayName = (entity) => {
if (!entity) {
Expand Down Expand Up @@ -145,10 +145,7 @@ export default function PolicyPrivilegeForm({
};
setResources({
...resources,
filter: setFieldValues(filter, 'RESOURCE_TYPE', [
...resourceTypes,
createCriterionValue(selectedResourceType),
]),
filter: setFieldValues(filter, 'TYPE', [...resourceTypes, createCriterionValue(selectedResourceType)]),
});
};

Expand All @@ -160,7 +157,7 @@ export default function PolicyPrivilegeForm({
...resources,
filter: setFieldValues(
filter,
'RESOURCE_TYPE',
'TYPE',
resourceTypes?.filter((criterionValue) => criterionValue.value !== deselectedResourceType),
),
});
Expand All @@ -173,7 +170,7 @@ export default function PolicyPrivilegeForm({
};
setResources({
...resources,
filter: setFieldValues(filter, 'RESOURCE_URN', [
filter: setFieldValues(filter, 'URN', [
...resourceEntities,
createCriterionValueWithEntity(
resource,
Expand All @@ -192,7 +189,7 @@ export default function PolicyPrivilegeForm({
...resources,
filter: setFieldValues(
filter,
'RESOURCE_URN',
'URN',
resourceEntities?.filter((criterionValue) => criterionValue.value !== resource),
),
});
Expand Down
4 changes: 2 additions & 2 deletions datahub-web-react/src/app/permissions/policy/policyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ export const convertLegacyResourceFilter = (resourceFilter: Maybe<ResourceFilter
}
const criteria = new Array<PolicyMatchCriterion>();
if (resourceFilter.type) {
criteria.push(createCriterion('RESOURCE_TYPE', [createCriterionValue(resourceFilter.type)]));
criteria.push(createCriterion('TYPE', [createCriterionValue(resourceFilter.type)]));
}
if (resourceFilter.resources && resourceFilter.resources.length > 0) {
criteria.push(createCriterion('RESOURCE_URN', resourceFilter.resources.map(createCriterionValue)));
criteria.push(createCriterion('URN', resourceFilter.resources.map(createCriterionValue)));
}
return {
filter: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function EntityPathsModal({ paths, resultEntityUrn, hideModal }:

return (
<StyledModal
data-testid="entity-paths-modal"
title={
<Header>
Column path{paths.length > 1 && 's'} from{' '}
Expand Down
6 changes: 4 additions & 2 deletions datahub-web-react/src/app/search/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ interface Props {
setIsSearchBarFocused?: (isSearchBarFocused: boolean) => void;
onFocus?: () => void;
onBlur?: () => void;
showViewAllResults?: boolean;
}

const defaultProps = {
Expand Down Expand Up @@ -146,6 +147,7 @@ export const SearchBar = ({
setIsSearchBarFocused,
onFocus,
onBlur,
showViewAllResults = false,
}: Props) => {
const history = useHistory();
const [searchQuery, setSearchQuery] = useState<string | undefined>(initialQuery);
Expand Down Expand Up @@ -203,7 +205,7 @@ export const SearchBar = ({
const { quickFilters, selectedQuickFilter, setSelectedQuickFilter } = useQuickFiltersContext();

const autoCompleteQueryOptions = useMemo(() => {
if (effectiveQuery === '') return [];
if (effectiveQuery === '' || !showViewAllResults) return [];

return [
{
Expand All @@ -212,7 +214,7 @@ export const SearchBar = ({
type: EXACT_AUTOCOMPLETE_OPTION_TYPE,
},
];
}, [effectiveQuery]);
}, [effectiveQuery, showViewAllResults]);

const autoCompleteEntityOptions = useMemo(() => {
return suggestions.map((suggestion: AutoCompleteResultForEntity) => {
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/app/search/SearchHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const SearchHeader = ({
combineSiblings
fixAutoComplete
showQuickFilters
showViewAllResults
/>
</LogoSearchContainer>
<NavGroup>
Expand Down
12 changes: 3 additions & 9 deletions datahub-web-react/src/app/search/useGetSearchQueryInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation, useParams } from 'react-router';
import { useMemo } from 'react';
import { FacetFilterInput, EntityType } from '../../types.generated';
import { useEntityRegistry } from '../useEntityRegistry';
import { ENTITY_FILTER_NAME, FILTER_DELIMITER, UnionType } from './utils/constants';
import { ENTITY_FILTER_NAME, UnionType } from './utils/constants';
import { useUserContext } from '../context/useUserContext';
import useFilters from './utils/useFilters';
import { generateOrFilters } from './utils/generateOrFilters';
Expand All @@ -27,12 +27,6 @@ export default function useGetSearchQueryInputs(excludedFilterFields?: Array<str
const sortInput = useSortInput();

const filters: Array<FacetFilterInput> = useFilters(params);
const nonNestedFilters = filters.filter(
(f) => !f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);
const nestedFilters = filters.filter(
(f) => f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);
const entityFilters: Array<EntityType> = useMemo(
() =>
filters
Expand All @@ -43,8 +37,8 @@ export default function useGetSearchQueryInputs(excludedFilterFields?: Array<str
);

const orFilters = useMemo(
() => generateOrFilters(unionType, nonNestedFilters, nestedFilters),
[nonNestedFilters, nestedFilters, unionType],
() => generateOrFilters(unionType, filters, excludedFilterFields),
[filters, excludedFilterFields, unionType],
);

return { entityFilters, query, unionType, filters, orFilters, viewUrn, page, activeType, sortInput };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
DOMAINS_FILTER_NAME,
ENTITY_SUB_TYPE_FILTER_NAME,
ENTITY_TYPE_FILTER_NAME,
ENTITY_FILTER_NAME,
TAGS_FILTER_NAME,
UnionType,
} from '../constants';
Expand All @@ -10,7 +10,7 @@ import { generateOrFilters } from '../generateOrFilters';
describe('generateOrFilters', () => {
it('should generate orFilters with UnionType.AND', () => {
const filters = [
{ field: ENTITY_TYPE_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: ENTITY_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
];
const orFilters = generateOrFilters(UnionType.AND, filters);
Expand All @@ -24,7 +24,7 @@ describe('generateOrFilters', () => {

it('should generate orFilters with UnionType.OR', () => {
const filters = [
{ field: ENTITY_TYPE_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: ENTITY_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
];
const orFilters = generateOrFilters(UnionType.OR, filters);
Expand All @@ -43,17 +43,23 @@ describe('generateOrFilters', () => {
const filters = [
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] },
];
const nestedFilters = [{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] }];
const orFilters = generateOrFilters(UnionType.AND, filters, nestedFilters);
// const nestedFilters = [{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] }];
const orFilters = generateOrFilters(UnionType.AND, filters);

expect(orFilters).toMatchObject([
{
and: [...filters, { field: '_entityType', values: ['CONTAINER'] }],
and: [
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: '_entityType', values: ['CONTAINER'] },
],
},
{
and: [
...filters,
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: '_entityType', values: ['DATASET'] },
{ field: 'typeNames', values: ['table'] },
],
Expand All @@ -65,9 +71,9 @@ describe('generateOrFilters', () => {
const filters = [
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] },
];
const nestedFilters = [{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] }];
const orFilters = generateOrFilters(UnionType.OR, filters, nestedFilters);
const orFilters = generateOrFilters(UnionType.OR, filters);

expect(orFilters).toMatchObject([
{
Expand All @@ -87,4 +93,18 @@ describe('generateOrFilters', () => {
},
]);
});

it('should generate orFilters and exclude filters with a provided exclude field', () => {
const filters = [
{ field: ENTITY_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
];
const orFilters = generateOrFilters(UnionType.AND, filters, [ENTITY_FILTER_NAME]);

expect(orFilters).toMatchObject([
{
and: [{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] }],
},
]);
});
});
16 changes: 11 additions & 5 deletions datahub-web-react/src/app/search/utils/generateOrFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,34 @@ function generateInputWithNestedFilters(filters: FacetFilterInput[], nestedFilte
export function generateOrFilters(
unionType: UnionType,
filters: FacetFilterInput[],
nestedFilters: FacetFilterInput[] = [],
excludedFilterFields: string[] = [],
): AndFilterInput[] {
if ((filters?.length || 0) === 0 && nestedFilters.length === 0) {
if ((filters?.length || 0) === 0) {
return [];
}
const nonNestedFilters = filters.filter(
(f) => !f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);
const nestedFilters = filters.filter(
(f) => f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);

if (unionType === UnionType.OR) {
const orFiltersWithNestedFilters = generateInputWithNestedFilters([], nestedFilters);
const orFilters = filters.map((filter) => ({
const orFilters = nonNestedFilters.map((filter) => ({
and: [filter],
}));
return [...orFilters, ...orFiltersWithNestedFilters];
}
const andFiltersWithNestedFilters = generateInputWithNestedFilters(filters, nestedFilters);
const andFiltersWithNestedFilters = generateInputWithNestedFilters(nonNestedFilters, nestedFilters);

if (andFiltersWithNestedFilters.length) {
return andFiltersWithNestedFilters;
}

return [
{
and: filters,
and: nonNestedFilters,
},
];
}
4 changes: 3 additions & 1 deletion docker/kafka-setup/kafka-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ if [[ $KAFKA_PROPERTIES_SECURITY_PROTOCOL == "SSL" ]]; then
fi
if [[ -n $KAFKA_PROPERTIES_SSL_TRUSTSTORE_LOCATION ]]; then
echo "ssl.truststore.location=$KAFKA_PROPERTIES_SSL_TRUSTSTORE_LOCATION" >> $CONNECTION_PROPERTIES_PATH
echo "ssl.truststore.password=$KAFKA_PROPERTIES_SSL_TRUSTSTORE_PASSWORD" >> $CONNECTION_PROPERTIES_PATH
if [[ $KAFKA_PROPERTIES_SSL_TRUSTSTORE_TYPE != "PEM" ]]; then
echo "ssl.truststore.password=$KAFKA_PROPERTIES_SSL_TRUSTSTORE_PASSWORD" >> $CONNECTION_PROPERTIES_PATH
fi
if [[ -n $KAFKA_PROPERTIES_SSL_TRUSTSTORE_TYPE ]]; then
echo "ssl.truststore.type=$KAFKA_PROPERTIES_SSL_TRUSTSTORE_TYPE" >> $CONNECTION_PROPERTIES_PATH
fi
Expand Down
68 changes: 36 additions & 32 deletions docs-website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ module.exports = {
projectName: "datahub", // Usually your repo name.
staticDirectories: ["static", "genStatic"],
stylesheets: ["https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700&display=swap"],
scripts: [
{
src: "https://tools.luckyorange.com/core/lo.js?site-id=28ea8a38",
async: true,
defer: true,
},
],
noIndex: isSaas,
customFields: {
isSaas: isSaas,
Expand Down Expand Up @@ -50,44 +57,41 @@ module.exports = {
position: "right",
},
{
to: "https://demo.datahubproject.io/",
label: "Demo",
position: "right",
},
{
href: "https://blog.datahubproject.io/",
label: "Blog",
position: "right",
},
{
href: "https://feature-requests.datahubproject.io/roadmap",
label: "Roadmap",
type: "dropdown",
label: "Resources",
position: "right",
items: [
{
href: "https://demo.datahubproject.io/",
label: "Demo",
},
{
href: "https://blog.datahubproject.io/",
label: "Blog",
},
{
href: "https://feature-requests.datahubproject.io/roadmap",
label: "Roadmap",
},
{
href: "https://slack.datahubproject.io",
label: "Slack",
},
{
href: "https://github.com/datahub-project/datahub",
label: "GitHub",
},
{
href: "https://www.youtube.com/channel/UC3qFQC5IiwR5fvWEqi_tJ5w",
label: "YouTube",
},
],
},
{
type: "docsVersionDropdown",
position: "right",
position: "left",
dropdownActiveClassDisabled: true,
},
{
href: "https://slack.datahubproject.io",
"aria-label": "Slack",
position: "right",
className: "item__icon item__slack",
},
{
href: "https://github.com/datahub-project/datahub",
"aria-label": "GitHub",
position: "right",
className: "item__icon item__github",
},

{
href: "https://www.youtube.com/channel/UC3qFQC5IiwR5fvWEqi_tJ5w",
"aria-label": "YouTube",
position: "right",
className: "item__icon item__youtube",
},
],
},
footer: {
Expand Down
Loading

0 comments on commit 83479a9

Please sign in to comment.