diff --git a/scm-plugins/scm-legacy-plugin/pom.xml b/scm-plugins/scm-legacy-plugin/pom.xml index 52aff51dd2..6cfa74ea61 100644 --- a/scm-plugins/scm-legacy-plugin/pom.xml +++ b/scm-plugins/scm-legacy-plugin/pom.xml @@ -21,7 +21,13 @@ ${servlet.version} provided - + + javax.ws.rs + jsr311-api + 1.1.1 + compile + + diff --git a/scm-plugins/scm-legacy-plugin/src/main/java/sonia/scm/legacy/LegacyRepositoryService.java b/scm-plugins/scm-legacy-plugin/src/main/java/sonia/scm/legacy/LegacyRepositoryService.java index 69356ca6fa..9e27c736ea 100644 --- a/scm-plugins/scm-legacy-plugin/src/main/java/sonia/scm/legacy/LegacyRepositoryService.java +++ b/scm-plugins/scm-legacy-plugin/src/main/java/sonia/scm/legacy/LegacyRepositoryService.java @@ -9,6 +9,8 @@ import sonia.scm.repository.RepositoryManager; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; @Path("v2/legacy/repository") public class LegacyRepositoryService { @@ -22,6 +24,7 @@ public class LegacyRepositoryService { @GET @Path("{id}") + @Produces(MediaType.APPLICATION_JSON) @StatusCodes({ @ResponseCode(code = 200, condition = "success"), @ResponseCode(code = 401, condition = "not authenticated / invalid credentials"), diff --git a/scm-ui/src/containers/Main.js b/scm-ui/src/containers/Main.js index 8681f2457b..129b11f5ba 100644 --- a/scm-ui/src/containers/Main.js +++ b/scm-ui/src/containers/Main.js @@ -9,7 +9,7 @@ import Users from "../users/containers/Users"; import Login from "../containers/Login"; import Logout from "../containers/Logout"; -import { ProtectedRoute } from "@scm-manager/ui-components"; +import { ProtectedRoute, apiClient } from "@scm-manager/ui-components"; import { binder, ExtensionPoint } from "@scm-manager/ui-extensions"; import CreateUser from "../users/containers/CreateUser"; @@ -27,7 +27,10 @@ import Profile from "./Profile"; type Props = { authenticated?: boolean, - links: Links + links: Links, + + //context objects + history: History }; class Main extends React.Component { @@ -35,6 +38,15 @@ class Main extends React.Component { const { authenticated, links } = this.props; const redirectUrlFactory = binder.getExtension("main.redirect", this.props); let url = "/repos"; + if (location.href && location.href.includes("#diffPanel;")) { + let repoId = location.href.substring(location.href.search("#diffPanel;") + 11, location.href.search("#diffPanel;") + 21); + console.log("RepoId:"); + console.log(repoId); + apiClient.get("/legacy/repository/" + repoId).then(response => + console.log(JSON.parse(response)) + // this.props.history.push("/repo/" + response.responseBody.namespace + "/" + response.responseBody.name) + ); + } if (redirectUrlFactory) { url = redirectUrlFactory(this.props); }