Skip to content

Commit

Permalink
Merge branch 'master' into ps-add-recipe-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro93 authored Jul 19, 2023
2 parents c145720 + ee84464 commit ca49921
Show file tree
Hide file tree
Showing 39 changed files with 573 additions and 233 deletions.
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/analytics/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export interface BrowseV2ToggleNodeEvent extends BaseEvent {
*/
export interface BrowseV2SelectNodeEvent extends BaseEvent {
type: EventType.BrowseV2SelectNodeEvent;
targetNode: 'browse';
targetNode: 'browse' | 'platform';
action: 'select' | 'deselect';
entity: string;
environment?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export const DefineRecipeStep = ({ state, updateState, goTo, prev, ingestionSour
const placeholderRecipe = getPlaceholderRecipe(ingestionSources, type);

const [stagedRecipeYml, setStagedRecipeYml] = useState(existingRecipeYaml || placeholderRecipe);
const [stagedRecipeName, setStagedRecipeName] = useState(state.name);

useEffect(() => {
if (existingRecipeYaml) {
setStagedRecipeName(state.name);
setStagedRecipeYml(existingRecipeYaml);
}
}, [existingRecipeYaml]);
}, [existingRecipeYaml, state.name]);

const [stepComplete, setStepComplete] = useState(false);

Expand Down Expand Up @@ -97,6 +99,7 @@ export const DefineRecipeStep = ({ state, updateState, goTo, prev, ingestionSour
if (type && CONNECTORS_WITH_FORM.has(type)) {
return (
<RecipeBuilder
key={stagedRecipeName}
state={state}
isEditing={isEditing}
displayRecipe={displayRecipe}
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/app/search/SearchResultList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const ResultWrapper = styled.div<{ showUpdatedStyles: boolean }>`
margin: 0 auto 8px auto;
padding: 8px 16px;
max-width: 1200px;
border-bottom: 1px solid ${ANTD_GRAY[5]};
`}
`;

Expand Down
32 changes: 22 additions & 10 deletions datahub-web-react/src/app/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import { BrowseProvider } from './sidebar/BrowseContext';
import { useIsBrowseV2, useIsSearchV2 } from './useSearchAndBrowseVersion';
import useToggleSidebar from './useToggleSidebar';

const SearchResultsWrapper = styled.div<{ showUpdatedStyles: boolean }>`
const SearchResultsWrapper = styled.div<{ v2Styles: boolean }>`
display: flex;
flex: 1;
${(props) =>
props.showUpdatedStyles &&
props.v2Styles &&
`
overflow: hidden;
`}
Expand All @@ -45,12 +45,14 @@ const SearchBody = styled.div`
overflow: auto;
`;

const ResultContainer = styled.div<{ displayUpdatedStyles: boolean }>`
const ResultContainer = styled.div<{ v2Styles: boolean }>`
flex: 1;
overflow: auto;
${(props) =>
props.displayUpdatedStyles
props.v2Styles
? `
display: flex;
flex-direction: column;
background-color: #F8F9FA;
`
: `
Expand All @@ -64,7 +66,7 @@ const PaginationControlContainer = styled.div`
text-align: center;
`;

const PaginationInfoContainer = styled.div`
const PaginationInfoContainer = styled.div<{ v2Styles: boolean }>`
padding-left: 24px;
padding-right: 32px;
height: 47px;
Expand All @@ -73,6 +75,7 @@ const PaginationInfoContainer = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
${({ v2Styles }) => v2Styles && `background-color: white;`}
`;

const LeftControlsContainer = styled.div`
Expand All @@ -92,6 +95,15 @@ const StyledTabToolbar = styled(TabToolbar)`

const SearchMenuContainer = styled.div``;

const SearchResultListContainer = styled.div<{ v2Styles: boolean }>`
${({ v2Styles }) =>
v2Styles &&
`
flex: 1;
overflow: auto;
`}
`;

interface Props {
unionType?: UnionType;
query: string;
Expand Down Expand Up @@ -163,7 +175,7 @@ export const SearchResults = ({
return (
<>
{loading && <Message type="loading" content="Loading..." style={{ marginTop: '10%' }} />}
<SearchResultsWrapper showUpdatedStyles={showSearchFiltersV2}>
<SearchResultsWrapper v2Styles={showSearchFiltersV2}>
<SearchBody>
{!showSearchFiltersV2 && (
<div id={SEARCH_RESULTS_FILTERS_ID} data-testid="search-filters-v1">
Expand All @@ -184,8 +196,8 @@ export const SearchResults = ({
</BrowseProvider>
</SidebarProvider>
)}
<ResultContainer displayUpdatedStyles={showSearchFiltersV2}>
<PaginationInfoContainer>
<ResultContainer v2Styles={showSearchFiltersV2}>
<PaginationInfoContainer v2Styles={showSearchFiltersV2}>
<LeftControlsContainer>
{showBrowseV2 && <ToggleSidebarButton isOpen={isSidebarOpen} onClick={toggleSidebar} />}
<Typography.Text>
Expand Down Expand Up @@ -223,7 +235,7 @@ export const SearchResults = ({
)}
{(error && <ErrorSection />) ||
(!loading && (
<>
<SearchResultListContainer v2Styles={showSearchFiltersV2}>
<SearchResultList
query={query}
searchResults={combinedSiblingSearchResults}
Expand Down Expand Up @@ -253,7 +265,7 @@ export const SearchResults = ({
/>
</SearchResultsRecommendationsContainer>
)}
</>
</SearchResultListContainer>
))}
</ResultContainer>
</SearchBody>
Expand Down
8 changes: 4 additions & 4 deletions datahub-web-react/src/app/search/sidebar/BrowseContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const useOnSelectBrowsePath = () => {
const selectedFilters = useSelectedFilters();
const onChangeFilters = useOnChangeFilters();

return (isSelected: boolean) => {
return (isSelected: boolean, removeFilters: string[] = []) => {
const overrides: Array<FacetFilterInput> = [];

// keep entity and subType filters for this given entity only if they exist, otherwise apply this entity filter
Expand Down Expand Up @@ -215,9 +215,9 @@ export const useOnSelectBrowsePath = () => {
values: [browseSearchFilter],
});

const filtersWithOverrides = applyFacetFilterOverrides(selectedFilters, overrides).filter(
(filter) => isSelected || !overrides.some((override) => override.field === filter.field),
);
const filtersWithOverrides = applyFacetFilterOverrides(selectedFilters, overrides)
.filter((filter) => !removeFilters.includes(filter.field))
.filter((filter) => isSelected || !overrides.some((override) => override.field === filter.field));

onChangeFilters(filtersWithOverrides);
};
Expand Down
3 changes: 1 addition & 2 deletions datahub-web-react/src/app/search/sidebar/BrowseNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ const BrowseNode = () => {
const environmentAggregation = useMaybeEnvironmentAggregation();
const platformAggregation = usePlatformAggregation();
const browseResultGroup = useBrowseResultGroup();
const { trackToggleNodeEvent } = useSidebarAnalytics();
const { count, entity } = browseResultGroup;
const hasEntityLink = !!entity;
const displayName = useBrowseDisplayName();
const { trackSelectNodeEvent } = useSidebarAnalytics();
const { trackSelectNodeEvent, trackToggleNodeEvent } = useSidebarAnalytics();

const { isOpen, isClosing, toggle } = useToggle({
initialValue: isBrowsePathPrefix && !isBrowsePathSelected,
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/app/search/sidebar/BrowseSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const Sidebar = styled.div<{ visible: boolean; width: number }>`
transition: width 250ms ease-in-out;
border-right: 1px solid ${(props) => props.theme.styles['border-color-base']};
background-color: #f8f9fa;
background: white;
`;

const SidebarHeader = styled.div`
Expand Down
69 changes: 39 additions & 30 deletions datahub-web-react/src/app/search/sidebar/PlatformNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { formatNumber } from '../../shared/formatNumber';
import ExpandableNode from './ExpandableNode';
import { useEntityRegistry } from '../../useEntityRegistry';
import { getFilterIconAndLabel } from '../filters/utils';
import { PLATFORM_FILTER_NAME } from '../utils/constants';
import { BROWSE_PATH_V2_FILTER_NAME, PLATFORM_FILTER_NAME } from '../utils/constants';
import useBrowsePagination from './useBrowsePagination';
import BrowseNode from './BrowseNode';
import SidebarLoadingError from './SidebarLoadingError';
Expand All @@ -15,9 +15,11 @@ import {
useEntityAggregation,
useIsPlatformSelected,
useMaybeEnvironmentAggregation,
useOnSelectBrowsePath,
usePlatformAggregation,
} from './BrowseContext';
import useSidebarAnalytics from './useSidebarAnalytics';
import { useHasFilterField } from './SidebarContext';

const PlatformIconContainer = styled.div`
width: 16px;
Expand All @@ -31,20 +33,18 @@ const Count = styled(Typography.Text)`
padding-right: 8px;
`;

const BrowseGroupListContainer = styled.div`
background: white;
border-radius: 8px;
padding-right: 8px;
`;

const PlatformNode = () => {
const isSelected = useIsPlatformSelected();
const isPlatformSelected = useIsPlatformSelected();
const hasBrowseFilter = useHasFilterField(BROWSE_PATH_V2_FILTER_NAME);
const isPlatformAndPathSelected = isPlatformSelected && hasBrowseFilter;
const isPlatformOnlySelected = isPlatformSelected && !hasBrowseFilter;
const entityAggregation = useEntityAggregation();
const environmentAggregation = useMaybeEnvironmentAggregation();
const platformAggregation = usePlatformAggregation();
const { count } = platformAggregation;
const registry = useEntityRegistry();
const { trackToggleNodeEvent } = useSidebarAnalytics();
const { trackToggleNodeEvent, trackSelectNodeEvent } = useSidebarAnalytics();
const onSelectBrowsePath = useOnSelectBrowsePath();

const { icon, label } = getFilterIconAndLabel(
PLATFORM_FILTER_NAME,
Expand All @@ -55,15 +55,21 @@ const PlatformNode = () => {
);

const { isOpen, isClosing, toggle } = useToggle({
initialValue: isSelected,
initialValue: isPlatformAndPathSelected,
closeDelay: 250,
onToggle: (isNowOpen: boolean) => trackToggleNodeEvent(isNowOpen, 'platform'),
});

const onClickHeader = () => {
const onClickTriangle = () => {
if (count) toggle();
};

const onClickHeader = () => {
const isNowPlatformOnlySelected = !isPlatformOnlySelected;
onSelectBrowsePath(isNowPlatformOnlySelected, [BROWSE_PATH_V2_FILTER_NAME]);
trackSelectNodeEvent(isNowPlatformOnlySelected ? 'select' : 'deselect', 'platform');
};

const { error, groups, loaded, observable, path, retry } = useBrowsePagination({ skip: !isOpen });

const color = '#000';
Expand All @@ -72,12 +78,17 @@ const PlatformNode = () => {
<ExpandableNode
isOpen={isOpen && !isClosing && loaded}
header={
<ExpandableNode.Header isOpen={isOpen} showBorder onClick={onClickHeader} style={{ paddingTop: 8 }}>
<ExpandableNode.SelectableHeader
isOpen={isOpen}
isSelected={isPlatformOnlySelected}
showBorder
onClick={onClickHeader}
>
<ExpandableNode.HeaderLeft>
<ExpandableNode.TriangleButton
isOpen={isOpen && !isClosing}
isVisible={!!platformAggregation.count}
onClick={onClickHeader}
onClick={onClickTriangle}
dataTestId={`browse-platform-${label}`}
/>
<PlatformIconContainer>{icon}</PlatformIconContainer>
Expand All @@ -86,26 +97,24 @@ const PlatformNode = () => {
</ExpandableNode.Title>
</ExpandableNode.HeaderLeft>
<Count color={color}>{formatNumber(platformAggregation.count)}</Count>
</ExpandableNode.Header>
</ExpandableNode.SelectableHeader>
}
body={
<ExpandableNode.Body>
<BrowseGroupListContainer>
{groups.map((group) => (
<BrowseProvider
key={group.name}
entityAggregation={entityAggregation}
environmentAggregation={environmentAggregation}
platformAggregation={platformAggregation}
browseResultGroup={group}
parentPath={path}
>
<BrowseNode />
</BrowseProvider>
))}
{error && <SidebarLoadingError onClickRetry={retry} />}
{observable}
</BrowseGroupListContainer>
{groups.map((group) => (
<BrowseProvider
key={group.name}
entityAggregation={entityAggregation}
environmentAggregation={environmentAggregation}
platformAggregation={platformAggregation}
browseResultGroup={group}
parentPath={path}
>
<BrowseNode />
</BrowseProvider>
))}
{error && <SidebarLoadingError onClickRetry={retry} />}
{observable}
</ExpandableNode.Body>
}
/>
Expand Down
8 changes: 5 additions & 3 deletions docker/kafka-setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG MAVEN_REPO="https://repo1.maven.org/maven2"
ARG SNAKEYAML_VERSION="2.0"

RUN rm /usr/share/java/cp-base-new/snakeyaml-*.jar \
&& wget -P /usr/share/java/cp-base-new $MAVEN_REPO/org/yaml/snakeyaml/$SNAKEYAML_VERSION/snakeyaml-$SNAKEYAML_VERSION.jar
&& wget -P /usr/share/java/cp-base-new $MAVEN_REPO/org/yaml/snakeyaml/$SNAKEYAML_VERSION/snakeyaml-$SNAKEYAML_VERSION.jar

# Based on https://github.com/blacktop's alpine kafka build
FROM python:3-alpine
Expand All @@ -17,7 +17,7 @@ ENV SCALA_VERSION 2.13
ENV CUB_CLASSPATH='"/usr/share/java/cp-base-new/*"'

# Confluent Docker Utils Version (Namely the tag or branch to grab from git to install)
ARG PYTHON_CONFLUENT_DOCKER_UTILS_VERSION="v0.0.58"
ARG PYTHON_CONFLUENT_DOCKER_UTILS_VERSION="v0.0.60"

# This can be overriden for an offline/air-gapped builds
ARG PYTHON_CONFLUENT_DOCKER_UTILS_INSTALL_SPEC="git+https://github.com/confluentinc/confluent-docker-utils@${PYTHON_CONFLUENT_DOCKER_UTILS_VERSION}"
Expand All @@ -36,7 +36,9 @@ RUN mkdir -p /opt \
&& adduser -DH -s /sbin/nologin kafka \
&& chown -R kafka: /opt/kafka \
&& echo "===> Installing python packages ..." \
&& pip install --no-cache-dir jinja2 requests \
&& pip install --no-cache-dir --upgrade pip wheel setuptools \
&& pip install jinja2 requests \
&& pip install "Cython<3.0" "PyYAML<6" --no-build-isolation \
&& pip install --prefer-binary --prefix=/usr/local --upgrade "${PYTHON_CONFLUENT_DOCKER_UTILS_INSTALL_SPEC}" \
&& rm -rf /tmp/* \
&& apk del --purge .build-deps
Expand Down
1 change: 1 addition & 0 deletions docker/quickstart/generate_and_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ set -euxo pipefail
python3 -m venv venv
source venv/bin/activate

pip install --upgrade pip wheel setuptools
pip install -r requirements.txt
python generate_docker_quickstart.py check-all
2 changes: 1 addition & 1 deletion docker/quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PyYAML==5.4.1
PyYAML==6.0
python-dotenv==0.17.0
click
Loading

0 comments on commit ca49921

Please sign in to comment.