@@ -39,16 +39,16 @@ export default function ConsoleLogCard({
3939 fetchLogText,
4040 onStepToggle,
4141 fetchExceptionText,
42+ currentRunPath,
4243} : ConsoleLogCardProps ) {
43- const handleToggle = ( e : ReactMouseEvent < HTMLElement > ) => {
44+ const handleToggle = ( e : ReactMouseEvent < HTMLAnchorElement > ) => {
4445 // Only prevent left clicks
4546 if ( e . button !== 0 || e . metaKey || e . ctrlKey ) {
4647 return ;
4748 }
4849
4950 e . preventDefault ( ) ;
50-
51- history . replaceState ( { } , "" , `?selected-node=` + step . id ) ;
51+ history . replaceState ( { } , "" , e . currentTarget . href ) ;
5252
5353 onStepToggle ( step . id ) ;
5454 } ;
@@ -68,7 +68,7 @@ export default function ConsoleLogCard({
6868 } ) }
6969 >
7070 < a
71- href = { ` ?selected-node=` + step . id }
71+ href = { currentRunPath + `stages/ ?selected-node=` + step . id }
7272 onClick = { handleToggle }
7373 key = { `step-action-area-${ step . id } ` }
7474 >
@@ -122,7 +122,7 @@ export default function ConsoleLogCard({
122122
123123 < Tooltip content = { messages . format ( LocalizedMessageKey . consoleNewTab ) } >
124124 < a
125- href = { `log?nodeId=${ step . id } ` }
125+ href = { `${ currentRunPath } stages/ log?nodeId=${ step . id } ` }
126126 className = { "jenkins-button jenkins-button--tertiary" }
127127 target = "_blank"
128128 rel = "noreferrer"
@@ -153,6 +153,7 @@ export default function ConsoleLogCard({
153153 fetchLogText = { fetchLogText }
154154 fetchExceptionText = { fetchExceptionText }
155155 onStepToggle = { onStepToggle }
156+ currentRunPath = { currentRunPath }
156157 />
157158 ) }
158159 </ div >
@@ -193,6 +194,7 @@ const ConsoleLogBody = memo(function ConsoleLogBody({
193194 stepBuffers,
194195 fetchLogText,
195196 fetchExceptionText,
197+ currentRunPath,
196198} : ConsoleLogCardBodyProps ) {
197199 const [ stepBuffer , setStepBuffer ] = useState < StepLogBufferInfo > ( {
198200 ...( stepBuffers . get ( stepId ) || defaultStepBuffer ( ) ) ,
@@ -265,6 +267,7 @@ const ConsoleLogBody = memo(function ConsoleLogBody({
265267 fetchExceptionText = { fetchExceptionText }
266268 stepId = { stepId }
267269 stepState = { stepState }
270+ currentRunPath = { currentRunPath }
268271 />
269272 </ Suspense >
270273 </ div >
@@ -284,6 +287,7 @@ export type ConsoleLogCardProps = {
284287 tailLogs : boolean ;
285288 scrollToTail : ( stepId : string , element : HTMLDivElement ) => void ;
286289 stopTailingLogs : ( ) => void ;
290+ currentRunPath : string ;
287291} ;
288292
289293export type ConsoleLogCardBodyProps = {
@@ -299,4 +303,5 @@ export type ConsoleLogCardBodyProps = {
299303 tailLogs : boolean ;
300304 scrollToTail : ( stepId : string , element : HTMLDivElement ) => void ;
301305 stopTailingLogs : ( ) => void ;
306+ currentRunPath : string ;
302307} ;
0 commit comments