mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-06 04:25:20 +00:00
* fix(#13284): persist the data between the next and back step in ingestion workflow form * chore: add cypress test * chore: update the test
This commit is contained in:
parent
e08a3dc7ad
commit
9e95ff47aa
@ -217,6 +217,7 @@ export const testServiceCreationAndIngestion = ({
|
|||||||
serviceType,
|
serviceType,
|
||||||
connectionInput,
|
connectionInput,
|
||||||
addIngestionInput,
|
addIngestionInput,
|
||||||
|
viewIngestionInput,
|
||||||
serviceName,
|
serviceName,
|
||||||
type = 'database',
|
type = 'database',
|
||||||
testIngestionButton = true,
|
testIngestionButton = true,
|
||||||
@ -341,6 +342,16 @@ export const testServiceCreationAndIngestion = ({
|
|||||||
|
|
||||||
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
|
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
|
||||||
|
|
||||||
|
if (viewIngestionInput) {
|
||||||
|
// Go back and data should persist
|
||||||
|
cy.get('[data-testid="back-button"]').scrollIntoView().click();
|
||||||
|
|
||||||
|
viewIngestionInput();
|
||||||
|
|
||||||
|
// Go Next
|
||||||
|
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
|
||||||
|
}
|
||||||
|
|
||||||
scheduleIngestion();
|
scheduleIngestion();
|
||||||
|
|
||||||
cy.contains(`${replaceAllSpacialCharWith_(serviceName)}_metadata`).should(
|
cy.contains(`${replaceAllSpacialCharWith_(serviceName)}_metadata`).should(
|
||||||
|
|||||||
@ -44,12 +44,19 @@ describe('MySQL Ingestion', () => {
|
|||||||
.type(`${Cypress.env('mysqlDatabaseSchema')}{enter}`);
|
.type(`${Cypress.env('mysqlDatabaseSchema')}{enter}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const viewIngestionInput = () => {
|
||||||
|
cy.get('.ant-select-selection-item-content')
|
||||||
|
.scrollIntoView()
|
||||||
|
.contains(`${Cypress.env('mysqlDatabaseSchema')}`);
|
||||||
|
};
|
||||||
|
|
||||||
testServiceCreationAndIngestion({
|
testServiceCreationAndIngestion({
|
||||||
serviceType,
|
serviceType,
|
||||||
connectionInput: mySqlConnectionInput,
|
connectionInput: mySqlConnectionInput,
|
||||||
addIngestionInput,
|
addIngestionInput,
|
||||||
serviceName,
|
serviceName,
|
||||||
serviceCategory: SERVICE_TYPE.Database,
|
serviceCategory: SERVICE_TYPE.Database,
|
||||||
|
viewIngestionInput,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -66,15 +66,23 @@ const AddIngestion = ({
|
|||||||
}: AddIngestionProps) => {
|
}: AddIngestionProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
// lazy initialization to initialize the data only once
|
||||||
|
const [workflowData, setWorkflowData] = useState<IngestionWorkflowData>(
|
||||||
|
() => ({
|
||||||
|
...(data?.sourceConfig.config ?? {}),
|
||||||
|
name: data?.name ?? getIngestionName(serviceData.name, pipelineType),
|
||||||
|
enableDebugLog: data?.loggerLevel === LogLevels.Debug,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const [scheduleInterval, setScheduleInterval] = useState(
|
const [scheduleInterval, setScheduleInterval] = useState(
|
||||||
() =>
|
() =>
|
||||||
data?.airflowConfig.scheduleInterval ??
|
data?.airflowConfig.scheduleInterval ??
|
||||||
getIngestionFrequency(pipelineType)
|
getIngestionFrequency(pipelineType)
|
||||||
);
|
);
|
||||||
|
|
||||||
const { sourceConfig, ingestionName, retries } = useMemo(
|
const { ingestionName, retries } = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
sourceConfig: data?.sourceConfig.config,
|
|
||||||
ingestionName:
|
ingestionName:
|
||||||
data?.name ?? getIngestionName(serviceData.name, pipelineType),
|
data?.name ?? getIngestionName(serviceData.name, pipelineType),
|
||||||
retries: data?.airflowConfig.retries ?? 0,
|
retries: data?.airflowConfig.retries ?? 0,
|
||||||
@ -105,7 +113,8 @@ const AddIngestion = ({
|
|||||||
);
|
);
|
||||||
const [showDeployModal, setShowDeployModal] = useState(false);
|
const [showDeployModal, setShowDeployModal] = useState(false);
|
||||||
|
|
||||||
const [workflowData, setWorkflowData] = useState<IngestionWorkflowData>();
|
const handleDataChange = (data: IngestionWorkflowData) =>
|
||||||
|
setWorkflowData(data);
|
||||||
|
|
||||||
const handleNext = (step: number) => {
|
const handleNext = (step: number) => {
|
||||||
setActiveIngestionStep(step);
|
setActiveIngestionStep(step);
|
||||||
@ -274,14 +283,13 @@ const AddIngestion = ({
|
|||||||
<div className="p-t-lg">
|
<div className="p-t-lg">
|
||||||
{activeIngestionStep === 1 && (
|
{activeIngestionStep === 1 && (
|
||||||
<IngestionWorkflowForm
|
<IngestionWorkflowForm
|
||||||
enableDebugLog={data?.loggerLevel === LogLevels.Debug}
|
|
||||||
okText={t('label.next')}
|
okText={t('label.next')}
|
||||||
operationType={status}
|
operationType={status}
|
||||||
pipeLineType={pipelineType}
|
pipeLineType={pipelineType}
|
||||||
serviceCategory={serviceCategory}
|
serviceCategory={serviceCategory}
|
||||||
workflowData={sourceConfig ?? {}}
|
workflowData={workflowData}
|
||||||
workflowName={ingestionName}
|
|
||||||
onCancel={handleCancelClick}
|
onCancel={handleCancelClick}
|
||||||
|
onChange={handleDataChange}
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -40,8 +40,6 @@ import { getSchemaByWorkflowType } from 'utils/IngestionWorkflowUtils';
|
|||||||
const IngestionWorkflowForm: FC<IngestionWorkflowFormProps> = ({
|
const IngestionWorkflowForm: FC<IngestionWorkflowFormProps> = ({
|
||||||
pipeLineType,
|
pipeLineType,
|
||||||
className,
|
className,
|
||||||
workflowName,
|
|
||||||
enableDebugLog,
|
|
||||||
okText,
|
okText,
|
||||||
cancelText,
|
cancelText,
|
||||||
serviceCategory,
|
serviceCategory,
|
||||||
@ -50,12 +48,10 @@ const IngestionWorkflowForm: FC<IngestionWorkflowFormProps> = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
onFocus,
|
onFocus,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const [internalData, setInternalData] = useState<IngestionWorkflowData>({
|
const [internalData, setInternalData] =
|
||||||
...workflowData,
|
useState<IngestionWorkflowData>(workflowData);
|
||||||
name: workflowName,
|
|
||||||
enableDebugLog,
|
|
||||||
});
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const schema = useMemo(
|
const schema = useMemo(
|
||||||
@ -88,6 +84,29 @@ const IngestionWorkflowForm: FC<IngestionWorkflowFormProps> = ({
|
|||||||
const handleOnChange = (e: IChangeEvent<IngestionWorkflowData>) => {
|
const handleOnChange = (e: IChangeEvent<IngestionWorkflowData>) => {
|
||||||
if (e.formData) {
|
if (e.formData) {
|
||||||
setInternalData(e.formData);
|
setInternalData(e.formData);
|
||||||
|
|
||||||
|
let formData = { ...e.formData };
|
||||||
|
if (isElasticSearchPipeline) {
|
||||||
|
formData = {
|
||||||
|
...omit(formData, [
|
||||||
|
'useSSL',
|
||||||
|
'verifyCerts',
|
||||||
|
'timeout',
|
||||||
|
'caCerts',
|
||||||
|
'useAwsCredentials',
|
||||||
|
'regionName',
|
||||||
|
]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (isDbtPipeline) {
|
||||||
|
formData = {
|
||||||
|
...formData,
|
||||||
|
dbtConfigSource: {
|
||||||
|
...omitBy(formData.dbtConfigSource ?? {}, isUndefined),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
onChange?.(formData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -127,10 +127,8 @@ export type IngestionWorkflowData = Pipeline & {
|
|||||||
|
|
||||||
export interface IngestionWorkflowFormProps {
|
export interface IngestionWorkflowFormProps {
|
||||||
pipeLineType: PipelineType;
|
pipeLineType: PipelineType;
|
||||||
workflowName: string;
|
|
||||||
serviceCategory: ServiceCategory;
|
serviceCategory: ServiceCategory;
|
||||||
workflowData: Pipeline;
|
workflowData: IngestionWorkflowData;
|
||||||
enableDebugLog: boolean;
|
|
||||||
operationType: FormSubmitType;
|
operationType: FormSubmitType;
|
||||||
cancelText?: string;
|
cancelText?: string;
|
||||||
okText?: string;
|
okText?: string;
|
||||||
@ -138,4 +136,5 @@ export interface IngestionWorkflowFormProps {
|
|||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
onFocus: (fieldId: string) => void;
|
onFocus: (fieldId: string) => void;
|
||||||
onSubmit: (data: IngestionWorkflowData) => void;
|
onSubmit: (data: IngestionWorkflowData) => void;
|
||||||
|
onChange?: (data: IngestionWorkflowData) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user