diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts index 320b5f806fa6..fcacddef0498 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts @@ -85,8 +85,7 @@ export const softDeleteUser = (username: string, displayName: string) => { verifyResponseStatusCode('@searchUser', 200); // Click on delete button - cy.get(`[data-testid="delete-user-btn-${username}"]`); - cy.get(':nth-child(4) > .ant-space > .ant-space-item > .ant-btn').click(); + cy.get(`[data-testid="delete-user-btn-${username}"]`).click(); // Soft deleting the user cy.get('[data-testid="soft-delete"]').click(); cy.get('[data-testid="confirmation-text-input"]').type('DELETE'); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTest.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTest.interface.ts index ea256c841d31..b041267bb8ce 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTest.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTest.interface.ts @@ -45,7 +45,6 @@ export interface TestSuiteSchedulerProps { initialData?: string; onSubmit: (repeatFrequency: string) => void; onCancel: () => void; - isQuartzCron?: boolean; buttonProps?: { okText: string; cancelText: string; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/TestSuiteScheduler.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/TestSuiteScheduler.tsx index 15b791d0a109..47a40a071b3d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/TestSuiteScheduler.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/TestSuiteScheduler.tsx @@ -11,7 +11,7 @@ * limitations under the License. */ -import { Button, Col, Row, Space } from 'antd'; +import { Button, Col, Form, Row, Space } from 'antd'; import { t } from 'i18next'; import React, { useEffect, useState } from 'react'; import CronEditor from '../../common/CronEditor/CronEditor'; @@ -22,7 +22,6 @@ const TestSuiteScheduler: React.FC = ({ buttonProps, onCancel, onSubmit, - isQuartzCron = false, includePeriodOptions, }) => { const [repeatFrequency, setRepeatFrequency] = useState( @@ -38,12 +37,13 @@ const TestSuiteScheduler: React.FC = ({ return ( - setRepeatFrequency(value)} - /> +
+ setRepeatFrequency(value)} + /> + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppDetails/AppDetails.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppDetails/AppDetails.component.tsx index e73d72732c8f..5415ede6af6f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppDetails/AppDetails.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppDetails/AppDetails.component.tsx @@ -348,7 +348,6 @@ const AppDetails = () => { {appData && ( jest.mock('../AppSchedule/AppSchedule.component', () => jest .fn() - .mockImplementation( - ({ onCancel, onSave, onDemandTrigger, onDeployTrigger }) => ( - <> - AppSchedule - - - - - - ) - ) + .mockImplementation(({ onSave, onDemandTrigger, onDeployTrigger }) => ( + <> + AppSchedule + + + + + )) ); jest.mock('./ApplicationSchemaClassBase', () => ({ @@ -233,9 +230,5 @@ describe('AppDetails component', () => { expect(mockDeployApp).toHaveBeenCalled(); expect(mockGetApplicationByName).toHaveBeenCalled(); - - userEvent.click(screen.getByRole('button', { name: 'Cancel AppSchedule' })); - - expect(mockPush).toHaveBeenCalled(); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.component.tsx index f0dede491d6d..e6bac1b1565e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.component.tsx @@ -24,9 +24,7 @@ import { AppScheduleClass, AppType, } from '../../../generated/entity/applications/app'; -import { PipelineType } from '../../../generated/entity/services/ingestionPipelines/ingestionPipeline'; import { getIngestionPipelineByFqn } from '../../../rest/ingestionPipelineAPI'; -import { getIngestionFrequency } from '../../../utils/CommonUtils'; import TestSuiteScheduler from '../../AddDataQualityTest/components/TestSuiteScheduler'; import Loader from '../../Loader/Loader'; import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component'; @@ -74,10 +72,6 @@ const AppSchedule = ({ return cronstrue.toString(cronExp, { throwExceptionOnParseError: false, - // Quartz cron format accepts 1-7 or SUN-SAT so need to increment index by 1 - // Ref: https://www.quartz-scheduler.org/api/2.1.7/org/quartz/CronExpression.html - dayOfWeekStartIndexZero: false, - monthStartIndexZero: false, }); } @@ -225,13 +219,14 @@ const AppSchedule = ({ open={showModal} title={t('label.update-entity', { entity: t('label.schedule') })}> diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.test.tsx index d966ca98fe66..4cff690ad373 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppSchedule.test.tsx @@ -35,10 +35,6 @@ jest.mock('../../../rest/ingestionPipelineAPI', () => ({ .mockImplementation((...args) => mockGetIngestionPipelineByFqn(...args)), })); -jest.mock('../../../utils/CommonUtils', () => ({ - getIngestionFrequency: jest.fn(), -})); - jest.mock('../../AddDataQualityTest/components/TestSuiteScheduler', () => jest.fn().mockImplementation(({ onSubmit, onCancel }) => (
@@ -73,7 +69,6 @@ const mockProps1 = { name: 'DataInsightsReportApplication', }, onSave: mockOnSave, - onCancel: jest.fn(), onDemandTrigger: mockOnDemandTrigger, onDeployTrigger: mockOnDeployTrigger, }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppScheduleProps.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppScheduleProps.interface.ts index 90d52317ea51..fa1901f4a844 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppScheduleProps.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/Applications/AppSchedule/AppScheduleProps.interface.ts @@ -14,7 +14,6 @@ import { App } from '../../../generated/entity/applications/app'; export interface AppScheduleProps { appData: App; - onCancel: () => void; onSave: (cron: string) => void; onDemandTrigger: () => void; onDeployTrigger: () => void; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamHierarchy.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamHierarchy.tsx index b32c2bc69b35..8c1d04f4b7bc 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamHierarchy.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamHierarchy.tsx @@ -125,10 +125,10 @@ const TeamHierarchy: FC = ({ render: (description: string) => ( {isEmpty(description) ? '--' : description} diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/AppInstall/AppInstall.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/AppInstall/AppInstall.component.tsx index 2f1a62f5ff0e..2ad2f5134fb5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/AppInstall/AppInstall.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/AppInstall/AppInstall.component.tsx @@ -38,14 +38,11 @@ import { ScheduleTimeline, } from '../../generated/entity/applications/createAppRequest'; import { AppMarketPlaceDefinition } from '../../generated/entity/applications/marketplace/appMarketPlaceDefinition'; -import { PipelineType } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline'; import { useFqn } from '../../hooks/useFqn'; import { installApplication } from '../../rest/applicationAPI'; import { getMarketPlaceApplicationByFqn } from '../../rest/applicationMarketPlaceAPI'; -import { - getEntityMissingError, - getIngestionFrequency, -} from '../../utils/CommonUtils'; +import { getEntityMissingError } from '../../utils/CommonUtils'; +import { getCronInitialValue } from '../../utils/CronUtils'; import { formatFormDataForSubmit } from '../../utils/JSONSchemaFormUtils'; import { getMarketPlaceAppDetailsPath, @@ -72,6 +69,24 @@ const AppInstall = () => { [appData] ); + const { initialOptions, initialValue } = useMemo(() => { + let initialOptions; + + if (appData?.name === 'DataInsightsReportApplication') { + initialOptions = ['Week']; + } else if (appData?.appType === AppType.External) { + initialOptions = ['Day']; + } + + return { + initialOptions, + initialValue: getCronInitialValue( + appData?.appType ?? AppType.Internal, + appData?.name ?? '' + ), + }; + }, [appData?.name, appData?.appType]); + const fetchAppDetails = useCallback(async () => { setIsLoading(true); try { @@ -126,16 +141,6 @@ const AppInstall = () => { setActiveServiceStep(3); }; - const initialOptions = useMemo(() => { - if (appData?.name === 'DataInsightsReportApplication') { - return ['Week']; - } else if (appData?.appType === AppType.External) { - return ['Day']; - } - - return undefined; - }, [appData?.name, appData?.appType]); - const RenderSelectedTab = useCallback(() => { if (!appData || !jsonSchema) { return <>; @@ -180,9 +185,8 @@ const AppInstall = () => {
{t('label.schedule')} setActiveServiceStep(appData.allowConfiguration ? 2 : 1) } diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.test.ts b/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.test.ts index 46eb522da20e..dce5f0c71d03 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.test.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.test.ts @@ -11,7 +11,8 @@ * limitations under the License. */ -import { getQuartzCronExpression } from './CronUtils'; +import { AppType } from '../generated/entity/applications/app'; +import { getCronInitialValue, getQuartzCronExpression } from './CronUtils'; describe('getQuartzCronExpression function', () => { it('should generate cron expression for every minute', () => { @@ -94,3 +95,32 @@ describe('getQuartzCronExpression function', () => { expect(result).toEqual('0 30 10 ? * 4'); }); }); + +describe('getCronInitialValue function', () => { + it('should generate hour cron expression if appType is internal and appName is not DataInsightsReportApplication', () => { + const result = getCronInitialValue( + AppType.Internal, + 'SearchIndexingApplication' + ); + + expect(result).toEqual('0 * * * *'); + }); + + it('should generate week cron expression if appName is DataInsightsReportApplication', () => { + const result = getCronInitialValue( + AppType.Internal, + 'DataInsightsReportApplication' + ); + + expect(result).toEqual('0 0 * * 0'); + }); + + it('should generate day cron expression if appType is external', () => { + const result = getCronInitialValue( + AppType.External, + 'DataInsightsApplication' + ); + + expect(result).toEqual('0 0 * * *'); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.ts b/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.ts index 5c2179ab9525..2d852e80640a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CronUtils.ts @@ -31,6 +31,7 @@ import { StateValue, ToDisplay, } from '../components/common/CronEditor/CronEditor.interface'; +import { AppType } from '../generated/entity/applications/app'; export const getQuartzCronExpression = (state: StateValue) => { const { @@ -172,3 +173,20 @@ export const getStateValue = (valueStr: string) => { return stateVal; }; + +export const getCronInitialValue = (appType: AppType, appName: string) => { + const value = { + min: 0, + hour: 0, + }; + + let initialValue = getHourCron(value); + + if (appName === 'DataInsightsReportApplication') { + initialValue = getWeekCron({ ...value, dow: 0 }); + } else if (appType === AppType.External) { + initialValue = getDayCron(value); + } + + return initialValue; +};