From 4e5d2d330238f34960afe7bee8e263fddc83e72d Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 8 Jul 2019 12:59:37 +0200 Subject: [PATCH] fix redirect url / use hal links in legacy plugin --- scm-plugins/scm-legacy-plugin/src/main/js/index.js | 10 ++++++---- scm-ui/src/containers/Main.js | 5 ----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/scm-plugins/scm-legacy-plugin/src/main/js/index.js b/scm-plugins/scm-legacy-plugin/src/main/js/index.js index 22e20eced7..97c3eb7e32 100644 --- a/scm-plugins/scm-legacy-plugin/src/main/js/index.js +++ b/scm-plugins/scm-legacy-plugin/src/main/js/index.js @@ -10,9 +10,11 @@ import { ErrorBoundary } from "@scm-manager/ui-components"; import DummyComponent from "./DummyComponent"; +import type {Links} from "@scm-manager/ui-types"; type Props = { authenticated?: boolean, + links: Links, //context objects history: History @@ -35,14 +37,14 @@ class LegacyRepositoryRedirect extends React.Component { }; redirectLegacyRepository() { - const { history } = this.props; + const { history, links } = this.props; if (location.href && location.href.includes("#diffPanel;")) { let splittedUrl = location.href.split(";"); let repoId = splittedUrl[1]; let changeSetId = splittedUrl[2]; apiClient - .get("/legacy/repository/" + repoId) + .get(links.nameAndNamespace.href.replace("{id}", repoId)) .then(response => response.json()) .then(payload => history.push( @@ -50,7 +52,7 @@ class LegacyRepositoryRedirect extends React.Component { payload.namespace + "/" + payload.name + - "/changesets/" + + "/changeset/" + changeSetId ) ) @@ -90,4 +92,4 @@ class LegacyRepositoryRedirect extends React.Component { } } -binder.bind("legacy.redirectRepository", withRouter(LegacyRepositoryRedirect)); +binder.bind("main.route", withRouter(LegacyRepositoryRedirect)); diff --git a/scm-ui/src/containers/Main.js b/scm-ui/src/containers/Main.js index deec951b41..1d358ecc87 100644 --- a/scm-ui/src/containers/Main.js +++ b/scm-ui/src/containers/Main.js @@ -122,11 +122,6 @@ class Main extends React.Component { component={Profile} authenticated={authenticated} /> -