mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	revert search index disabling from ui (#14272)
This commit is contained in:
		
							parent
							
								
									376bf4ec58
								
							
						
					
					
						commit
						62d0331b53
					
				| @ -59,12 +59,7 @@ import { | ||||
| 
 | ||||
| const AppRunsHistory = forwardRef( | ||||
|   ( | ||||
|     { | ||||
|       appData, | ||||
|       maxRecords, | ||||
|       showPagination = true, | ||||
|       runsData, | ||||
|     }: AppRunsHistoryProps, | ||||
|     { appData, maxRecords, showPagination = true }: AppRunsHistoryProps, | ||||
|     ref | ||||
|   ) => { | ||||
|     const { t } = useTranslation(); | ||||
| @ -276,13 +271,8 @@ const AppRunsHistory = forwardRef( | ||||
|     })); | ||||
| 
 | ||||
|     useEffect(() => { | ||||
|       if (runsData) { | ||||
|         setAppRunsHistoryData(runsData); | ||||
|         setIsLoading(false); | ||||
|       } else { | ||||
|       fetchAppHistory(); | ||||
|       } | ||||
|     }, [fqn, pageSize, runsData]); | ||||
|     }, [fqn, pageSize]); | ||||
| 
 | ||||
|     return ( | ||||
|       <Row gutter={[16, 16]}> | ||||
|  | ||||
| @ -26,5 +26,4 @@ export interface AppRunsHistoryProps { | ||||
|   maxRecords?: number; | ||||
|   appData?: App; | ||||
|   showPagination?: boolean; | ||||
|   runsData?: AppRunRecordWithId[]; | ||||
| } | ||||
|  | ||||
| @ -11,7 +11,6 @@ | ||||
|  *  limitations under the License. | ||||
|  */ | ||||
| import { Button, Col, Divider, Modal, Row, Space, Typography } from 'antd'; | ||||
| import { AxiosError } from 'axios'; | ||||
| import cronstrue from 'cronstrue'; | ||||
| import React, { | ||||
|   useCallback, | ||||
| @ -25,26 +24,13 @@ import { | ||||
|   AppScheduleClass, | ||||
|   AppType, | ||||
| } from '../../../generated/entity/applications/app'; | ||||
| import { Status } from '../../../generated/entity/applications/appRunRecord'; | ||||
| import { | ||||
|   PipelineState, | ||||
|   PipelineStatus, | ||||
|   PipelineType, | ||||
| } from '../../../generated/entity/services/ingestionPipelines/ingestionPipeline'; | ||||
| import { Paging } from '../../../generated/type/paging'; | ||||
| import { getApplicationRuns } from '../../../rest/applicationAPI'; | ||||
| import { PipelineType } from '../../../generated/entity/services/ingestionPipelines/ingestionPipeline'; | ||||
| import { getIngestionPipelineByFqn } from '../../../rest/ingestionPipelineAPI'; | ||||
| import { getStatusFromPipelineState } from '../../../utils/ApplicationUtils'; | ||||
| import { getIngestionFrequency } from '../../../utils/CommonUtils'; | ||||
| import { getEpochMillisForPastDays } from '../../../utils/date-time/DateTimeUtils'; | ||||
| import { showErrorToast } from '../../../utils/ToastUtils'; | ||||
| import TestSuiteScheduler from '../../AddDataQualityTest/components/TestSuiteScheduler'; | ||||
| import Loader from '../../Loader/Loader'; | ||||
| import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component'; | ||||
| import { | ||||
|   AppRunRecordWithId, | ||||
|   AppRunsHistoryRef, | ||||
| } from '../AppRunsHistory/AppRunsHistory.interface'; | ||||
| import { AppRunsHistoryRef } from '../AppRunsHistory/AppRunsHistory.interface'; | ||||
| import { AppScheduleProps } from './AppScheduleProps.interface'; | ||||
| 
 | ||||
| const AppSchedule = ({ | ||||
| @ -58,22 +44,6 @@ const AppSchedule = ({ | ||||
|   const appRunsHistoryRef = useRef<AppRunsHistoryRef>(null); | ||||
|   const [isPipelineDeployed, setIsPipelineDeployed] = useState(false); | ||||
|   const [isLoading, setIsLoading] = useState(true); | ||||
|   const [appRunsHistoryData, setAppRunsHistoryData] = useState< | ||||
|     AppRunRecordWithId[] | ||||
|   >([]); | ||||
| 
 | ||||
|   const isExternalApp = useMemo( | ||||
|     () => appData?.appType === AppType.External, | ||||
|     [appData] | ||||
|   ); | ||||
| 
 | ||||
|   const isAppRunning = useMemo(() => { | ||||
|     if (appRunsHistoryData.length > 0) { | ||||
|       return appRunsHistoryData[0].status === Status.Running; | ||||
|     } else { | ||||
|       return false; | ||||
|     } | ||||
|   }, [appRunsHistoryData]); | ||||
| 
 | ||||
|   const fetchPipelineDetails = useCallback(async () => { | ||||
|     setIsLoading(true); | ||||
| @ -97,60 +67,6 @@ const AppSchedule = ({ | ||||
|     } | ||||
|   }, [appData]); | ||||
| 
 | ||||
|   const fetchAppHistory = useCallback( | ||||
|     async (pagingOffset?: Paging) => { | ||||
|       try { | ||||
|         setIsLoading(true); | ||||
| 
 | ||||
|         if (isExternalApp) { | ||||
|           const currentTime = Date.now(); | ||||
|           // past 30 days
 | ||||
|           const startDay = getEpochMillisForPastDays(30); | ||||
| 
 | ||||
|           const { data } = await getApplicationRuns( | ||||
|             appData.fullyQualifiedName ?? '', | ||||
|             { | ||||
|               startTs: startDay, | ||||
|               endTs: currentTime, | ||||
|             } | ||||
|           ); | ||||
| 
 | ||||
|           setAppRunsHistoryData( | ||||
|             data | ||||
|               .map((item) => ({ | ||||
|                 ...item, | ||||
|                 status: getStatusFromPipelineState( | ||||
|                   (item as PipelineStatus).pipelineState ?? PipelineState.Failed | ||||
|                 ), | ||||
|                 id: (item as PipelineStatus).runId ?? '', | ||||
|               })) | ||||
|               .slice(0, 1) | ||||
|           ); | ||||
|         } else { | ||||
|           const { data } = await getApplicationRuns( | ||||
|             appData.fullyQualifiedName ?? '', | ||||
|             { | ||||
|               offset: pagingOffset?.offset ?? 0, | ||||
|               limit: 1, | ||||
|             } | ||||
|           ); | ||||
| 
 | ||||
|           setAppRunsHistoryData( | ||||
|             data.map((item) => ({ | ||||
|               ...item, | ||||
|               id: `${item.appId}-${item.runType}-${item.timestamp}`, | ||||
|             })) | ||||
|           ); | ||||
|         } | ||||
|       } catch (err) { | ||||
|         showErrorToast(err as AxiosError); | ||||
|       } finally { | ||||
|         setIsLoading(false); | ||||
|       } | ||||
|     }, | ||||
|     [appData] | ||||
|   ); | ||||
| 
 | ||||
|   const cronString = useMemo(() => { | ||||
|     if (appData.appSchedule) { | ||||
|       const cronExp = | ||||
| @ -179,7 +95,7 @@ const AppSchedule = ({ | ||||
| 
 | ||||
|   const onAppTrigger = async () => { | ||||
|     await onDemandTrigger(); | ||||
|     await fetchAppHistory(); | ||||
|     appRunsHistoryRef.current?.refreshAppHistory(); | ||||
|   }; | ||||
| 
 | ||||
|   const appRunHistory = useMemo(() => { | ||||
| @ -192,7 +108,6 @@ const AppSchedule = ({ | ||||
|           appData={appData} | ||||
|           maxRecords={1} | ||||
|           ref={appRunsHistoryRef} | ||||
|           runsData={appRunsHistoryData} | ||||
|           showPagination={false} | ||||
|         /> | ||||
|       ); | ||||
| @ -211,11 +126,10 @@ const AppSchedule = ({ | ||||
|         {t('message.no-ingestion-pipeline-found')} | ||||
|       </Typography.Text> | ||||
|     ); | ||||
|   }, [appData, isPipelineDeployed, appRunsHistoryRef, appRunsHistoryData]); | ||||
|   }, [appData, isPipelineDeployed, appRunsHistoryRef]); | ||||
| 
 | ||||
|   useEffect(() => { | ||||
|     fetchPipelineDetails(); | ||||
|     fetchAppHistory(); | ||||
|   }, []); | ||||
| 
 | ||||
|   if (isLoading) { | ||||
| @ -260,6 +174,7 @@ const AppSchedule = ({ | ||||
|               {appData.appType === AppType.External && ( | ||||
|                 <Button | ||||
|                   data-testid="deploy-button" | ||||
|                   disabled={appData.deleted} | ||||
|                   type="primary" | ||||
|                   onClick={onDeployTrigger}> | ||||
|                   {t('label.deploy')} | ||||
| @ -268,6 +183,7 @@ const AppSchedule = ({ | ||||
| 
 | ||||
|               <Button | ||||
|                 data-testid="edit-button" | ||||
|                 disabled={appData.deleted} | ||||
|                 type="primary" | ||||
|                 onClick={() => setShowModal(true)}> | ||||
|                 {t('label.edit')} | ||||
| @ -275,7 +191,7 @@ const AppSchedule = ({ | ||||
| 
 | ||||
|               <Button | ||||
|                 data-testid="run-now-button" | ||||
|                 disabled={isAppRunning} | ||||
|                 disabled={appData.deleted} | ||||
|                 type="primary" | ||||
|                 onClick={onAppTrigger}> | ||||
|                 {t('label.run-now')} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 karanh37
						karanh37