Skip to content

Commit 39749c2

Browse files
Merge pull request #13470 from vikram-raj/ocpbugs-25898
OCPBUGS-25898: Fix PipelineRun Logs tab navigation
2 parents ad1996a + d24c1e0 commit 39749c2

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

frontend/packages/pipelines-plugin/src/components/pipelineruns/PipelineRunDetailsPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ const PipelineRunDetailsPage: React.FC<DetailsPageProps> = (props) => {
9090
},
9191
{
9292
href: 'logs',
93-
path: 'logs/:name?',
9493
// t('pipelines-plugin~Logs')
9594
nameKey: 'pipelines-plugin~Logs',
9695
component: PipelineRunLogsWithActiveTask,

frontend/packages/pipelines-plugin/src/components/pipelineruns/detail-page-tabs/PipelineRunLogs.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Nav, NavItem, NavList } from '@patternfly/react-core';
33
import { TFunction } from 'i18next';
44
import * as _ from 'lodash';
55
import { withTranslation } from 'react-i18next';
6-
import { useParams, Link } from 'react-router-dom-v5-compat';
6+
import { Link, useLocation } from 'react-router-dom-v5-compat';
77
import { WatchK8sResource } from '@console/dynamic-plugin-sdk';
88
import { resourcePathFromModel } from '@console/internal/components/utils';
99
import { PipelineRunModel } from '../../../models';
@@ -144,7 +144,7 @@ class PipelineRunLogsWithTranslation extends React.Component<
144144
PipelineRunModel,
145145
obj.metadata.name,
146146
obj.metadata.namespace,
147-
)}/logs/`;
147+
)}/logs`;
148148

149149
return (
150150
<div className="odc-pipeline-run-logs">
@@ -162,10 +162,9 @@ class PipelineRunLogsWithTranslation extends React.Component<
162162
className="odc-pipeline-run-logs__navitem"
163163
>
164164
<Link
165-
to={
166-
logsPath +
167-
(taskRun?.metadata?.labels?.[TektonResourceLabel.pipelineTask] || '-')
168-
}
165+
to={`${logsPath}?taskName=${
166+
taskRun?.metadata?.labels?.[TektonResourceLabel.pipelineTask] || '-'
167+
}`}
169168
>
170169
<ColoredStatusIcon status={taskRunStatus(taskRun)} />
171170
<span
@@ -227,7 +226,9 @@ const PipelineRunLogs = withTranslation()(PipelineRunLogsWithTranslation);
227226
export const PipelineRunLogsWithActiveTask: React.FC<PipelineRunLogsWithActiveTaskProps> = ({
228227
obj,
229228
}) => {
230-
const { name: activeTask } = useParams();
229+
const location = useLocation();
230+
const params = new URLSearchParams(location.search);
231+
const activeTask = params?.get('taskName');
231232
const [taskRuns, taskRunsLoaded] = useTaskRuns(obj?.metadata?.namespace, obj?.metadata?.name);
232233

233234
return (

frontend/packages/pipelines-plugin/src/components/pipelines/pipeline-topology/PipelineTaskNode.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ const PipelineTaskNode: React.FunctionComponent<PipelineTaskNodeProps> = ({
133133

134134
const { name: plrName, namespace } = pipelineRun?.metadata;
135135
const path = plrName
136-
? `${resourcePathFromModel(PipelineRunModel, plrName, namespace)}/logs/${element.getLabel()}`
136+
? `${resourcePathFromModel(
137+
PipelineRunModel,
138+
plrName,
139+
namespace,
140+
)}/logs?taskName=${element.getLabel()}`
137141
: undefined;
138142

139143
const enableLogLink =

0 commit comments

Comments
 (0)