Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -1306,11 +1306,9 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
"revokeAccessToken",
new RevokeAccessTokenResolver(this.entityClient, this.statefulTokenService))
.dataFetcher(
"createIngestionSource",
new UpsertIngestionSourceResolver(this.entityClient, this.entityService))
"createIngestionSource", new UpsertIngestionSourceResolver(this.entityClient))
.dataFetcher(
"updateIngestionSource",
new UpsertIngestionSourceResolver(this.entityClient, this.entityService))
"updateIngestionSource", new UpsertIngestionSourceResolver(this.entityClient))
.dataFetcher(
"deleteIngestionSource", new DeleteIngestionSourceResolver(this.entityClient))
.dataFetcher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.exception.DataHubGraphQLErrorCode;
import com.linkedin.datahub.graphql.exception.DataHubGraphQLException;
import com.linkedin.datahub.graphql.generated.OwnerEntityType;
import com.linkedin.datahub.graphql.generated.StringMapEntryInput;
import com.linkedin.datahub.graphql.generated.UpdateIngestionSourceConfigInput;
import com.linkedin.datahub.graphql.generated.UpdateIngestionSourceInput;
import com.linkedin.datahub.graphql.generated.UpdateIngestionSourceScheduleInput;
import com.linkedin.datahub.graphql.resolvers.ingest.IngestionAuthUtils;
import com.linkedin.datahub.graphql.resolvers.mutate.util.OwnerUtils;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.ingestion.DataHubIngestionSourceConfig;
import com.linkedin.ingestion.DataHubIngestionSourceInfo;
import com.linkedin.ingestion.DataHubIngestionSourceSchedule;
import com.linkedin.ingestion.DataHubIngestionSourceSource;
import com.linkedin.ingestion.DataHubIngestionSourceSourceType;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.key.DataHubIngestionSourceKey;
import com.linkedin.mxe.MetadataChangeProposal;
import graphql.schema.DataFetcher;
Expand All @@ -46,12 +43,9 @@
public class UpsertIngestionSourceResolver implements DataFetcher<CompletableFuture<String>> {

private final EntityClient _entityClient;
private final EntityService<?> _entityService;

public UpsertIngestionSourceResolver(
final EntityClient entityClient, final EntityService<?> entityService) {
public UpsertIngestionSourceResolver(final EntityClient entityClient) {
_entityClient = entityClient;
_entityService = entityService;
}

@Override
Expand Down Expand Up @@ -95,15 +89,7 @@ public CompletableFuture<String> get(final DataFetchingEnvironment environment)
return GraphQLConcurrencyUtils.supplyAsync(
() -> {
try {
String urn =
_entityClient.ingestProposal(context.getOperationContext(), proposal, false);

if (!ingestionSourceUrn.isPresent()) {
OwnerUtils.addCreatorAsOwner(context, urn, OwnerEntityType.CORP_USER, _entityService);
}

return urn;

return _entityClient.ingestProposal(context.getOperationContext(), proposal, false);
} catch (Exception e) {
throw new RuntimeException(
String.format(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.linkedin.datahub.graphql.resolvers.ingest.secret;

import static com.linkedin.datahub.graphql.TestUtils.getMockEntityService;
import static com.linkedin.datahub.graphql.resolvers.ingest.IngestTestUtils.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
Expand All @@ -14,7 +13,6 @@
import com.linkedin.entity.client.EntityClient;
import com.linkedin.events.metadata.ChangeType;
import com.linkedin.metadata.Constants;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.key.DataHubSecretKey;
import com.linkedin.metadata.utils.GenericRecordUtils;
import com.linkedin.mxe.MetadataChangeProposal;
Expand Down Expand Up @@ -77,9 +75,7 @@ public void testGetSuccess() throws Exception {
public void testGetUnauthorized() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
DataFetchingEnvironment mockEnv = Mockito.mock(DataFetchingEnvironment.class);
Expand All @@ -95,12 +91,10 @@ public void testGetUnauthorized() throws Exception {
public void testGetEntityClientException() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
Mockito.doThrow(RemoteInvocationException.class)
.when(mockClient)
.ingestProposal(any(), Mockito.any(), anyBoolean());
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
DataFetchingEnvironment mockEnv = Mockito.mock(DataFetchingEnvironment.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.linkedin.datahub.graphql.resolvers.ingest.source;

import static com.linkedin.datahub.graphql.TestUtils.getMockEntityService;
import static com.linkedin.datahub.graphql.TestUtils.verifyIngestProposal;
import static com.linkedin.datahub.graphql.resolvers.ingest.IngestTestUtils.*;
import static com.linkedin.metadata.Constants.*;
Expand All @@ -18,7 +17,6 @@
import com.linkedin.ingestion.DataHubIngestionSourceConfig;
import com.linkedin.ingestion.DataHubIngestionSourceInfo;
import com.linkedin.ingestion.DataHubIngestionSourceSchedule;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.r2.RemoteInvocationException;
import graphql.schema.DataFetchingEnvironment;
import org.mockito.Mockito;
Expand All @@ -43,9 +41,7 @@ private static UpdateIngestionSourceInput makeInput() {
public void testGetSuccess() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
QueryContext mockContext = getMockAllowContext();
Expand Down Expand Up @@ -83,9 +79,7 @@ public void testGetSuccess() throws Exception {
public void testGetUnauthorized() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
DataFetchingEnvironment mockEnv = Mockito.mock(DataFetchingEnvironment.class);
Expand All @@ -101,12 +95,10 @@ public void testGetUnauthorized() throws Exception {
public void testGetEntityClientException() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
Mockito.doThrow(RemoteInvocationException.class)
.when(mockClient)
.ingestProposal(any(), any(), Mockito.eq(false));
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
DataFetchingEnvironment mockEnv = Mockito.mock(DataFetchingEnvironment.class);
Expand All @@ -124,9 +116,7 @@ public void testUpsertWithInvalidCron() throws Exception {

// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
QueryContext mockContext = getMockAllowContext();
Expand All @@ -151,9 +141,7 @@ public void testUpsertWithInvalidTimezone() throws Exception {

// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService();
UpsertIngestionSourceResolver resolver =
new UpsertIngestionSourceResolver(mockClient, mockService);
UpsertIngestionSourceResolver resolver = new UpsertIngestionSourceResolver(mockClient);

// Execute resolver
QueryContext mockContext = getMockAllowContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface AutoCompleteProps {
defaultValue?: ValueType;
options: OptionType[];
open?: boolean;
placeholder?: string;

defaultActiveFirstOption?: boolean;
filterOption?: boolean | ((inputValue: ValueType, option?: OptionType) => boolean);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Divider } from 'antd';
import { Link } from 'react-router-dom';
import styled from 'styled-components';

Expand Down Expand Up @@ -30,3 +31,10 @@ export const BreadcrumbButton = styled(Text)`
color: ${colors.primary[500]};
}
`;

export const VerticalDivider = styled(Divider)`
color: ${colors.gray[100]};
height: 16px;
width: 2px;
margin: 0 4px;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const getButtonPadding = (size: SizeOptions, hasChildren: boolean, isCircle: boo
const paddingStyles = {
xs: {
vertical: 6,
horizontal: 6,
horizontal: 8,
},
sm: {
vertical: 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement
labelTooltip?: string;
error?: string;
isChecked?: boolean;
setIsChecked?: React.Dispatch<React.SetStateAction<boolean>>;
setIsChecked?: (isChecked: boolean) => void;
isDisabled?: boolean;
isIntermediate?: boolean;
isRequired?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const iconDefaults: IconPropsDefaults = {
tooltipText: '',
};

const ICON_NAMES = getIconNames();

export const Icon = ({
icon,
source = iconDefaults.source,
Expand All @@ -29,7 +31,7 @@ export const Icon = ({
tooltipText,
...props
}: IconProps) => {
const { filled, outlined } = getIconNames();
const { filled, outlined } = ICON_NAMES;
const { theme } = useCustomTheme();

// Return early if no icon is provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getInputType } from '@components/components/Input/utils';
export const inputDefaults: InputProps = {
value: '',
setValue: () => {},
label: 'Label',
label: '',
placeholder: 'Placeholder',
error: '',
warning: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { IconProps } from '@components/components/Icon/types';

export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
value?: string | number | readonly string[] | undefined;
setValue?: React.Dispatch<React.SetStateAction<string>>;
label: string;
setValue?: (newValue: string) => void;
label?: string;
placeholder?: string;
icon?: IconProps;
error?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export interface Props {
tabs: Tab[];
selectedTab?: string;
onChange?: (selectedTabKey: string) => void;
onTabClick?: (activeKey: string, e: React.KeyboardEvent | React.MouseEvent) => void;
urlMap?: Record<string, string>;
onUrlChange?: (url: string) => void;
defaultTab?: string;
Expand All @@ -249,12 +250,14 @@ export interface Props {
scrollToTopOnChange?: boolean;
maxHeight?: string;
stickyHeader?: boolean;
destroyInactiveTabPane?: boolean;
}

export function Tabs({
tabs,
selectedTab,
onChange,
onTabClick,
urlMap,
onUrlChange = (url) => window.history.replaceState({}, '', url),
defaultTab,
Expand All @@ -266,6 +269,7 @@ export function Tabs({
scrollToTopOnChange = false,
maxHeight = '100%',
stickyHeader = false,
destroyInactiveTabPane,
}: Props) {
const tabsContainerRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -323,6 +327,8 @@ export function Tabs({
onUrlChange(urlMap[key]);
}
}}
onTabClick={onTabClick}
destroyInactiveTabPane={destroyInactiveTabPane}
$navMarginBottom={styleOptions?.navMarginBottom}
$navMarginTop={styleOptions?.navMarginTop}
$containerHeight={styleOptions?.containerHeight}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { TextAreaProps } from '@components/components/TextArea/types';

export const textAreaDefaults: TextAreaProps = {
label: 'Label',
label: '',
placeholder: 'Placeholder',
error: '',
warning: '',
Expand Down Expand Up @@ -55,9 +55,11 @@ export const TextArea = ({

return (
<TextAreaWrapper>
<Label>
{label} {isRequired && <Required>*</Required>}
</Label>
{label && (
<Label aria-label={label}>
{label} {isRequired && <Required>*</Required>}
</Label>
)}
<TextAreaContainer {...textAreaBaseProps}>
{icon && <StyledIcon icon={icon} size="lg" />}
<TextAreaField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TextareaHTMLAttributes } from 'react';
import { IconNames } from '@components/components/Icon';

export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
label: string;
label?: string;
placeholder?: string;
icon?: IconNames;
error?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ export const EntitySearchDropdown: React.FC<EntitySearchDropdownProps> = ({
<Input
label=""
value={searchQuery}
setValue={(value) => {
const newValue = typeof value === 'function' ? value(searchQuery) : value;
handleSearchChange(newValue);
}}
Comment on lines -172 to -175
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why make this change here? just because it looks like this was needed in the PR that introduced it: https://github.com/acryldata/datahub-fork/commit/312af9d71c9a9e22a3343a6c77f9cf0896b6e677

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's because I've changes type of setValue
from
React.Dispatch<React.SetStateAction<string>>
to
(newValue: string) => void;

it's simpler to use now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome

setValue={handleSearchChange}
placeholder={placeholder}
icon={{ icon: 'Search' }}
data-testid="entity-search-select-input"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Breadcrumb, colors } from '@components';
import { Divider } from 'antd';
import { Breadcrumb } from '@components';
import React, { useEffect } from 'react';
import { useLocation, useParams } from 'react-router';
import styled from 'styled-components';

import { VerticalDivider } from '@components/components/Breadcrumb/components';

import RunDetailsContent from '@app/ingestV2/runDetails/RunDetailsContent';
import { formatDateTime } from '@app/ingestV2/shared/components/columns/DateTimeColumn';
Expand All @@ -12,13 +12,6 @@ import { PageLayout } from '@app/sharedV2/layouts/PageLayout';

import { useGetIngestionExecutionRequestQuery } from '@graphql/ingestion.generated';

const VerticalDivider = styled(Divider)`
color: ${colors.gray[100]};
height: 16px;
width: 2px;
margin: 0 4px;
`;

export default function IngestionRunDetailsPage() {
const { urn } = useParams<{ urn: string }>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const useCapabilitySummary = () => {
setError(null);

try {
const response = await fetch('assets/ingestion/capability_summary.json');
const response = await fetch('/assets/ingestion/capability_summary.json');
if (!response.ok) {
throw new Error(`Failed to fetch capability summary: ${response.status} ${response.statusText}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { CreateScheduleStep } from '@app/ingestV2/source/builder/CreateScheduleS
import { DefineRecipeStep } from '@app/ingestV2/source/builder/DefineRecipeStep';
import { NameSourceStep } from '@app/ingestV2/source/builder/NameSourceStep';
import { SelectTemplateStep } from '@app/ingestV2/source/builder/SelectTemplateStep';
import sourcesJson from '@app/ingestV2/source/builder/sources.json';
import { SourceBuilderState, StepProps } from '@app/ingestV2/source/builder/types';
import { useIngestionSources } from '@app/ingestV2/source/builder/useIngestionSources';

import { IngestionSource } from '@types';

Expand Down Expand Up @@ -87,7 +87,7 @@ export const IngestionSourceBuilderModal = ({
},
});

const ingestionSources = JSON.parse(JSON.stringify(sourcesJson)); // TODO: replace with call to server once we have access to dynamic list of sources
const { ingestionSources } = useIngestionSources();

const sendAnalyticsStepViewedEvent = useCallback(
(step: IngestionSourceBuilderStep) => {
Expand Down
Loading
Loading