mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
call new LegacyRepository-Endpoint on Main.js
This commit is contained in:
@@ -21,6 +21,12 @@
|
||||
<version>${servlet.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>jsr311-api</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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<Props> {
|
||||
@@ -35,6 +38,15 @@ class Main extends React.Component<Props> {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user