function isBatchListSettingsComplete()

in Website/Packages/datax-pipeline/src/modules/flowDefinition/flowSelectors.js [565:601]


function isBatchListSettingsComplete(batch) {
    let validations = [];
    validations.push(batch && batch.properties);
    validations.push(Helpers.isNumberAndStringOnly(batch.id));

    switch (batch.type) {
        case Models.batchTypeEnum.recurring:
            validations.push(batch.properties.interval && batch.properties.interval.trim() !== '');
            validations.push(batch.properties.intervalType && batch.properties.intervalType.trim() !== '');
            validations.push(batch.properties.delay && batch.properties.delay.trim() !== '');
            validations.push(batch.properties.delayType && batch.properties.delayType.trim() !== '');
            validations.push(batch.properties.window && batch.properties.window.trim() !== '');
            validations.push(batch.properties.windowType && batch.properties.windowType.trim() !== '');
            validations.push(batch.properties.startTime && batch.properties.startTime !== '');
            validations.push(CommonHelpers.isValidNumberAboveZero(batch.properties.interval));
            validations.push(Helpers.isValidNumberAboveOrEqualZero(batch.properties.delay));
            validations.push(CommonHelpers.isValidNumberAboveZero(batch.properties.window));
            break;
        case Models.batchTypeEnum.oneTime:
            validations.push(batch.properties.interval && batch.properties.interval.trim() !== '');
            validations.push(batch.properties.intervalType && batch.properties.intervalType.trim() !== '');
            validations.push(batch.properties.delay && batch.properties.delay == 0);
            validations.push(batch.properties.delayType && batch.properties.delayType.trim() !== '');
            validations.push(batch.properties.window && batch.properties.window.trim() !== '');
            validations.push(batch.properties.windowType && batch.properties.windowType.trim() !== '');
            validations.push(batch.properties.startTime && batch.properties.startTime !== '');
            validations.push(batch.properties.endTime && batch.properties.endTime !== '');
            validations.push(CommonHelpers.isValidNumberAboveZero(batch.properties.interval));
            validations.push(CommonHelpers.isValidNumberAboveZero(batch.properties.window));
            break;

        default:
            validations.push(false);
            break;
    }
    return validations.every(value => value);
}