From 547deac2662b12ca39dc4ad9dd51418af9346000 Mon Sep 17 00:00:00 2001 From: Arvind Date: Mon, 2 Nov 2026 20:21:48 +0530 Subject: [PATCH] feat: add Dispatch timeline section under Cluster Execution Display the Dispatch timeline of a PLR to visualize the various states under the Cluster Execution card of PLR details page --- .../en/plugin__pipelines-console-plugin.json | 6 + .../MultiClusterExecutionDetails.tsx | 386 ++++++++++++------ 2 files changed, 274 insertions(+), 118 deletions(-) diff --git a/locales/en/plugin__pipelines-console-plugin.json b/locales/en/plugin__pipelines-console-plugin.json index f4d2f12e..9671a648 100644 --- a/locales/en/plugin__pipelines-console-plugin.json +++ b/locales/en/plugin__pipelines-console-plugin.json @@ -19,6 +19,10 @@ "<0>In the <1>.tekton directory, create a new file called<3>push.yaml and add the following code:": "<0>In the <1>.tekton directory, create a new file called<3>push.yaml and add the following code:", "<0>In your repository, create the <2>.tekton directory to store you pipeline.": "<0>In your repository, create the <2>.tekton directory to store you pipeline.", "<0>Use the <2>link to install the newly created GitHub application to your repositories in your organization/account": "<0>Use the <2>link to install the newly created GitHub application to your repositories in your organization/account", + "1. Quota reservation": "1. Quota reservation", + "2. Workload admission": "2. Workload admission", + "3. Admission Checks": "3. Admission Checks", + "4. Workload completion": "4. Workload completion", "A GitHub App is already set up for this cluster. To use it, install the GitHub app on your personal account or GitHub organization.": "A GitHub App is already set up for this cluster. To use it, install the GitHub app on your personal account or GitHub organization.", "Access Denied": "Access Denied", "Access Mode": "Access Mode", @@ -151,6 +155,7 @@ "Details": "Details", "Dev preview": "Dev preview", "Disconnected": "Disconnected", + "Dispatch Timeline": "Dispatch Timeline", "Display name": "Display name", "Download": "Download", "Download all": "Download all", @@ -633,6 +638,7 @@ "Unable to detect Event listener URL": "Unable to detect Event listener URL", "Unable to find repository": "Unable to find repository", "Unable to load average duration": "Unable to load average duration", + "Unable to load dispatch timeline": "Unable to load dispatch timeline", "Unable to load duration": "Unable to load duration", "Unable to load Pipeline": "Unable to load Pipeline", "Unable to load pipeline runs": "Unable to load pipeline runs", diff --git a/src/components/pipelineRuns-details/MultiClusterExecutionDetails.tsx b/src/components/pipelineRuns-details/MultiClusterExecutionDetails.tsx index bc537c20..1df18f20 100644 --- a/src/components/pipelineRuns-details/MultiClusterExecutionDetails.tsx +++ b/src/components/pipelineRuns-details/MultiClusterExecutionDetails.tsx @@ -7,11 +7,16 @@ import { DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, - Grid, - GridItem, + FlexItem, + Label, + ProgressStep, + ProgressStepper, + ProgressStepProps, Spinner, + Flex, + Divider, } from '@patternfly/react-core'; -import { PipelineRunKind } from '../../types'; +import { Condition, PipelineRunKind } from '../../types'; import { FC } from 'react'; import { useTranslation } from 'react-i18next'; import { @@ -22,10 +27,46 @@ import { } from '../hooks/useMultiKueueResources'; import { useActiveNamespace } from '@openshift-console/dynamic-plugin-sdk'; import { calculateDuration } from '../utils/pipeline-utils'; +import { RhUiInProgressIcon } from '@patternfly/react-icons'; type MultiClusterExecutionDetailsProps = { pipelineRun: PipelineRunKind; }; + +const ConditionReasonLabel: FC<{ condition?: Condition }> = ({ condition }) => { + if (!condition?.reason && condition?.status != 'Unknown') { + return null; + } + + const isSuccess = condition?.status === 'True'; + + return ( + + ); +}; + +const GetProgressStepVariant = ( + status: string, +): ProgressStepProps['variant'] => { + switch (status) { + case 'True': + return 'success'; + case 'False': + return 'danger'; + default: + return 'pending'; + } +}; + const MultiClusterExecutionDetails: FC = ({ pipelineRun, }) => { @@ -55,132 +96,241 @@ const MultiClusterExecutionDetails: FC = ({ ? calculateDuration(createdTime, admittedTime, true) : '-'; + const workloadQuotaReservation = workload?.status?.conditions?.find( + (c) => c.type === 'QuotaReserved', + ); + + const workloadAdmission = workload?.status?.conditions?.find( + (c) => c.type === 'Admitted', + ); + + const admissionCheck = workload?.status?.admissionChecks?.find( + (c) => c.state === 'Ready', + ); + + const workloadCompletion = workload?.status?.conditions?.find( + (c) => c.type === 'Finished', + ); + return ( {t('Cluster Execution')} - - - - - - {t('Target Cluster Information')} - - {workloadsError || targetClusterLoadError ? ( - - ) : ( - <> - - {t('Cluster')} - - {workloadsLoaded && workload ? ( - workload?.status?.clusterName - ) : ( - - )} - - - - {t('Status')} - - {targetClusterLoaded && targetCluster ? ( - isClusterConnected(targetCluster) ? ( - t('Connected') - ) : ( - t('Disconnected') - ) - ) : ( - - )} - - - - )} - - - - - - - - {t('Queue Information')} - - {workloadsError || clusterQueueLoadError ? ( - - ) : ( - <> - + + + + + {t('Dispatch Timeline')} + + {workloadsError ? ( + + ) : ( + + + ) : undefined + } + id="quota-reservation" + > + - {t('Cluster Queue')} + {t('1. Quota reservation')} - - {workloadsLoaded && workload ? ( - workload?.status?.admission?.clusterQueue - ) : ( - - )} - - - + + + + + ) : undefined + } + id="workload-admission" + > + - {t('Local Queue')} + {t('2. Workload admission')} - - {workloadsLoaded && workload ? ( - workload?.spec?.queueName - ) : ( - - )} - - - + + + + + ) : undefined + } + id="admission-checks" + > + - {t('Queue Wait')} + {t('3. Admission Checks')} - - {workloadsLoaded && workload ? ( - queueWaitTime - ) : ( - - )} - - - - {t('Pending')} - - {clusterQueueLoaded ? ( - clusterQueue?.status?.pendingWorkloads - ) : ( - - )} - - - - {t('Active')} - - {clusterQueueLoaded ? ( - clusterQueue?.status?.admittedWorkloads + + + + + ) : undefined + } + id="workload-completion" + > + + + {t('4. Workload completion')} + + + + + + )} + + + + + + + {t('Target Cluster Information')} + + {workloadsError || targetClusterLoadError ? ( + + ) : ( + <> + + {t('Cluster')} + + {workloadsLoaded && workload ? ( + workload?.status?.clusterName + ) : ( + + )} + + + + {t('Status')} + + {targetClusterLoaded && targetCluster ? ( + isClusterConnected(targetCluster) ? ( + t('Connected') ) : ( - - )} - - - - )} - - - - + t('Disconnected') + ) + ) : ( + + )} + + + + )} + + + + + + + {t('Queue Information')} + + {workloadsError || clusterQueueLoadError ? ( + + ) : ( + <> + + + {t('Cluster Queue')} + + + {workloadsLoaded && workload ? ( + workload?.status?.admission?.clusterQueue + ) : ( + + )} + + + + + {t('Local Queue')} + + + {workloadsLoaded && workload ? ( + workload?.spec?.queueName + ) : ( + + )} + + + + {t('Queue Wait')} + + {workloadsLoaded && workload ? ( + queueWaitTime + ) : ( + + )} + + + + {t('Pending')} + + {clusterQueueLoaded ? ( + clusterQueue?.status?.pendingWorkloads + ) : ( + + )} + + + + {t('Active')} + + {clusterQueueLoaded ? ( + clusterQueue?.status?.admittedWorkloads + ) : ( + + )} + + + + )} + + + );