Skip to content

Commit

Permalink
Merge pull request #957 from hpcc-systems/yadhap/clear-expectedstart-…
Browse files Browse the repository at this point in the history
…and-expected-complete-on-run-window-change

The expected start and completion time were cleared when the componen…
  • Loading branch information
FancMa01 authored Nov 26, 2024
2 parents ea0c3f0 + 8f1b822 commit ee1a57c
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit ee1a57c

Please sign in to comment.