diff --git a/src/components/Details/DetailsTabsContent/DetailsTabsContent.js b/src/components/Details/DetailsTabsContent/DetailsTabsContent.js index cabeb829f..b97687f1d 100644 --- a/src/components/Details/DetailsTabsContent/DetailsTabsContent.js +++ b/src/components/Details/DetailsTabsContent/DetailsTabsContent.js @@ -158,8 +158,8 @@ const DetailsTabsContent = ({ return ( ) diff --git a/src/components/DetailsArtifacts/DetailsArtifacts.js b/src/components/DetailsArtifacts/DetailsArtifacts.js index e2baa1574..60683565e 100644 --- a/src/components/DetailsArtifacts/DetailsArtifacts.js +++ b/src/components/DetailsArtifacts/DetailsArtifacts.js @@ -123,7 +123,7 @@ const DetailsArtifacts = ({ useEffect(() => { if (!isNaN(parseInt(bestIteration))) { setIteration(`${bestIteration}`) - } else if (selectedItem.iterationStats.length > 0 && iterationOptions.length > 0) { + } else if (selectedItem.iterationStats?.length > 0 && iterationOptions?.length > 0) { setIteration(iterationOptions[0].id) } @@ -175,10 +175,12 @@ const DetailsArtifacts = ({ ) useEffect(() => { - if (selectedItem.iterationStats.length > 0 && iteration) { - getJobArtifacts(selectedItem, iteration) - } else if (selectedItem.iterationStats.length === 0) { - getJobArtifacts(selectedItem, null) + if (params.jobId === selectedItem.uid) { + if (selectedItem.iterationStats?.length > 0 && iteration) { + getJobArtifacts(selectedItem, iteration) + } else if (selectedItem.iterationStats?.length === 0) { + getJobArtifacts(selectedItem, null) + } } }, [getJobArtifacts, iteration, params.jobId, params.projectName, selectedItem]) diff --git a/src/components/Jobs/jobs.util.js b/src/components/Jobs/jobs.util.js index 4c28002d7..4d63a63ca 100644 --- a/src/components/Jobs/jobs.util.js +++ b/src/components/Jobs/jobs.util.js @@ -17,7 +17,7 @@ illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction. */ -import { get } from 'lodash' +import { get, isObject } from 'lodash' import tasksApi from '../../api/tasks-api' @@ -38,7 +38,7 @@ import { FAILED_STATE } from '../../constants' import jobsActions from '../../actions/jobs' -import { generateKeyValues, truncateUid } from '../../utils' +import { generateKeyValues, parseKeyValues, truncateUid } from '../../utils' import { BG_TASK_FAILED, BG_TASK_SUCCEEDED, pollTask } from '../../utils/poll.util' import { setNotification } from '../../reducers/notificationReducer' import { showErrorNotification } from '../../utils/notifications.util' @@ -129,7 +129,7 @@ export const isJobAborting = (currentJob = {}) => { } export const isJobKindDask = (jobLabels = []) => { - return jobLabels?.includes(`kind: ${JOB_KIND_DASK}`) + return (isObject(jobLabels) ? parseKeyValues(jobLabels) : jobLabels)?.includes(`kind: ${JOB_KIND_DASK}`) } export const isJobKindLocal = job => diff --git a/src/components/Workflow/Workflow.js b/src/components/Workflow/Workflow.js index 188cbc7e3..a5cd3d0b1 100644 --- a/src/components/Workflow/Workflow.js +++ b/src/components/Workflow/Workflow.js @@ -203,13 +203,14 @@ const Workflow = ({ ? getWorkflowMonitoringDetailsLink( params.workflowProjectName, params.workflowId, - node.data.customData + node.data.customData, + params.tab ) : getWorkflowDetailsLink( params.projectName, params.workflowId, node.data.customData, - null, + params.tab, MONITOR_WORKFLOWS_TAB ) diff --git a/src/elements/WorkflowsTable/WorkflowsTable.js b/src/elements/WorkflowsTable/WorkflowsTable.js index dd181fdf0..9ef603bd4 100644 --- a/src/elements/WorkflowsTable/WorkflowsTable.js +++ b/src/elements/WorkflowsTable/WorkflowsTable.js @@ -462,7 +462,6 @@ const WorkflowsTable = React.forwardRef( checkIfWorkflowItemIsJob() && !dataIsLoading ) { setDataIsLoading(true) - fetchRun().finally(() => setDataIsLoading(false)) } }, [fetchRun, params.jobId, selectedJob, checkIfWorkflowItemIsJob, dataIsLoading]) diff --git a/src/hooks/useSortTable.hook.js b/src/hooks/useSortTable.hook.js index 3cf34b2b3..92a97bc0e 100644 --- a/src/hooks/useSortTable.hook.js +++ b/src/hooks/useSortTable.hook.js @@ -44,7 +44,7 @@ export const useSortTable = ({ headers, content, sortConfig = {} }) => { const isDateValid = date => { const dateString = String(date) - + if (Date.parse(dateString)) { return !(dateString.match(/-/g) && !dateString.split('-').every(char => isNumber(char))) } @@ -179,7 +179,10 @@ export const useSortTable = ({ headers, content, sortConfig = {} }) => { if (columnName) { const sorted = orderBy(content, getValueByType(columnIndex), sortDirection) - setSortedTableContent(sorted) + + setSortedTableContent(prevState => { + return isEqual(prevState, sorted) ? prevState : sorted + }) } setSelectedColumnName(columnName) diff --git a/src/utils/createJobsContent.js b/src/utils/createJobsContent.js index d1cd7e424..22ed54f43 100644 --- a/src/utils/createJobsContent.js +++ b/src/utils/createJobsContent.js @@ -267,8 +267,8 @@ export const createJobsWorkflowsTabContent = (jobs, projectName, isStagingMode, value: jobName, className: 'table-cell-name', type: 'link', - getLink: () => { - return getWorkflowDetailsLink(projectName, job.id, null, null, MONITOR_WORKFLOWS_TAB) + getLink: tab => { + return getWorkflowDetailsLink(projectName, job.id, null, tab, MONITOR_WORKFLOWS_TAB) }, showStatus: true }, @@ -353,7 +353,7 @@ export const createJobsWorkflowContent = ( type: 'link', getLink: tab => { return workflowProjectName - ? getWorkflowMonitoringDetailsLink(workflowProjectName, workflowId, job.customData) + ? getWorkflowMonitoringDetailsLink(workflowProjectName, workflowId, job.customData, tab) : getWorkflowDetailsLink( projectName, workflowId, @@ -649,8 +649,8 @@ export const createWorkflowsMonitoringContent = (jobs, isStagingMode, isSelected value: jobName, className: 'table-cell-name', type: 'link', - getLink: () => { - return getWorkflowMonitoringDetailsLink(job.project, job.id) + getLink: tab => { + return getWorkflowMonitoringDetailsLink(job.project, job.id, null, tab) }, showStatus: true },