Skip to content

Commit a9d1082

Browse files
authored
Fix invalid path concatenation when url has a segment (#574)
1 parent 99b6582 commit a9d1082

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/main/frontend/multi-pipeline-graph-view/multi-pipeline-graph/main/SingleRun.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export const SingleRun: (data: Props) => JSX.Element = ({ run }) => {
1313
const [stages, setStages] = useState<Array<StageInfo>>([]);
1414
let path = `tree?runId=${run.id}`;
1515

16-
const onJobView = !window.location.href.endsWith("multi-pipeline-graph/");
16+
const url = new URL(window.location.href);
17+
18+
const onJobView = !url.pathname.endsWith("multi-pipeline-graph/");
1719
if (onJobView) {
1820
path = `multi-pipeline-graph/${path}`;
1921
}

src/main/frontend/multi-pipeline-graph-view/multi-pipeline-graph/main/support/startPollingRunsStatus.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export default function startPollingRunsStatus(
1111
) {
1212
let path = "runs";
1313

14-
if (!window.location.href.endsWith("multi-pipeline-graph/")) {
14+
const url = new URL(window.location.href);
15+
16+
if (!url.pathname.endsWith("multi-pipeline-graph/")) {
1517
path = `multi-pipeline-graph/${path}`;
1618
}
1719

src/main/frontend/pipeline-graph-view/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import "./pipeline-graph/styles/main.scss";
88

99
function handleNodeClick(nodeName: string, id: number) {
1010
let location = `../pipeline-console?selected-node=${id}`;
11-
if (!window.location.href.endsWith("pipeline-graph/")) {
11+
const url = new URL(window.location.href);
12+
if (!url.pathname.endsWith("pipeline-graph/")) {
1213
location = `pipeline-console?selected-node=${id}`;
1314
}
1415

src/main/frontend/pipeline-graph-view/pipeline-graph/main/PipelineGraph.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ export class PipelineGraph extends React.Component {
8181
}
8282

8383
getTreePath() {
84-
if (!window.location.href.endsWith("pipeline-graph/")) {
85-
return `pipeline-graph/tree`;
84+
const url = new URL(window.location.href);
85+
86+
if (!url.pathname.endsWith("pipeline-graph/")) {
87+
return "pipeline-graph/tree";
8688
}
8789

8890
return "tree";

0 commit comments

Comments
 (0)