fix(ui): move schedule option logic to class base (#17503)

* fix(ui): move schedule option logic to class base

* skip datainsight run test covered in playwright
This commit is contained in:
Chirag Madlani 2024-08-20 22:13:11 +05:30 committed by GitHub
parent a868596db7
commit bee4bda501
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 39 additions and 21 deletions

View File

@ -122,7 +122,8 @@ describe(
});
if (Cypress.env('isOss')) {
it('Run application', () => {
// We are running it for DataInsight page tests
it.skip('Run application', () => {
interceptURL(
'GET',
'/api/v1/apps/name/DataInsightsApplication?fields=*',

View File

@ -76,6 +76,7 @@ const AppContainer = () => {
<Layout
className={classNames('app-container', {
['extra-banner']: Boolean(bannerDetails),
['reserve-right-sidebar']: Boolean(ApplicationExtras),
})}>
<Sider
className={classNames('left-sidebar-col', {

View File

@ -12,6 +12,8 @@
*/
import { FC } from 'react';
import { AppType } from '../../../../generated/entity/applications/app';
import { getScheduleOptionsFromSchedules } from '../../../../utils/ScheduleUtils';
class ApplicationsClassBase {
public importSchema(fqn: string) {
@ -35,6 +37,22 @@ class ApplicationsClassBase {
public importAppScreenshot(screenshotName: string) {
return import(`../../../../assets/img/appScreenshots/${screenshotName}`);
}
public getScheduleOptionsForApp(
app: string,
appType: AppType,
pipelineSchedules?: string[]
) {
if (app === 'DataInsightsReportApplication') {
return ['week'];
} else if (appType === AppType.External) {
return ['day'];
}
return pipelineSchedules
? getScheduleOptionsFromSchedules(pipelineSchedules)
: undefined;
}
}
const applicationsClassBase = new ApplicationsClassBase();

View File

@ -28,11 +28,11 @@ import {
ScheduleType,
} from '../../../../generated/entity/applications/app';
import { getIngestionPipelineByFqn } from '../../../../rest/ingestionPipelineAPI';
import { getScheduleOptionsFromSchedules } from '../../../../utils/ScheduleUtils';
import { getWeekCron } from '../../../common/CronEditor/CronEditor.constant';
import Loader from '../../../common/Loader/Loader';
import { TestSuiteIngestionDataType } from '../../../DataQuality/AddDataQualityTest/AddDataQualityTest.interface';
import TestSuiteScheduler from '../../../DataQuality/AddDataQualityTest/components/TestSuiteScheduler';
import applicationsClassBase from '../AppDetails/ApplicationsClassBase';
import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component';
import { AppRunsHistoryRef } from '../AppRunsHistory/AppRunsHistory.interface';
import { AppScheduleProps } from './AppScheduleProps.interface';
@ -146,15 +146,11 @@ const AppSchedule = ({
}, [appData, isPipelineDeployed, appRunsHistoryRef]);
const initialOptions = useMemo(() => {
if (appData.name === 'DataInsightsReportApplication') {
return ['week'];
} else if (appData.appType === AppType.External) {
return ['day'];
}
return pipelineSchedules
? getScheduleOptionsFromSchedules(pipelineSchedules)
: undefined;
return applicationsClassBase.getScheduleOptionsForApp(
appData.name,
appData.appType,
pipelineSchedules
);
}, [appData.name, appData.appType, pipelineSchedules]);
useEffect(() => {

View File

@ -26,7 +26,10 @@ import Loader from '../../components/common/Loader/Loader';
import { TestSuiteIngestionDataType } from '../../components/DataQuality/AddDataQualityTest/AddDataQualityTest.interface';
import TestSuiteScheduler from '../../components/DataQuality/AddDataQualityTest/components/TestSuiteScheduler';
import PageLayoutV1 from '../../components/PageLayoutV1/PageLayoutV1';
import applicationSchemaClassBase from '../../components/Settings/Applications/AppDetails/ApplicationsClassBase';
import {
default as applicationSchemaClassBase,
default as applicationsClassBase,
} from '../../components/Settings/Applications/AppDetails/ApplicationsClassBase';
import AppInstallVerifyCard from '../../components/Settings/Applications/AppInstallVerifyCard/AppInstallVerifyCard.component';
import IngestionStepper from '../../components/Settings/Services/Ingestion/IngestionStepper/IngestionStepper.component';
import { STEPS_FOR_APP_INSTALL } from '../../constants/Applications.constant';
@ -50,7 +53,6 @@ import {
getMarketPlaceAppDetailsPath,
getSettingPath,
} from '../../utils/RouterUtils';
import { getScheduleOptionsFromSchedules } from '../../utils/ScheduleUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import './app-install.less';
@ -81,16 +83,16 @@ const AppInstall = () => {
);
const { initialOptions, initialValue } = useMemo(() => {
let initialOptions;
if (appData?.name === 'DataInsightsReportApplication') {
initialOptions = ['week'];
} else if (appData?.appType === AppType.External) {
initialOptions = ['day'];
} else if (pipelineSchedules && !isEmpty(pipelineSchedules)) {
initialOptions = getScheduleOptionsFromSchedules(pipelineSchedules);
if (!appData) {
return {};
}
const initialOptions = applicationsClassBase.getScheduleOptionsForApp(
appData?.name,
appData?.appType,
pipelineSchedules
);
return {
initialOptions,
initialValue: {