Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The expected start and completion time were cleared when the componen… #957

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { useSelector } from 'react-redux';
import { Card, Form, TimePicker, Row, Col, Select } from 'antd';

Expand Down Expand Up @@ -26,6 +26,7 @@ function JobMonitoringTab({
setSelectedDomain,
}) {
const [clusterOffset, setClusterOffset] = useState(null);
const isFirstRender = useRef(true);

// Generating cluster offset string to display in time picker
useEffect(() => {
Expand All @@ -38,9 +39,13 @@ function JobMonitoringTab({
}
}, [selectedCluster]);

// When intermediate scheduling is changed clear Expected start and end time
// When intermittent scheduling is changed, clear Expected start and end time
useEffect(() => {
form.setFieldsValue({ expectedStartTime: null, expectedCompletionTime: null });
if (isFirstRender.current) {
isFirstRender.current = false; // Set to false after the first render
} else {
form.setFieldsValue({ expectedStartTime: null, expectedCompletionTime: null });
}
}, [intermittentScheduling]);

// Function to disable specific hours
Expand Down
Loading