Skip to content

Commit

Permalink
fixed the getproxybasepath and onHistoryServerClick to
Browse files Browse the repository at this point in the history
 deal with a gateway
  • Loading branch information
DanielAronovich committed Oct 22, 2024
1 parent fdcbc5e commit 6d2d71b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions spark-ui/src/components/AppDrawer/DrawerFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import {
BASE_PATH,
IS_HISTORY_SERVER_MODE,
} from "../../utils/UrlConsts";
import { getBaseAppUrl, isDataFlintSaaSUI } from "../../utils/UrlUtils";
import { getBaseAppUrl, isDataFlintSaaSUI, getProxyBasePath } from "../../utils/UrlUtils";

export default function DrawerFooter({ version }: { version?: string }) {
const onSparkUiClick = (): void => {
window.location.href = `${getBaseAppUrl(BASE_CURRENT_PAGE)}/jobs/`;
};

const onHistoryServerClick = (): void => {
window.location.href = `${BASE_PATH}/history`;
const basePath = getProxyBasePath();
window.location.href = basePath;
};

return (
Expand Down
10 changes: 5 additions & 5 deletions spark-ui/src/utils/UrlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export function hrefWithoutEndSlash(): string {
return fixedUrl;
}

export const getProxyBasePath = (): string =>
hrefWithoutEndSlash().substring(
0,
hrefWithoutEndSlash().lastIndexOf("/dataflint"),
);
export const getProxyBasePath = (): string => {
const url = new URL(window.location.href);
const pathToRemove = /\/history\/[^/]+\/dataflint\/?$/;
return url.origin + url.pathname.replace(pathToRemove, '');
};

export function getHistoryServerCurrentAppId(): string {
const urlSegments = hrefWithoutEndSlash().split("/");
Expand Down

0 comments on commit 6d2d71b

Please sign in to comment.