Fix #4864 Ingestion UI | Updating an existing Snowflake Usage Ingestion pipeline via UI is not working (#4891)

This commit is contained in:
Shailesh Parmar 2022-05-11 22:45:29 +05:30 committed by GitHub
parent f419929c3d
commit f440a8f501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 44 deletions

View File

@ -474,9 +474,7 @@ const AddIngestion = ({
if (onUpdateIngestion) {
setSaveState('waiting');
if (!data.deployed) {
setShowDeployModal(true);
}
setShowDeployModal(true);
onUpdateIngestion(updatedData, data, data.id as string, data.name)
.then(() => {
setSaveState('success');
@ -510,9 +508,7 @@ const AddIngestion = ({
};
const getSuccessMessage = () => {
const updateMessage = data?.deployed
? `has been updated successfully`
: showDeployButton
const updateMessage = showDeployButton
? 'has been updated, but failed to deploy'
: 'has been updated and deployed successfully';
const createMessage = showDeployButton

View File

@ -113,9 +113,9 @@ const Ingestion: React.FC<IngestionProps> = ({
.catch(() => setCurrTriggerId({ id: '', state: '' }));
};
const handleDeployIngestion = (id: string, ingestion: IngestionPipeline) => {
const handleDeployIngestion = (id: string) => {
setCurrDeployId({ id, state: 'waiting' });
deployIngestion(ingestion)
deployIngestion(id)
.then(() => {
setCurrDeployId({ id, state: 'success' });
setTimeout(() => setCurrDeployId({ id: '', state: '' }), 1500);
@ -332,9 +332,7 @@ const Ingestion: React.FC<IngestionProps> = ({
<button
className="link-text tw-mr-2"
data-testid="deploy"
onClick={() =>
handleDeployIngestion(ingestion.id as string, ingestion)
}>
onClick={() => handleDeployIngestion(ingestion.id as string)}>
{currDeployId.id === ingestion.id ? (
currDeployId.state === 'success' ? (
<FontAwesomeIcon icon="check" />

View File

@ -64,7 +64,7 @@ export interface IngestionProps {
currrentPage: number;
pagingHandler: (value: string | number, activePage?: number) => void;
deleteIngestion: (id: string, displayName: string) => Promise<void>;
deployIngestion: (data: IngestionPipeline) => Promise<void>;
deployIngestion: (id: string) => Promise<void>;
triggerIngestion: (id: string, displayName: string) => Promise<void>;
}

View File

@ -185,9 +185,7 @@ const EditIngestionPage = () => {
return updateIngestionPipeline(updateData as CreateIngestionPipeline)
.then((res: AxiosResponse) => {
if (res.data) {
if (!ingestionData.deployed) {
onIngestionDeploy();
}
onIngestionDeploy();
resolve();
} else {
throw jsonData['api-error-messages']['update-ingestion-error'];
@ -215,7 +213,7 @@ const EditIngestionPage = () => {
? activeIngestionStep >= 3
: activeIngestionStep >= 2;
return ingestion && !showIngestionButton && !ingestionData.deployed;
return ingestion && !showIngestionButton;
};
useEffect(() => {

View File

@ -22,9 +22,9 @@ import { getDashboards } from '../../axiosAPIs/dashboardAPI';
import { getDatabases } from '../../axiosAPIs/databaseAPI';
import {
deleteIngestionPipelineById,
deployIngestionPipelineById,
getIngestionPipelines,
triggerIngestionPipelineById,
updateIngestionPipeline,
} from '../../axiosAPIs/ingestionPipelineAPI';
import { fetchAirflowConfig } from '../../axiosAPIs/miscAPI';
import { getPipelines } from '../../axiosAPIs/pipelineAPI';
@ -51,7 +51,6 @@ import {
} from '../../constants/constants';
import { SearchIndex } from '../../enums/search.enum';
import { ServiceCategory } from '../../enums/service.enum';
import { CreateIngestionPipeline } from '../../generated/api/services/ingestionPipelines/createIngestionPipeline';
import { Dashboard } from '../../generated/entity/data/dashboard';
import { Database } from '../../generated/entity/data/database';
import { Pipeline } from '../../generated/entity/data/pipeline';
@ -288,33 +287,9 @@ const ServicePage: FunctionComponent = () => {
});
};
const deployIngestion = (data: IngestionPipeline) => {
const {
airflowConfig,
description,
displayName,
name,
owner,
pipelineType,
service,
source,
} = data;
const updateData = {
airflowConfig: {
...airflowConfig,
forceDeploy: true,
},
description,
displayName,
name,
owner,
pipelineType,
service,
sourceConfig: source.sourceConfig,
};
const deployIngestion = (id: string) => {
return new Promise<void>((resolve, reject) => {
return updateIngestionPipeline(updateData as CreateIngestionPipeline)
return deployIngestionPipelineById(id)
.then((res: AxiosResponse) => {
if (res.data) {
resolve();