Skip to content

Commit

Permalink
fix ingestion schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-madlani committed Jun 8, 2024
1 parent 44e0e3c commit 4d16531
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
DEPLOYED_PROGRESS_VAL,
INGESTION_PROGRESS_END_VAL,
} from '../../../constants/constants';
import { useLimitStore } from '../../../context/LimitsProvider/useLimitsStore';
import { FormSubmitType } from '../../../enums/form.enum';
import { IngestionActionMessage } from '../../../enums/ingestion.enum';
import {
Expand All @@ -45,9 +46,11 @@ import {
replaceAllSpacialCharWith_,
Transi18next,
} from '../../../utils/CommonUtils';
import { getScheduleOptionsFromSchedules } from '../../../utils/ScheduleUtils';
import { getIngestionName } from '../../../utils/ServiceUtils';
import { generateUUID } from '../../../utils/StringsUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import { getWeekCron } from '../../common/CronEditor/CronEditor.constant';
import SuccessScreen from '../../common/SuccessScreen/SuccessScreen';
import DeployIngestionLoaderModal from '../../Modals/DeployIngestionLoaderModal/DeployIngestionLoaderModal';
import {
Expand Down Expand Up @@ -78,6 +81,21 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({
const [isIngestionCreated, setIsIngestionCreated] = useState(false);
const [ingestionProgress, setIngestionProgress] = useState(0);
const [isLoading, setIsLoading] = useState(false);
const { config } = useLimitStore();

const { pipelineSchedules } =
config?.limits.config.featureLimits.find(
(feature) => feature.name === 'dataQuality'
) ?? {};

const schedulerOptions = useMemo(() => {
if (isEmpty(pipelineSchedules) || !pipelineSchedules) {
return undefined;
}

return getScheduleOptionsFromSchedules(pipelineSchedules);
}, [pipelineSchedules]);

const getSuccessMessage = useMemo(() => {
return (
<Transi18next
Expand All @@ -100,8 +118,9 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({
const initialFormData = useMemo(() => {
return {
repeatFrequency:
ingestionPipeline?.airflowConfig.scheduleInterval ||
getIngestionFrequency(PipelineType.TestSuite),
ingestionPipeline?.airflowConfig.scheduleInterval ?? config?.enable
? getWeekCron({ hour: 0, min: 0, dow: 0 })
: getIngestionFrequency(PipelineType.TestSuite),
enableDebugLog: ingestionPipeline?.loggerLevel === LogLevels.Debug,
};
}, [ingestionPipeline]);
Expand Down Expand Up @@ -256,6 +275,7 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({
) : (
<TestSuiteScheduler
allowEnableDebugLog
includePeriodOptions={schedulerOptions}
initialData={initialFormData}
isLoading={isLoading}
onCancel={onCancel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getLimitByResource } from '../../rest/limitsAPI';

const WARN_SUB_HEADER = "Check the usage of your plan's resource limits.";
const ERROR_SUB_HEADER =
'You have used {{currentCount}} out of 5 of the Bots resource.';
'You have used {{currentCount}} out of {{limit}} of the Bots resource.';

export interface ResourceLimit {
featureLimitStatuses: Array<{
Expand Down Expand Up @@ -145,10 +145,9 @@ export const useLimitStore = create<{
} of your ${plan} Plan usage limit.`,
type: hardLimitExceed ? 'danger' : 'warning',
subheader: hardLimitExceed
? ERROR_SUB_HEADER.replace(
'{{currentCount}}',
currentCount + ''
).replace('{{resource}}', startCase(resource))
? ERROR_SUB_HEADER.replace('{{currentCount}}', currentCount + '')
.replace('{{resource}}', startCase(resource))
.replace('{{limit}}', limits.hardLimit + '')
: WARN_SUB_HEADER,
softLimitExceed,
hardLimitExceed,
Expand Down

0 comments on commit 4d16531

Please sign in to comment.