Skip to content

Commit

Permalink
Fix [Jobs and Workflows, Jobs Monitoring] The 'Auto Refresh' issues (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mariana-furyk authored Jan 17, 2025
1 parent 959d8a4 commit 6cfb8f2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/ActionBar/ActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const ActionBar = ({
}, [filterMenu, filtersConfig])

useEffect(() => {
if ((autoRefresh || internalAutoRefresh) && !hidden) {
if (((autoRefresh && !withInternalAutoRefresh) || internalAutoRefresh) && !hidden) {
const intervalId = setInterval(() => {
if (!autoRefreshIsStopped) {
refresh(formRef.current.getState())
Expand Down
8 changes: 3 additions & 5 deletions src/components/Jobs/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ const Jobs = () => {
}
]}
autoRefreshIsStopped={
jobWizardIsOpened ||
jobsStore.loading ||
Boolean(jobsStore.jobLoadingCounter)
jobWizardIsOpened || jobsStore.loading || Boolean(jobsStore.jobLoadingCounter)
}
autoRefreshStopTrigger={!isEmpty(selectedJob)}
filters={filters}
Expand All @@ -249,8 +247,8 @@ const Jobs = () => {
page={JOBS_MONITORING_PAGE}
setSearchParams={setSearchParams}
tab={selectedTab}
withAutoRefresh
withInternalAutoRefresh={params.jobName}
withAutoRefresh={selectedTab === MONITOR_JOBS_TAB}
withInternalAutoRefresh={selectedTab === MONITOR_JOBS_TAB && params.jobName}
withRefreshButton
withoutExpandButton
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const JobsMonitoring = () => {
abortControllerRef,
abortJobRef,
abortingJobs,
autoRefreshPrevValue,
fetchJobFunctionsPromiseRef,
initialTabData,
jobRuns,
Expand Down Expand Up @@ -97,6 +98,7 @@ const JobsMonitoring = () => {
{params.jobName && <TableTop link={getBackLink(true)} text={params.jobName} />}
<JobsTable
abortingJobs={abortingJobs}
autoRefreshPrevValue={autoRefreshPrevValue}
context={ProjectJobsMonitoringContext}
filters={filters}
filtersConfig={jobsFiltersConfig}
Expand Down
13 changes: 7 additions & 6 deletions src/components/ProjectsJobsMonitoring/ProjectsJobsMonitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const ProjectsJobsMonitoring = () => {
const [selectedCard, setSelectedCard] = useState(
jobsMonitoringData.filters?.status || STATS_TOTAL_CARD
)
const [autoRefreshPrevValue, setAutoRefreshPrevValue] = useState(false)
const location = useLocation()
const params = useParams()
const navigate = useNavigate()
Expand Down Expand Up @@ -184,23 +185,22 @@ const ProjectsJobsMonitoring = () => {
onClick={handleTabChange}
tabs={tabs}
/>

<ActionBar
autoRefreshIsEnabled={selectedTab === JOBS_MONITORING_JOBS_TAB}
autoRefreshIsStopped={
jobWizardIsOpened ||
jobsStore.loading ||
Boolean(jobsStore.jobLoadingCounter) ||
!isEmpty(selectedJob)
jobWizardIsOpened || jobsStore.loading || Boolean(jobsStore.jobLoadingCounter)
}
autoRefreshStopTrigger={!isEmpty(selectedJob)}
filters={filters}
filtersConfig={initialTabData[selectedTab].filtersConfig}
handleRefresh={tabData[selectedTab].handleRefresh}
handleAutoRefreshPrevValueChange={setAutoRefreshPrevValue}
hidden={Boolean(params.workflowId)}
key={selectedTab}
page={JOBS_MONITORING_PAGE}
setSearchParams={setSearchParams}
tab={selectedTab}
withAutoRefresh={selectedTab === JOBS_MONITORING_JOBS_TAB}
withInternalAutoRefresh={selectedTab === JOBS_MONITORING_JOBS_TAB && params.jobName}
withRefreshButton
withoutExpandButton
>
Expand All @@ -213,6 +213,7 @@ const ProjectsJobsMonitoring = () => {
abortControllerRef,
abortJobRef,
abortingJobs,
autoRefreshPrevValue,
editableItem,
fetchJobFunctionsPromiseRef,
getWorkflows,
Expand Down
3 changes: 2 additions & 1 deletion src/elements/JobsTable/JobsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ const JobsTable = React.forwardRef(
disabledNextDoubleBtnTooltip={
filtersStore.autoRefresh
? 'Uncheck Auto Refresh to view more results'
: autoRefreshPrevValue
: autoRefreshPrevValue &&
paginationConfigJobsRef.current?.paginationResponse?.['page-token']
? 'Close detailed view and uncheck Auto Refresh to view more results'
: ''
}
Expand Down

0 comments on commit 6cfb8f2

Please sign in to comment.