fixed issue 6071: Service ingestion workflows should be configurable as scheduled or on-demand (#6216)

* fixed issue 6071: Service ingestion workflows should be configurable as scheduled or on-demand

* fixing cypress
This commit is contained in:
Shailesh Parmar 2022-07-20 18:40:20 +05:30 committed by GitHub
parent 0505eb1a6a
commit 0d1e57baf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 21 deletions

View File

@ -87,7 +87,7 @@ export const testServiceCreationAndIngestion = (
// Test the connection
cy.get('[data-testid="test-connection-btn"]').should('exist');
cy.get('[data-testid="test-connection-btn"]').click();
cy.wait(500);
cy.wait(500);
cy.contains('Connection test was successful').should('exist');
cy.get('[data-testid="submit-btn"]').should('exist').click();
@ -127,6 +127,7 @@ export const testServiceCreationAndIngestion = (
// Schedule & Deploy
cy.contains('Schedule for Ingestion').should('be.visible');
cy.get('[data-testid="ingestion-type"]').should('be.visible').select('hour');
cy.get('[data-testid="deploy-button"]').should('be.visible').click();
// check success
@ -216,7 +217,7 @@ export const visitEntityTab = (id) => {
export const searchEntity = (term) => {
cy.get('[data-testid="searchBox"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="searchBox"]').type(`${term}{enter}`);
cy.get('[data-testid="suggestion-overlay"]').click(1,1);
cy.get('[data-testid="suggestion-overlay"]').click(1, 1);
};
// add new tag to entity and its table

View File

@ -11,11 +11,10 @@
* limitations under the License.
*/
import { isUndefined } from 'lodash';
import { isEmpty, isUndefined } from 'lodash';
import { LoadingState } from 'Models';
import React, { useMemo, useState } from 'react';
import {
INGESTION_SCHEDULER_INITIAL_VALUE,
INITIAL_FILTER_PATTERN,
STEPS_FOR_ADD_INGESTION,
} from '../../constants/ingestion.constant';
@ -97,7 +96,7 @@ const AddIngestion = ({
);
const [description, setDescription] = useState(data?.description ?? '');
const [repeatFrequency, setRepeatFrequency] = useState(
data?.airflowConfig.scheduleInterval ?? INGESTION_SCHEDULER_INITIAL_VALUE
data?.airflowConfig.scheduleInterval ?? ''
);
const [showDashboardFilter, setShowDashboardFilter] = useState(
!isUndefined(
@ -482,7 +481,9 @@ const AddIngestion = ({
const createNewIngestion = () => {
const ingestionDetails: CreateIngestionPipeline = {
airflowConfig: {
scheduleInterval: repeatFrequency,
scheduleInterval: isEmpty(repeatFrequency)
? undefined
: repeatFrequency,
},
loggerLevel: enableDebugLog ? LogLevels.Debug : LogLevels.Info,
name: ingestionName,

View File

@ -14,6 +14,11 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export const getPeriodOptions = () => {
return [
{
label: 'none',
value: '',
prep: '',
},
{
label: 'minutes',
value: 'minute',

View File

@ -13,6 +13,7 @@
/* eslint-disable */
import { isEmpty } from 'lodash';
import React, { useState } from 'react';
import { pluralize } from '../../../utils/CommonUtils';
import {
@ -58,7 +59,7 @@ const getCron = (state) => {
case 'year':
return getYearCron(selectedYearOption);
default:
return '* * * * *';
return '';
}
};
@ -74,7 +75,7 @@ const CronEditor = (props) => {
};
const getStateValue = (valueStr) => {
let stateVal = {
selectedPeriod: 'week',
selectedPeriod: '',
selectedMinOption: {
min: 5,
},
@ -115,27 +116,29 @@ const CronEditor = (props) => {
stateVal.selectedPeriod = t || stateVal.selectedPeriod;
const selectedPeriodObj =
stateVal[
'selected' + (t.charAt(0).toUpperCase() + t.substr(1)) + 'Option'
];
if (!isEmpty(t)) {
const selectedPeriodObj =
stateVal[
'selected' + (t.charAt(0).toUpperCase() + t.substr(1)) + 'Option'
];
let targets = toDisplay[t];
let targets = toDisplay[t];
for (let i = 0; i < targets.length; i++) {
let tgt = targets[i];
for (let i = 0; i < targets.length; i++) {
let tgt = targets[i];
if (tgt == 'time') {
selectedPeriodObj.hour = v.hour;
selectedPeriodObj.min = v.min;
} else {
selectedPeriodObj[tgt] = v[tgt];
if (tgt == 'time') {
selectedPeriodObj.hour = v.hour;
selectedPeriodObj.min = v.min;
} else {
selectedPeriodObj[tgt] = v[tgt];
}
}
}
return stateVal;
};
const [value, setCronValue] = useState(props.value || '0 0 * * 0');
const [value, setCronValue] = useState(props.value || '');
const [state, setState] = useState(getStateValue(value));
const [periodOptions] = useState(getPeriodOptions());
const [minuteSegmentOptions] = useState(getMinuteSegmentOptions());
@ -586,6 +589,11 @@ const CronEditor = (props) => {
{getWeekComponent(cronPeriodString)}
{getMonthComponent(cronPeriodString)}
{getYearComponent(cronPeriodString)}
{isEmpty(value) && (
<p className="tw-col-span-2">
Pipeline will only be triggered manually.
</p>
)}
</div>
</div>
</div>