From 6f6e6f60d46be48a17ef7af4fa09e0a33ef25d1b Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Thu, 9 Jan 2020 10:05:12 +0100 Subject: [PATCH] remove contextPath on switching view to changesets --- .../repos/codeSection/components/CodeViewSwitcher.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx b/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx index a6f8a70d7e..f423305aa5 100644 --- a/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx +++ b/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx @@ -17,9 +17,12 @@ type Props = { const CodeViewSwitcher: FC = ({ url }) => { const [t] = useTranslation("repos"); - const createDestinationUrl = (destination: string) => { + const createDestinationUrl = (destination: string, removePath: boolean) => { let splittedUrl = url.split("/"); splittedUrl[5] = destination; + if (removePath) { + splittedUrl.splice(7, splittedUrl.length); + } return splittedUrl.join("/"); }; @@ -29,13 +32,13 @@ const CodeViewSwitcher: FC = ({ url }) => { label={t("code.commits")} icon="fa fa-exchange-alt" color={url.includes("/code/changesets") ? "link is-selected" : undefined} - link={createDestinationUrl("changesets")} + link={createDestinationUrl("changesets", true)} /> );