generated from openshift/console-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirects to new PipelineRun logs URL from old PipelineRun logs URL
- Loading branch information
1 parent
93df096
commit 99e4bd8
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |