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( | const AppRunsHistory = forwardRef( | ||||||
|   ( |   ( | ||||||
|     { |     { appData, maxRecords, showPagination = true }: AppRunsHistoryProps, | ||||||
|       appData, |  | ||||||
|       maxRecords, |  | ||||||
|       showPagination = true, |  | ||||||
|       runsData, |  | ||||||
|     }: AppRunsHistoryProps, |  | ||||||
|     ref |     ref | ||||||
|   ) => { |   ) => { | ||||||
|     const { t } = useTranslation(); |     const { t } = useTranslation(); | ||||||
| @ -276,13 +271,8 @@ const AppRunsHistory = forwardRef( | |||||||
|     })); |     })); | ||||||
| 
 | 
 | ||||||
|     useEffect(() => { |     useEffect(() => { | ||||||
|       if (runsData) { |  | ||||||
|         setAppRunsHistoryData(runsData); |  | ||||||
|         setIsLoading(false); |  | ||||||
|       } else { |  | ||||||
|       fetchAppHistory(); |       fetchAppHistory(); | ||||||
|       } |     }, [fqn, pageSize]); | ||||||
|     }, [fqn, pageSize, runsData]); |  | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
|       <Row gutter={[16, 16]}> |       <Row gutter={[16, 16]}> | ||||||
|  | |||||||
| @ -26,5 +26,4 @@ export interface AppRunsHistoryProps { | |||||||
|   maxRecords?: number; |   maxRecords?: number; | ||||||
|   appData?: App; |   appData?: App; | ||||||
|   showPagination?: boolean; |   showPagination?: boolean; | ||||||
|   runsData?: AppRunRecordWithId[]; |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,7 +11,6 @@ | |||||||
|  *  limitations under the License. |  *  limitations under the License. | ||||||
|  */ |  */ | ||||||
| import { Button, Col, Divider, Modal, Row, Space, Typography } from 'antd'; | import { Button, Col, Divider, Modal, Row, Space, Typography } from 'antd'; | ||||||
| import { AxiosError } from 'axios'; |  | ||||||
| import cronstrue from 'cronstrue'; | import cronstrue from 'cronstrue'; | ||||||
| import React, { | import React, { | ||||||
|   useCallback, |   useCallback, | ||||||
| @ -25,26 +24,13 @@ import { | |||||||
|   AppScheduleClass, |   AppScheduleClass, | ||||||
|   AppType, |   AppType, | ||||||
| } from '../../../generated/entity/applications/app'; | } from '../../../generated/entity/applications/app'; | ||||||
| import { Status } from '../../../generated/entity/applications/appRunRecord'; | import { PipelineType } from '../../../generated/entity/services/ingestionPipelines/ingestionPipeline'; | ||||||
| import { |  | ||||||
|   PipelineState, |  | ||||||
|   PipelineStatus, |  | ||||||
|   PipelineType, |  | ||||||
| } from '../../../generated/entity/services/ingestionPipelines/ingestionPipeline'; |  | ||||||
| import { Paging } from '../../../generated/type/paging'; |  | ||||||
| import { getApplicationRuns } from '../../../rest/applicationAPI'; |  | ||||||
| import { getIngestionPipelineByFqn } from '../../../rest/ingestionPipelineAPI'; | import { getIngestionPipelineByFqn } from '../../../rest/ingestionPipelineAPI'; | ||||||
| import { getStatusFromPipelineState } from '../../../utils/ApplicationUtils'; |  | ||||||
| import { getIngestionFrequency } from '../../../utils/CommonUtils'; | import { getIngestionFrequency } from '../../../utils/CommonUtils'; | ||||||
| import { getEpochMillisForPastDays } from '../../../utils/date-time/DateTimeUtils'; |  | ||||||
| import { showErrorToast } from '../../../utils/ToastUtils'; |  | ||||||
| import TestSuiteScheduler from '../../AddDataQualityTest/components/TestSuiteScheduler'; | import TestSuiteScheduler from '../../AddDataQualityTest/components/TestSuiteScheduler'; | ||||||
| import Loader from '../../Loader/Loader'; | import Loader from '../../Loader/Loader'; | ||||||
| import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component'; | import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component'; | ||||||
| import { | import { AppRunsHistoryRef } from '../AppRunsHistory/AppRunsHistory.interface'; | ||||||
|   AppRunRecordWithId, |  | ||||||
|   AppRunsHistoryRef, |  | ||||||
| } from '../AppRunsHistory/AppRunsHistory.interface'; |  | ||||||
| import { AppScheduleProps } from './AppScheduleProps.interface'; | import { AppScheduleProps } from './AppScheduleProps.interface'; | ||||||
| 
 | 
 | ||||||
| const AppSchedule = ({ | const AppSchedule = ({ | ||||||
| @ -58,22 +44,6 @@ const AppSchedule = ({ | |||||||
|   const appRunsHistoryRef = useRef<AppRunsHistoryRef>(null); |   const appRunsHistoryRef = useRef<AppRunsHistoryRef>(null); | ||||||
|   const [isPipelineDeployed, setIsPipelineDeployed] = useState(false); |   const [isPipelineDeployed, setIsPipelineDeployed] = useState(false); | ||||||
|   const [isLoading, setIsLoading] = useState(true); |   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 () => { |   const fetchPipelineDetails = useCallback(async () => { | ||||||
|     setIsLoading(true); |     setIsLoading(true); | ||||||
| @ -97,60 +67,6 @@ const AppSchedule = ({ | |||||||
|     } |     } | ||||||
|   }, [appData]); |   }, [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(() => { |   const cronString = useMemo(() => { | ||||||
|     if (appData.appSchedule) { |     if (appData.appSchedule) { | ||||||
|       const cronExp = |       const cronExp = | ||||||
| @ -179,7 +95,7 @@ const AppSchedule = ({ | |||||||
| 
 | 
 | ||||||
|   const onAppTrigger = async () => { |   const onAppTrigger = async () => { | ||||||
|     await onDemandTrigger(); |     await onDemandTrigger(); | ||||||
|     await fetchAppHistory(); |     appRunsHistoryRef.current?.refreshAppHistory(); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const appRunHistory = useMemo(() => { |   const appRunHistory = useMemo(() => { | ||||||
| @ -192,7 +108,6 @@ const AppSchedule = ({ | |||||||
|           appData={appData} |           appData={appData} | ||||||
|           maxRecords={1} |           maxRecords={1} | ||||||
|           ref={appRunsHistoryRef} |           ref={appRunsHistoryRef} | ||||||
|           runsData={appRunsHistoryData} |  | ||||||
|           showPagination={false} |           showPagination={false} | ||||||
|         /> |         /> | ||||||
|       ); |       ); | ||||||
| @ -211,11 +126,10 @@ const AppSchedule = ({ | |||||||
|         {t('message.no-ingestion-pipeline-found')} |         {t('message.no-ingestion-pipeline-found')} | ||||||
|       </Typography.Text> |       </Typography.Text> | ||||||
|     ); |     ); | ||||||
|   }, [appData, isPipelineDeployed, appRunsHistoryRef, appRunsHistoryData]); |   }, [appData, isPipelineDeployed, appRunsHistoryRef]); | ||||||
| 
 | 
 | ||||||
|   useEffect(() => { |   useEffect(() => { | ||||||
|     fetchPipelineDetails(); |     fetchPipelineDetails(); | ||||||
|     fetchAppHistory(); |  | ||||||
|   }, []); |   }, []); | ||||||
| 
 | 
 | ||||||
|   if (isLoading) { |   if (isLoading) { | ||||||
| @ -260,6 +174,7 @@ const AppSchedule = ({ | |||||||
|               {appData.appType === AppType.External && ( |               {appData.appType === AppType.External && ( | ||||||
|                 <Button |                 <Button | ||||||
|                   data-testid="deploy-button" |                   data-testid="deploy-button" | ||||||
|  |                   disabled={appData.deleted} | ||||||
|                   type="primary" |                   type="primary" | ||||||
|                   onClick={onDeployTrigger}> |                   onClick={onDeployTrigger}> | ||||||
|                   {t('label.deploy')} |                   {t('label.deploy')} | ||||||
| @ -268,6 +183,7 @@ const AppSchedule = ({ | |||||||
| 
 | 
 | ||||||
|               <Button |               <Button | ||||||
|                 data-testid="edit-button" |                 data-testid="edit-button" | ||||||
|  |                 disabled={appData.deleted} | ||||||
|                 type="primary" |                 type="primary" | ||||||
|                 onClick={() => setShowModal(true)}> |                 onClick={() => setShowModal(true)}> | ||||||
|                 {t('label.edit')} |                 {t('label.edit')} | ||||||
| @ -275,7 +191,7 @@ const AppSchedule = ({ | |||||||
| 
 | 
 | ||||||
|               <Button |               <Button | ||||||
|                 data-testid="run-now-button" |                 data-testid="run-now-button" | ||||||
|                 disabled={isAppRunning} |                 disabled={appData.deleted} | ||||||
|                 type="primary" |                 type="primary" | ||||||
|                 onClick={onAppTrigger}> |                 onClick={onAppTrigger}> | ||||||
|                 {t('label.run-now')} |                 {t('label.run-now')} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 karanh37
						karanh37