mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	Fix #4864 Ingestion UI | Updating an existing Snowflake Usage Ingestion pipeline via UI is not working (#4891)
This commit is contained in:
		
							parent
							
								
									f419929c3d
								
							
						
					
					
						commit
						f440a8f501
					
				| @ -474,9 +474,7 @@ const AddIngestion = ({ | |||||||
| 
 | 
 | ||||||
|       if (onUpdateIngestion) { |       if (onUpdateIngestion) { | ||||||
|         setSaveState('waiting'); |         setSaveState('waiting'); | ||||||
|         if (!data.deployed) { |  | ||||||
|         setShowDeployModal(true); |         setShowDeployModal(true); | ||||||
|         } |  | ||||||
|         onUpdateIngestion(updatedData, data, data.id as string, data.name) |         onUpdateIngestion(updatedData, data, data.id as string, data.name) | ||||||
|           .then(() => { |           .then(() => { | ||||||
|             setSaveState('success'); |             setSaveState('success'); | ||||||
| @ -510,9 +508,7 @@ const AddIngestion = ({ | |||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const getSuccessMessage = () => { |   const getSuccessMessage = () => { | ||||||
|     const updateMessage = data?.deployed |     const updateMessage = showDeployButton | ||||||
|       ? `has been updated successfully` |  | ||||||
|       : showDeployButton |  | ||||||
|       ? 'has been updated, but failed to deploy' |       ? 'has been updated, but failed to deploy' | ||||||
|       : 'has been updated and deployed successfully'; |       : 'has been updated and deployed successfully'; | ||||||
|     const createMessage = showDeployButton |     const createMessage = showDeployButton | ||||||
|  | |||||||
| @ -113,9 +113,9 @@ const Ingestion: React.FC<IngestionProps> = ({ | |||||||
|       .catch(() => setCurrTriggerId({ id: '', state: '' })); |       .catch(() => setCurrTriggerId({ id: '', state: '' })); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const handleDeployIngestion = (id: string, ingestion: IngestionPipeline) => { |   const handleDeployIngestion = (id: string) => { | ||||||
|     setCurrDeployId({ id, state: 'waiting' }); |     setCurrDeployId({ id, state: 'waiting' }); | ||||||
|     deployIngestion(ingestion) |     deployIngestion(id) | ||||||
|       .then(() => { |       .then(() => { | ||||||
|         setCurrDeployId({ id, state: 'success' }); |         setCurrDeployId({ id, state: 'success' }); | ||||||
|         setTimeout(() => setCurrDeployId({ id: '', state: '' }), 1500); |         setTimeout(() => setCurrDeployId({ id: '', state: '' }), 1500); | ||||||
| @ -332,9 +332,7 @@ const Ingestion: React.FC<IngestionProps> = ({ | |||||||
|         <button |         <button | ||||||
|           className="link-text tw-mr-2" |           className="link-text tw-mr-2" | ||||||
|           data-testid="deploy" |           data-testid="deploy" | ||||||
|           onClick={() => |           onClick={() => handleDeployIngestion(ingestion.id as string)}> | ||||||
|             handleDeployIngestion(ingestion.id as string, ingestion) |  | ||||||
|           }> |  | ||||||
|           {currDeployId.id === ingestion.id ? ( |           {currDeployId.id === ingestion.id ? ( | ||||||
|             currDeployId.state === 'success' ? ( |             currDeployId.state === 'success' ? ( | ||||||
|               <FontAwesomeIcon icon="check" /> |               <FontAwesomeIcon icon="check" /> | ||||||
|  | |||||||
| @ -64,7 +64,7 @@ export interface IngestionProps { | |||||||
|   currrentPage: number; |   currrentPage: number; | ||||||
|   pagingHandler: (value: string | number, activePage?: number) => void; |   pagingHandler: (value: string | number, activePage?: number) => void; | ||||||
|   deleteIngestion: (id: string, displayName: string) => Promise<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>; |   triggerIngestion: (id: string, displayName: string) => Promise<void>; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -185,9 +185,7 @@ const EditIngestionPage = () => { | |||||||
|       return updateIngestionPipeline(updateData as CreateIngestionPipeline) |       return updateIngestionPipeline(updateData as CreateIngestionPipeline) | ||||||
|         .then((res: AxiosResponse) => { |         .then((res: AxiosResponse) => { | ||||||
|           if (res.data) { |           if (res.data) { | ||||||
|             if (!ingestionData.deployed) { |  | ||||||
|             onIngestionDeploy(); |             onIngestionDeploy(); | ||||||
|             } |  | ||||||
|             resolve(); |             resolve(); | ||||||
|           } else { |           } else { | ||||||
|             throw jsonData['api-error-messages']['update-ingestion-error']; |             throw jsonData['api-error-messages']['update-ingestion-error']; | ||||||
| @ -215,7 +213,7 @@ const EditIngestionPage = () => { | |||||||
|         ? activeIngestionStep >= 3 |         ? activeIngestionStep >= 3 | ||||||
|         : activeIngestionStep >= 2; |         : activeIngestionStep >= 2; | ||||||
| 
 | 
 | ||||||
|     return ingestion && !showIngestionButton && !ingestionData.deployed; |     return ingestion && !showIngestionButton; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   useEffect(() => { |   useEffect(() => { | ||||||
|  | |||||||
| @ -22,9 +22,9 @@ import { getDashboards } from '../../axiosAPIs/dashboardAPI'; | |||||||
| import { getDatabases } from '../../axiosAPIs/databaseAPI'; | import { getDatabases } from '../../axiosAPIs/databaseAPI'; | ||||||
| import { | import { | ||||||
|   deleteIngestionPipelineById, |   deleteIngestionPipelineById, | ||||||
|  |   deployIngestionPipelineById, | ||||||
|   getIngestionPipelines, |   getIngestionPipelines, | ||||||
|   triggerIngestionPipelineById, |   triggerIngestionPipelineById, | ||||||
|   updateIngestionPipeline, |  | ||||||
| } from '../../axiosAPIs/ingestionPipelineAPI'; | } from '../../axiosAPIs/ingestionPipelineAPI'; | ||||||
| import { fetchAirflowConfig } from '../../axiosAPIs/miscAPI'; | import { fetchAirflowConfig } from '../../axiosAPIs/miscAPI'; | ||||||
| import { getPipelines } from '../../axiosAPIs/pipelineAPI'; | import { getPipelines } from '../../axiosAPIs/pipelineAPI'; | ||||||
| @ -51,7 +51,6 @@ import { | |||||||
| } from '../../constants/constants'; | } from '../../constants/constants'; | ||||||
| import { SearchIndex } from '../../enums/search.enum'; | import { SearchIndex } from '../../enums/search.enum'; | ||||||
| import { ServiceCategory } from '../../enums/service.enum'; | import { ServiceCategory } from '../../enums/service.enum'; | ||||||
| import { CreateIngestionPipeline } from '../../generated/api/services/ingestionPipelines/createIngestionPipeline'; |  | ||||||
| import { Dashboard } from '../../generated/entity/data/dashboard'; | import { Dashboard } from '../../generated/entity/data/dashboard'; | ||||||
| import { Database } from '../../generated/entity/data/database'; | import { Database } from '../../generated/entity/data/database'; | ||||||
| import { Pipeline } from '../../generated/entity/data/pipeline'; | import { Pipeline } from '../../generated/entity/data/pipeline'; | ||||||
| @ -288,33 +287,9 @@ const ServicePage: FunctionComponent = () => { | |||||||
|     }); |     }); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const deployIngestion = (data: IngestionPipeline) => { |   const deployIngestion = (id: string) => { | ||||||
|     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, |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     return new Promise<void>((resolve, reject) => { |     return new Promise<void>((resolve, reject) => { | ||||||
|       return updateIngestionPipeline(updateData as CreateIngestionPipeline) |       return deployIngestionPipelineById(id) | ||||||
|         .then((res: AxiosResponse) => { |         .then((res: AxiosResponse) => { | ||||||
|           if (res.data) { |           if (res.data) { | ||||||
|             resolve(); |             resolve(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Shailesh Parmar
						Shailesh Parmar