Skip to content

Commit

Permalink
Redirects to new PipelineRun logs URL from old PipelineRun logs URL
Browse files Browse the repository at this point in the history
  • Loading branch information
vikram-raj committed Aug 12, 2024
1 parent 93df096 commit 99e4bd8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1173,5 +1173,16 @@
"flags": {
"required": ["HIDE_STATIC_PIPELINE_PLUGIN_PIPELINE_DETAILS"]
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": [
"/k8s/ns/:ns/tekton.dev~v1~PipelineRun/:plrName/logs/:taskName",
"/k8s/ns/:ns/tekton.dev~v1beta1~PipelineRun/:plrName/logs/:taskName"
],
"component": { "$codeRef": "pipelineRunDetails.LogURLRedirect" }
}
}
]
14 changes: 14 additions & 0 deletions src/components/pipelineRuns-details/LogURLRedirect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from 'react';
import { Navigate, useLocation, useParams } from 'react-router-dom-v5-compat';

const createLogURL = (pathname: string, taskName: string): string => {
const basePath = pathname.replace(/\/$/, '');
const detailsURL = basePath.split('/logs/');
return `${detailsURL[0]}/logs?taskName=${taskName}`;
};

export const LogURLRedirect: React.FC = () => {
const location = useLocation();
const { taskName } = useParams();
return <Navigate to={createLogURL(location.pathname, taskName)} replace />;
};
1 change: 1 addition & 0 deletions src/components/pipelineRuns-details/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { LogURLRedirect } from './LogURLRedirect';
export { default as PipelineRunDetails } from './PipelineRunDetails';
export { default as PipelineRunDetailsPage } from './PipelineRunDetailsPage';

0 comments on commit 99e4bd8

Please sign in to comment.